aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/gregtech/api/recipe/check/CheckRecipeResultRegistry.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java96
-rw-r--r--src/main/resources/assets/gregtech/lang/en_US.lang1
3 files changed, 52 insertions, 50 deletions
diff --git a/src/main/java/gregtech/api/recipe/check/CheckRecipeResultRegistry.java b/src/main/java/gregtech/api/recipe/check/CheckRecipeResultRegistry.java
index dc7fc0d6a6..95443e8383 100644
--- a/src/main/java/gregtech/api/recipe/check/CheckRecipeResultRegistry.java
+++ b/src/main/java/gregtech/api/recipe/check/CheckRecipeResultRegistry.java
@@ -113,11 +113,6 @@ public final class CheckRecipeResultRegistry {
* Black Hole Compressor does not have an active black hole
*/
public static final CheckRecipeResult NO_BLACK_HOLE = SimpleCheckRecipeResult.ofFailure("no_black_hole");
- /**
- * Black Hole Compressor became unstable
- */
- public static final CheckRecipeResult UNSTABLE_BLACK_HOLE = SimpleCheckRecipeResult
- .ofFailure("unstable_black_hole");
public static final CheckRecipeResult NO_SEE_SKY = SimpleCheckRecipeResult.ofFailure("no_see_sky");
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java b/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java
index 13d6f7c1bb..7b444c6573 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/compressor/MTEBlackHoleCompressor.java
@@ -336,7 +336,7 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl
+ EnumChatFormatting.GRAY
+ " until it reaches 0")
.addInfo("At 0 stability, the black hole is " + EnumChatFormatting.DARK_RED + "UNSTABLE")
- .addInfo("Once the black hole becomes unstable, it will void all inputs instantly!")
+ .addInfo("Once the black hole becomes unstable, it will void recipes and eventually close itself!")
.addSeparator()
.addInfo("Running recipes in the machine will slow the decay rate by " + EnumChatFormatting.RED + "25%")
.addInfo(
@@ -558,15 +558,6 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl
return CheckRecipeResultRegistry.insufficientPower(recipe.mEUt);
return super.validateRecipe(recipe);
}
-
- @Nonnull
- protected CheckRecipeResult onRecipeStart(@Nonnull GTRecipe recipe) {
- // If recipe needs a black hole and one is active but unstable, continuously void items
- if (blackHoleStatus == 3) {
- return CheckRecipeResultRegistry.UNSTABLE_BLACK_HOLE;
- }
- return CheckRecipeResultRegistry.SUCCESSFUL;
- }
}.setMaxParallelSupplier(this::getMaxParallelRecipes)
.setEuModifier(0.7F)
.setSpeedBonus(0.2F);
@@ -589,44 +580,61 @@ public class MTEBlackHoleCompressor extends MTEExtendedPowerMultiBlockBase<MTEBl
if (!aBaseMetaTileEntity.isServerSide()) {
playBlackHoleSounds();
}
- if (aTick % 20 == 0) {
- if (blackHoleStatus == 2) {
- if (blackHoleStability >= 0) {
- float stabilityDecrease = 1F;
- // If the machine is running, reduce stability loss by 25%
- if (this.maxProgresstime() != 0) {
- stabilityDecrease = 0.75F;
- }
- // Search all hatches for catalyst fluid
- // If found enough, drain it and reduce stability loss to 0
- // Every 30 drains, double the cost
- FluidStack totalCost = new FluidStack(blackholeCatalyzingCost, catalyzingCostModifier);
-
- boolean didDrain = false;
- for (MTEHatchInput hatch : spacetimeHatches) {
- if (drain(hatch, totalCost, false)) {
- drain(hatch, totalCost, true);
- catalyzingCounter += 1;
- stabilityDecrease = 0;
- if (catalyzingCounter >= 30) {
- catalyzingCostModifier *= 2;
- catalyzingCounter = 0;
- }
- didDrain = true;
- break;
- }
- }
- if (shouldRender) {
- if (rendererTileEntity == null) createRenderBlock();
- rendererTileEntity.toggleLaser(didDrain);
- rendererTileEntity.setStability(blackHoleStability / 100F);
+ // Run stability checks once per second if a black hole is open
+ if (blackHoleStatus == 1 || aTick % 20 != 0) return;
+
+ // Base 1 loss
+ float stabilityDecrease = 1F;
+
+ boolean didDrain = false;
+
+ // Only do loss reductions if the black hole is stable - unstable black hole can't be frozen
+ if (blackHoleStability >= 0) {
+
+ // If the machine is running, reduce stability loss by 25%
+ if (this.maxProgresstime() != 0) {
+ stabilityDecrease = 0.75F;
+ }
+
+ // Search all hatches for catalyst fluid
+ // If found enough, drain it and reduce stability loss to 0
+ // Every 30 drains, double the cost
+ FluidStack totalCost = new FluidStack(blackholeCatalyzingCost, catalyzingCostModifier);
+
+ for (MTEHatchInput hatch : spacetimeHatches) {
+ if (drain(hatch, totalCost, false)) {
+ drain(hatch, totalCost, true);
+ catalyzingCounter += 1;
+ stabilityDecrease = 0;
+ if (catalyzingCounter >= 30) {
+ // Hidden cap at 1B per tick so we don't integer overflow
+ if (catalyzingCostModifier <= 1000000000) catalyzingCostModifier *= 2;
+ catalyzingCounter = 0;
}
- if (blackHoleStability >= 0) blackHoleStability -= stabilityDecrease;
- else blackHoleStability = 0;
- } else blackHoleStatus = 3;
+ didDrain = true;
+ break;
+ }
}
+ } else blackHoleStatus = 3;
+
+ if (shouldRender) {
+ if (rendererTileEntity == null) createRenderBlock();
+ rendererTileEntity.toggleLaser(didDrain);
+ rendererTileEntity.setStability(blackHoleStability / 100F);
+ }
+
+ blackHoleStability -= stabilityDecrease;
+
+ // Close black hole and reset if it has been unstable for 15 minutes or more
+ if (blackHoleStability <= -900) {
+ blackHoleStatus = 1;
+ blackHoleStability = 100;
+ catalyzingCostModifier = 1;
+ rendererTileEntity = null;
+ destroyRenderBlock();
}
+
}
public int getMaxParallelRecipes() {
diff --git a/src/main/resources/assets/gregtech/lang/en_US.lang b/src/main/resources/assets/gregtech/lang/en_US.lang
index d76bdfdefc..53a2282b08 100644
--- a/src/main/resources/assets/gregtech/lang/en_US.lang
+++ b/src/main/resources/assets/gregtech/lang/en_US.lang
@@ -535,7 +535,6 @@ GT5U.gui.text.drill_generic_finished=§7Mining pipes have been retracted
GT5U.gui.text.drill_retract_pipes_finished=§7Operation aborted
GT5U.gui.text.backfiller_no_concrete=§7No liquid concrete
GT5U.gui.text.no_black_hole=§7Requires an active black hole
-GT5U.gui.text.unstable_black_hole=§7Black hole is unstable
GT5U.gui.text.backfiller_finished=§aWork complete
GT5U.gui.text.backfiller_working=§aPouring concrete
GT5U.gui.text.backfiller_current_area=§7Filling at y-level: §a%s