diff options
author | Jakub <53441451+kuba6000@users.noreply.github.com> | 2022-10-31 17:09:23 +0100 |
---|---|---|
committer | kuba6000 <kuba.123123.6000@gmail.com> | 2022-10-31 17:09:23 +0100 |
commit | eff30d832832f7963932e155b86655928f90a7e5 (patch) | |
tree | 0dd832b056dcb67ce12ee780658ae62dac2d97af /src/main/java/kubatech/tileentity/gregtech/multiblock | |
parent | 7353a8c4ea895e6b22f4756bbcc7b944e3c38abb (diff) | |
download | GT5-Unofficial-eff30d832832f7963932e155b86655928f90a7e5.tar.gz GT5-Unofficial-eff30d832832f7963932e155b86655928f90a7e5.tar.bz2 GT5-Unofficial-eff30d832832f7963932e155b86655928f90a7e5.zip |
EIG: Fix stocking input bus exploit (GTNewHorizons/bartworks#230)
* Disgusting
* Fix exploit
* Maybe fix black wheat blocks inside
* Ok we will fight then
* Cosmetics
* Proper fix
Diffstat (limited to 'src/main/java/kubatech/tileentity/gregtech/multiblock')
-rw-r--r-- | src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeIndustrialGreenhouse.java | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeIndustrialGreenhouse.java b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeIndustrialGreenhouse.java index 513188dd22..a3dcde7c7f 100644 --- a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeIndustrialGreenhouse.java +++ b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeIndustrialGreenhouse.java @@ -19,6 +19,7 @@ package kubatech.tileentity.gregtech.multiblock; import static com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference.MULTIBLOCK_ADDED_VIA_BARTWORKS; import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static gregtech.api.enums.GT_Values.AuthorKuba; import static gregtech.api.enums.Textures.BlockIcons.*; import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; @@ -205,6 +206,7 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); tt.addMachineType("Crop Farm") .addInfo("Controller block for the Extreme Industrial Greenhouse") + .addInfo(AuthorKuba) .addInfo("Grow your crops like a chad !") .addInfo("Use screwdriver to enable/change/disable setup mode") .addInfo("Use screwdriver while sneaking to enable/disable IC2 mode") @@ -563,14 +565,12 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse public boolean addCrop(ItemStack input) { if (!isIC2Mode) for (GreenHouseSlot g : mStorage) - if (GT_Utility.areStacksEqual(g.input, input)) { + if (g.input.stackSize < 64 && GT_Utility.areStacksEqual(g.input, input)) { g.addAll(this.getBaseMetaTileEntity().getWorld(), input); if (input.stackSize == 0) return true; } - GreenHouseSlot h = new GreenHouseSlot(this, input.copy(), true, isIC2Mode); + GreenHouseSlot h = new GreenHouseSlot(this, input, true, isIC2Mode); if (h.isValid) { - if (isIC2Mode) input.stackSize--; - else input.stackSize = 0; mStorage.add(h); return true; } @@ -724,7 +724,7 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse if (i == Items.reeds) b = Blocks.reeds; else { b = Block.getBlockFromItem(i); - if (!(b == Blocks.cactus)) return; + if (b != Blocks.cactus) return; } needsreplanting = false; } @@ -746,7 +746,9 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse crop = b; isIC2Crop = false; - if (addDrops(world, input.stackSize, autocraft) == 0 && !drops.isEmpty()) { + int toUse = Math.min(64, input.stackSize); + if (addDrops(world, toUse, autocraft) == 0 && !drops.isEmpty()) { + input.stackSize -= toUse; this.isValid = true; } } @@ -840,8 +842,7 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse int dur = cc.growthDuration(te); int rate = te.calcGrowthRate(); - if (rate == 0) // should not be possible with those stats - return; + if (rate == 0) return; // should not be possible with those stats growthticks = dur / rate; if (growthticks < 1) growthticks = 1; |