From 4d8ab247f924f4948724e85275362a66afa78564 Mon Sep 17 00:00:00 2001 From: repo_alt Date: Sun, 18 Jul 2021 11:52:19 +0300 Subject: ME Output bus storeAll returned inverted value --- .../machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/main/java/gregtech/common') 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 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; -- cgit