From 309f035a3d2f1922808a82fd59024d3c34c3f0f7 Mon Sep 17 00:00:00 2001 From: Jakub <53441451+kuba6000@users.noreply.github.com> Date: Wed, 26 Jun 2024 19:44:38 +0200 Subject: Fix dupe bug in YOTHatch (#2656) * Fix dupe bug in YOTHatch * Proper implementation of injectItems --- .../blocks/tileEntity/GTMetaTileEntity/YOTTAHatch.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity/YOTTAHatch.java b/src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity/YOTTAHatch.java index f905e82f8c..2625934256 100644 --- a/src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity/YOTTAHatch.java +++ b/src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity/YOTTAHatch.java @@ -169,11 +169,13 @@ public class YOTTAHatch extends GT_MetaTileEntity_Hatch implements IGridProxyabl @Override public IAEFluidStack injectItems(IAEFluidStack input, Actionable type, BaseActionSource src) { - long amt = fill(null, input, false); - if (amt == input.getStackSize()) { - if (type.equals(Actionable.MODULATE)) fill(null, input, true); - return null; + long amt = fill(null, input, type.equals(Actionable.MODULATE)); + if (amt == 0) { + return input; } + input = input.copy(); + input.decStackSize(amt); + if (input.getStackSize() <= 0) return null; return input; } @@ -262,7 +264,7 @@ public class YOTTAHatch extends GT_MetaTileEntity_Hatch implements IGridProxyabl final BigInteger delta = host.mStorage.subtract(host.mStorageCurrent); returned = delta.intValueExact(); } - host.mStorageCurrent = host.mStorage; + if (doFill) host.mStorageCurrent = host.mStorage; return returned; } } @@ -291,7 +293,7 @@ public class YOTTAHatch extends GT_MetaTileEntity_Hatch implements IGridProxyabl final BigInteger delta = host.mStorage.subtract(host.mStorageCurrent); returned = delta.longValueExact(); } - host.mStorageCurrent = host.mStorage; + if (doFill) host.mStorageCurrent = host.mStorage; return returned; } } -- cgit