From d609bf3651b74776b89bbee0122873c350cbabcf Mon Sep 17 00:00:00 2001 From: Glease <4586901+Glease@users.noreply.github.com> Date: Tue, 9 Apr 2024 14:34:02 +0800 Subject: [PATCH] fix incorrect fluid caching (#204) --- .../inventory/MEMonitorIFluidHandler.java | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/glodblock/github/inventory/MEMonitorIFluidHandler.java b/src/main/java/com/glodblock/github/inventory/MEMonitorIFluidHandler.java index 4b3b38ac..8d0d70c5 100644 --- a/src/main/java/com/glodblock/github/inventory/MEMonitorIFluidHandler.java +++ b/src/main/java/com/glodblock/github/inventory/MEMonitorIFluidHandler.java @@ -58,21 +58,18 @@ public class MEMonitorIFluidHandler implements IMEMonitor { public IAEFluidStack injectItems(IAEFluidStack input, Actionable type, BaseActionSource src) { int filled = this.handler.fill(this.side, input.getFluidStack(), type == Actionable.MODULATE); - if (filled == 0) { - return input.copy(); - } else if ((long) filled == input.getStackSize()) { - return null; - } else { - IAEFluidStack o = input.copy(); - o.setStackSize(input.getStackSize() - (long) filled); - if (type == Actionable.MODULATE) { - IAEFluidStack added = o.copy(); - this.cache.add(added); - this.postDifference(Collections.singletonList(added)); - this.onTick(); - } - return o; + + if (type == Actionable.MODULATE) { + this.onTick(); } + + if ((long) filled == input.getStackSize()) { + return null; + } + + IAEFluidStack o = input.copy(); + o.setStackSize(input.getStackSize() - (long) filled); + return o; } public IAEFluidStack extractItems(IAEFluidStack request, Actionable type, BaseActionSource src) {