Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

public class MEItemOutputBus extends MEItemBus implements SettingsTransfer {

private int configuredStackSize = Integer.MAX_VALUE;
private int configuredStackSize;

@Override
public IOInventory buildInventory() {
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -37,7 +37,7 @@ public class IOInventory extends IItemHandlerImpl implements ReadWriteLockProvid

private final TileEntitySynchronized owner;
// TODO IntConsumer.
private Consumer<Integer> listener = null;
private IntConsumer listener = null;

private IOInventory(TileEntitySynchronized owner) {
this.owner = owner;
Expand All @@ -58,7 +58,7 @@ public static IOInventory deserialize(TileEntitySynchronized owner, NBTTagCompou
return inv;
}

public IOInventory setListener(Consumer<Integer> listener) {
public IOInventory setListener(IntConsumer listener) {
this.listener = listener;
return this;
}
Expand Down
Loading