diff options
author | miozune <miozune@gmail.com> | 2023-05-28 18:23:46 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-28 11:23:46 +0200 |
commit | 5e06efde99f3c744ac2528bc0efcd71727ea2c85 (patch) | |
tree | be19a766030b56a5ff406d8a235c043c5ae3cda6 /src/main/java | |
parent | 2053017d456fca5ada43974d3aa72d7dc32472b4 (diff) | |
download | GT5-Unofficial-5e06efde99f3c744ac2528bc0efcd71727ea2c85.tar.gz GT5-Unofficial-5e06efde99f3c744ac2528bc0efcd71727ea2c85.tar.bz2 GT5-Unofficial-5e06efde99f3c744ac2528bc0efcd71727ea2c85.zip |
Update to new void protection API & implement it for some multi (#329)
* Update to new void protection API & implement it for some multi
* Update method names
* Update GT
* Fix THTR & HTGR not preventing consumption
Former-commit-id: 7a116178ec31dffe23fb741a3d432856189bbefc
Diffstat (limited to 'src/main/java')
9 files changed, 43 insertions, 17 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java index 65cfae2ce4..bb01ef8cce 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java @@ -312,6 +312,7 @@ public class GT_TileEntity_BioVat extends GT_MetaTileEntity_EnhancedMultiBlockBa this.mEfficiency = (10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; + if (!canOutputAll(gtRecipe)) return false; if (!gtRecipe.isRecipeInputEqual(true, tFluids, tInputs)) return false; final FluidStack recipeFluidOutput = gtRecipe.getFluidOutput(0); @@ -739,4 +740,9 @@ public class GT_TileEntity_BioVat extends GT_MetaTileEntity_EnhancedMultiBlockBa + " %"; return infoData; } + + @Override + public boolean supportsVoidProtection() { + return true; + } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java index 4d11a29638..c64ae704ca 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java @@ -233,6 +233,7 @@ public class GT_TileEntity_CircuitAssemblyLine extends } for (GT_Recipe recipe : this.GT_RECIPE_COLLECTION) { + if (!canOutputAll(recipe)) return false; if (recipe.isRecipeInputEqual( true, false, @@ -439,7 +440,12 @@ public class GT_TileEntity_CircuitAssemblyLine extends } @Override - protected boolean isRecipeLockingEnabled() { + public boolean supportsVoidProtection() { + return true; + } + + @Override + public boolean isRecipeLockingEnabled() { return imprintedItemName != null && !imprintedItemName.equals(""); } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_ElectricImplosionCompressor.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_ElectricImplosionCompressor.java index 681dd0225a..b09d512fff 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_ElectricImplosionCompressor.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_ElectricImplosionCompressor.java @@ -285,16 +285,12 @@ public class GT_TileEntity_ElectricImplosionCompressor GT_ParallelHelper helper = new GT_ParallelHelper().setRecipe(tRecipe).setItemInputs(tItemInputs) .setFluidInputs(tFluidInputs).setAvailableEUt(tTotalEU).setMaxParallel(tCurrentMaxParallel) - .enableConsumption().enableOutputCalculation(); + .enableConsumption().enableOutputCalculation().setController(this); if (batchMode) { helper.enableBatchMode(128); } - if (!voidExcess) { - helper.enableVoidProtection(this); - } - helper.build(); if (helper.getCurrentParallel() == 0) { @@ -540,12 +536,12 @@ public class GT_TileEntity_ElectricImplosionCompressor } @Override - protected boolean isBatchModeButtonEnabled() { + public boolean supportsBatchMode() { return true; } @Override - protected boolean isVoidExcessButtonEnabled() { + public boolean supportsVoidProtection() { return true; } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_HTGR.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_HTGR.java index a53210a27e..96e1465c9d 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_HTGR.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_HTGR.java @@ -290,14 +290,18 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase int toReduce = MathUtils.floorInt((double) this.fuelsupply * 0.025D * eff); - this.fuelsupply -= toReduce; + final int originalToReduce = toReduce; int burnedballs = toReduce / 64; if (burnedballs > 0) toReduce -= burnedballs * 64; int meta = (this.fueltype * HTGRMaterials.MATERIALS_PER_FUEL) + HTGRMaterials.BURNED_OUT_FUEL_INDEX; - this.mOutputItems = new ItemStack[] { new ItemStack(HTGRMaterials.aHTGR_Materials, burnedballs, meta), + ItemStack[] toOutput = new ItemStack[] { new ItemStack(HTGRMaterials.aHTGR_Materials, burnedballs, meta), new ItemStack(HTGRMaterials.aHTGR_Materials, toReduce, meta + 1) }; + if (!canOutputAll(toOutput)) return false; + + this.fuelsupply -= originalToReduce; + this.mOutputItems = toOutput; // this.updateSlots(); // not needed ? @@ -456,6 +460,11 @@ public class GT_TileEntity_HTGR extends GT_MetaTileEntity_EnhancedMultiBlockBase "HTGR is now running in " + (this.empty ? "emptying mode." : "normal Operation")); } + @Override + public boolean supportsVoidProtection() { + return true; + } + public static class HTGRMaterials { private static class CustomHTGRSimpleSubItemClass extends SimpleSubItemClass { diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_THTR.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_THTR.java index 913f952b22..ed4fbccd84 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_THTR.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_THTR.java @@ -254,14 +254,18 @@ public class GT_TileEntity_THTR extends GT_MetaTileEntity_EnhancedMultiBlockBase int toReduce = MathUtils.floorInt((double) this.fuelsupply * 0.005D * eff); - this.fuelsupply -= toReduce; + final int originalToReduce = toReduce; int burnedballs = toReduce / 64; if (burnedballs > 0) toReduce -= burnedballs * 64; int meta = THTRMaterials.MATERIAL_USED_FUEL_INDEX; - this.mOutputItems = new ItemStack[] { new ItemStack(THTRMaterials.aTHTR_Materials, burnedballs, meta), + ItemStack[] toOutput = new ItemStack[] { new ItemStack(THTRMaterials.aTHTR_Materials, burnedballs, meta), new ItemStack(THTRMaterials.aTHTR_Materials, toReduce, meta + 1) }; + if (!canOutputAll(toOutput)) return false; + + this.fuelsupply -= originalToReduce; + this.mOutputItems = toOutput; // this.updateSlots(); not needed ? @@ -383,6 +387,11 @@ public class GT_TileEntity_THTR extends GT_MetaTileEntity_EnhancedMultiBlockBase "THTR is now running in " + (this.empty ? "emptying mode." : "normal Operation")); } + @Override + public boolean supportsVoidProtection() { + return true; + } + public static class THTRMaterials { public static final SimpleSubItemClass aTHTR_Materials = new SimpleSubItemClass( diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaBlastFurnace.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaBlastFurnace.java index 67c7f3f272..3003a1141b 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaBlastFurnace.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaBlastFurnace.java @@ -545,12 +545,12 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_TileEntity_MegaMultiBlock } @Override - protected boolean isInputSeparationButtonEnabled() { + public boolean supportsInputSeparation() { return true; } @Override - protected boolean isBatchModeButtonEnabled() { + public boolean supportsBatchMode() { return true; } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaChemicalReactor.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaChemicalReactor.java index bb410ec898..ddd716d661 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaChemicalReactor.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaChemicalReactor.java @@ -317,7 +317,7 @@ public class GT_TileEntity_MegaChemicalReactor } @Override - protected boolean isBatchModeButtonEnabled() { + public boolean supportsBatchMode() { return true; } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaDistillTower.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaDistillTower.java index d897a4bfa7..c7f1bc2380 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaDistillTower.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaDistillTower.java @@ -496,7 +496,7 @@ public class GT_TileEntity_MegaDistillTower extends GT_TileEntity_MegaMultiBlock } @Override - protected boolean isBatchModeButtonEnabled() { + public boolean supportsBatchMode() { return true; } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaVacuumFreezer.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaVacuumFreezer.java index 4937b284d7..daf87fd707 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaVacuumFreezer.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaVacuumFreezer.java @@ -332,7 +332,7 @@ public class GT_TileEntity_MegaVacuumFreezer extends GT_TileEntity_MegaMultiBloc } @Override - protected boolean isBatchModeButtonEnabled() { + public boolean supportsBatchMode() { return true; } } |