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; }