diff options
author | repo-alt <wvk17@yandex.ru> | 2021-07-21 13:57:18 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-21 13:57:18 +0300 |
commit | 9dbe381c07cb89321885e2b4b6967a2c24d7c398 (patch) | |
tree | 246ad9699583ad303c00f7fa846f65fac3aa0e92 /src/main/java/gregtech/common/tileentities | |
parent | 2337e0fa3748aa29a4d26618eb9d9d43eeed21fa (diff) | |
parent | 4d8ab247f924f4948724e85275362a66afa78564 (diff) | |
download | GT5-Unofficial-9dbe381c07cb89321885e2b4b6967a2c24d7c398.tar.gz GT5-Unofficial-9dbe381c07cb89321885e2b4b6967a2c24d7c398.tar.bz2 GT5-Unofficial-9dbe381c07cb89321885e2b4b6967a2c24d7c398.zip |
Merge pull request #599 from repo-alt/experimental
ME Output bus storeAll returned inverted value
Diffstat (limited to 'src/main/java/gregtech/common/tileentities')
-rw-r--r-- | src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java index 12d839d221..9b74b979f4 100644 --- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java +++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java @@ -65,12 +65,16 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc public boolean storeAll(ItemStack aStack) { if (!GregTech_API.mAE2) return false; - int tTotal = aStack.stackSize; - int tStored = store(aStack); - aStack.stackSize -= tStored; - return tTotal == tStored; + aStack.stackSize = store(aStack); + return aStack.stackSize == 0; } + /** + * Attempt to store items in connected ME network. Returns how many items did not fit (if the network was down e.g.) + * + * @param stack input stack + * @return amount of items left over + */ @Optional.Method(modid = "appliedenergistics2") public int store(final ItemStack stack) { if (stack == null) @@ -80,9 +84,8 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc if (proxy == null) return stack.stackSize; IMEMonitor<IAEItemStack> sg = proxy.getStorage().getItemInventory(); - final IEnergySource src = proxy.getEnergy(); IAEItemStack toStore = AEApi.instance().storage().createItemStack(stack); - IAEItemStack rest = Platform.poweredInsert( src, sg, toStore, getRequest()); + IAEItemStack rest = Platform.poweredInsert( proxy.getEnergy(), sg, toStore, getRequest()); if (rest != null) return (int)rest.getStackSize(); return 0; |