From 79601b9862cb10912897ccc5394588055495fe54 Mon Sep 17 00:00:00 2001 From: Kogepan229 <73163994+Kogepan229@users.noreply.github.com> Date: Wed, 17 Jun 2026 14:43:59 +0900 Subject: [PATCH] Fix filling containers (#1383) --- .../implementations/ContainerMEMonitorable.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/appeng/container/implementations/ContainerMEMonitorable.java b/src/main/java/appeng/container/implementations/ContainerMEMonitorable.java index 48f7c2992..2dfd03b1e 100644 --- a/src/main/java/appeng/container/implementations/ContainerMEMonitorable.java +++ b/src/main/java/appeng/container/implementations/ContainerMEMonitorable.java @@ -985,25 +985,23 @@ public class ContainerMEMonitorable extends AEBaseContainer if (hand.stackSize == 1) { fillSingleFluidContainer(player, hand, stackInSlot, type, monitor); } else { - long capacity = type.getContainerItemCapacity(hand, stackInSlot); - if (capacity <= 0) return; - ObjectLongPair fullFilledPair = type.fillContainer( Platform.copyStackWithSizeOne(hand), stackInSlot.copy().setStackSize(Long.MAX_VALUE)); ItemStack fullFilledContainer = fullFilledPair.left(); - if (fullFilledContainer == null) return; + long amountPerContainer = fullFilledPair.rightLong(); + if (fullFilledContainer == null || amountPerContainer <= 0) return; if (fullFilledContainer.getMaxStackSize() >= hand.stackSize - && capacity * hand.stackSize <= stackInSlot.getStackSize()) { + && amountPerContainer * hand.stackSize <= stackInSlot.getStackSize()) { // Fill all item in player hand final IAEStack stackToFill = monitor.extractItems( - stackInSlot.copy().setStackSize(capacity * hand.stackSize), + stackInSlot.copy().setStackSize(amountPerContainer * hand.stackSize), Actionable.MODULATE, this.getActionSource()); if (stackToFill == null) return; - if (stackToFill.getStackSize() == capacity * hand.stackSize) { + if (stackToFill.getStackSize() == amountPerContainer * hand.stackSize) { fullFilledContainer.stackSize = hand.stackSize; player.inventory.setItemStack(fullFilledContainer); }