diff options
author | Jakub <53441451+kuba6000@users.noreply.github.com> | 2023-06-22 12:50:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-22 12:50:02 +0200 |
commit | eb268a3c9329a9e4466ca5046016149b319c1842 (patch) | |
tree | cb8a9997d3019e69c2c2900893e38a6625191f3d /src/main/java/kubatech/tileentity | |
parent | 3e7d12c4150e49f2fae14f6c7dcdbbfad11ef519 (diff) | |
download | GT5-Unofficial-eb268a3c9329a9e4466ca5046016149b319c1842.tar.gz GT5-Unofficial-eb268a3c9329a9e4466ca5046016149b319c1842.tar.bz2 GT5-Unofficial-eb268a3c9329a9e4466ca5046016149b319c1842.zip |
Output all crops / bees when controller is broken (#80)
* Fix bug in EEC
* Output all crops / bees when controller is broken
Diffstat (limited to 'src/main/java/kubatech/tileentity')
3 files changed, 26 insertions, 22 deletions
diff --git a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeExterminationChamber.java b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeExterminationChamber.java index fcaf2a833e..7f2c12ca1a 100644 --- a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeExterminationChamber.java +++ b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeExterminationChamber.java @@ -510,6 +510,7 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber this.mMaxProgresstime = 400; } else { if (getMaxInputEu() < recipe.mEUt) return false; + if (recipe.alwaysinfernal && getMaxInputEu() < recipe.mEUt * 8) return false; double attackDamage = DIAMOND_SPIKES_DAMAGE; // damage from spikes GT_MetaTileEntity_Hatch_InputBus inputbus = this.mInputBusses.size() == 0 ? null : this.mInputBusses.get(0); 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 0c8dab2722..b898a11cc5 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 @@ -121,7 +121,6 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_MultiInput; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Utility; @@ -129,7 +128,6 @@ import gregtech.common.GT_DummyWorld; import gregtech.common.blocks.GT_Block_Ores_Abstract; import gregtech.common.blocks.GT_Item_Ores; import gregtech.common.blocks.GT_TileEntity_Ores; -import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_OutputBus_ME; import ic2.api.crops.CropCard; import ic2.api.crops.Crops; import ic2.core.Ic2Items; @@ -217,6 +215,17 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse } @Override + public void onRemoval() { + super.onRemoval(); + if (getBaseMetaTileEntity().isServerSide()) tryOutputAll(mStorage, s -> { + ArrayList<ItemStack> l = new ArrayList<>(2); + l.add(((GreenHouseSlot) s).input.copy()); + if (((GreenHouseSlot) s).undercrop != null) l.add(((GreenHouseSlot) s).undercrop.copy()); + return l; + }); + } + + @Override public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aPlayer.isSneaking()) { if (this.mMaxProgresstime > 0) { @@ -415,22 +424,12 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse if (mStorage.size() >= mMaxSlots) break; } } else if (setupphase == 2) { - int emptySlots = 0; - boolean ignoreEmptiness = false; - for (GT_MetaTileEntity_Hatch_OutputBus i : mOutputBusses) { - if (i instanceof GT_MetaTileEntity_Hatch_OutputBus_ME) { - ignoreEmptiness = true; - break; - } - for (int j = 0; j < i.getSizeInventory(); j++) - if (i.isValidSlot(j)) if (i.getStackInSlot(j) == null) emptySlots++; - } - while (mStorage.size() > 0) { - if (!ignoreEmptiness && (emptySlots -= 2) < 0) break; - this.addOutput(this.mStorage.get(0).input.copy()); - if (this.mStorage.get(0).undercrop != null) this.addOutput(this.mStorage.get(0).undercrop.copy()); - this.mStorage.remove(0); - } + tryOutputAll(mStorage, s -> { + ArrayList<ItemStack> l = new ArrayList<>(2); + l.add(((GreenHouseSlot) s).input.copy()); + if (((GreenHouseSlot) s).undercrop != null) l.add(((GreenHouseSlot) s).undercrop.copy()); + return l; + }); } this.updateSlots(); diff --git a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_MegaIndustrialApiary.java b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_MegaIndustrialApiary.java index 43fea0f182..47cbd16a06 100644 --- a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_MegaIndustrialApiary.java +++ b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_MegaIndustrialApiary.java @@ -245,6 +245,13 @@ public class GT_MetaTileEntity_MegaIndustrialApiary super(aName); } + @Override + public void onRemoval() { + super.onRemoval(); + if (getBaseMetaTileEntity().isServerSide()) + tryOutputAll(mStorage, s -> Collections.singletonList(((BeeSimulator) s).queenStack)); + } + private boolean isCacheDirty = true; private final HashMap<String, String> flowersCache = new HashMap<>(); private final HashSet<String> flowersCheck = new HashSet<>(); @@ -461,11 +468,8 @@ public class GT_MetaTileEntity_MegaIndustrialApiary } updateSlots(); } else if (mPrimaryMode == 1 && mStorage.size() > 0) { - for (int i = 0, imax = Math.min(10, mStorage.size()); i < imax; i++) { - addOutput(mStorage.get(0).queenStack); - mStorage.remove(0); + if (tryOutputAll(mStorage, s -> Collections.singletonList(((BeeSimulator) s).queenStack))) isCacheDirty = true; - } } else return false; mMaxProgresstime = 10; mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); |