From b80e738005d7266b581c6ebb09f3499de58a951c Mon Sep 17 00:00:00 2001 From: Circulate233 Date: Tue, 23 Dec 2025 22:46:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E6=9C=BA=E6=A2=B0?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E6=80=BB=E7=BA=BF=E5=9C=A8=E5=88=9A=E6=94=BE?= =?UTF-8?q?=E7=BD=AE=E6=97=B6=E6=89=80=E6=9C=89Slot=E5=A0=86=E5=8F=A0?= =?UTF-8?q?=E4=B8=8A=E9=99=90=E5=9D=87=E4=B8=BA0=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mmce/common/network/PktMEOutputBusStackSizeChange.java | 4 +--- .../github/kasuminova/mmce/common/tile/MEItemOutputBus.java | 5 +++-- .../modularmachinery/common/util/IOInventory.java | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/java/github/kasuminova/mmce/common/network/PktMEOutputBusStackSizeChange.java b/src/main/java/github/kasuminova/mmce/common/network/PktMEOutputBusStackSizeChange.java index 73a253d1..f89ca269 100644 --- a/src/main/java/github/kasuminova/mmce/common/network/PktMEOutputBusStackSizeChange.java +++ b/src/main/java/github/kasuminova/mmce/common/network/PktMEOutputBusStackSizeChange.java @@ -40,12 +40,10 @@ public IMessage onMessage(final PktMEOutputBusStackSizeChange message, final Mes player.getServerWorld().addScheduledTask(() -> { TileEntity te = player.world.getTileEntity(message.pos); - if (!(te instanceof MEItemOutputBus)) { + if (!(te instanceof MEItemOutputBus outputBus)) { return; } - MEItemOutputBus outputBus = (MEItemOutputBus) te; - int validatedStackSize = Math.max(1, message.stackSize); outputBus.setConfiguredStackSize(validatedStackSize); diff --git a/src/main/java/github/kasuminova/mmce/common/tile/MEItemOutputBus.java b/src/main/java/github/kasuminova/mmce/common/tile/MEItemOutputBus.java index 676ab65c..0f2d7c66 100644 --- a/src/main/java/github/kasuminova/mmce/common/tile/MEItemOutputBus.java +++ b/src/main/java/github/kasuminova/mmce/common/tile/MEItemOutputBus.java @@ -21,7 +21,7 @@ public class MEItemOutputBus extends MEItemBus implements SettingsTransfer { - private int configuredStackSize = Integer.MAX_VALUE; + private int configuredStackSize; @Override public IOInventory buildInventory() { @@ -31,7 +31,8 @@ public IOInventory buildInventory() { for (int slotID = 0; slotID < slotIDs.length; slotID++) { slotIDs[slotID] = slotID; } - IOInventory inv = new IOInventory(this, new int[]{}, slotIDs); + IOInventory inv = new IOInventory(this, new int[0], slotIDs); + configuredStackSize = Integer.MAX_VALUE; inv.setStackLimit(this.configuredStackSize, slotIDs); inv.setListener(slot -> { synchronized (this) { diff --git a/src/main/java/hellfirepvp/modularmachinery/common/util/IOInventory.java b/src/main/java/hellfirepvp/modularmachinery/common/util/IOInventory.java index 8f90c820..49cb2fd0 100644 --- a/src/main/java/hellfirepvp/modularmachinery/common/util/IOInventory.java +++ b/src/main/java/hellfirepvp/modularmachinery/common/util/IOInventory.java @@ -22,7 +22,7 @@ import javax.annotation.Nonnull; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; -import java.util.function.Consumer; +import java.util.function.IntConsumer; /** * This class is part of the Modular Machinery Mod @@ -37,7 +37,7 @@ public class IOInventory extends IItemHandlerImpl implements ReadWriteLockProvid private final TileEntitySynchronized owner; // TODO IntConsumer. - private Consumer listener = null; + private IntConsumer listener = null; private IOInventory(TileEntitySynchronized owner) { this.owner = owner; @@ -58,7 +58,7 @@ public static IOInventory deserialize(TileEntitySynchronized owner, NBTTagCompou return inv; } - public IOInventory setListener(Consumer listener) { + public IOInventory setListener(IntConsumer listener) { this.listener = listener; return this; }