Fixed the stimulator accepting stacks with a size higher than 1 (#32)

This commit is contained in:
Maxim authored and GitHub committed 2023-06-16 16:24:18 +02:00
1 parent ddf93bc425
commit f658e9ec57
2 files changed
+17 -3

No files matched your search

@@ -149,9 +149,17 @@ public class TransferRequest {
if (destination.getStackInSlot(slot) == null) {
insertedSlots.add(new TransferSlot(slot, destination));
if (doAdd) {
destination.setInventorySlotContents(slot, item.copy());
ItemStack movedStack = item.copy();
if (movedStack.stackSize > destination.getInventoryStackLimit()) {
movedStack.stackSize = destination.getInventoryStackLimit();
}
item.stackSize -= movedStack.stackSize;
destination.setInventorySlotContents(slot, movedStack);
if (item.stackSize <= 0) {
item = null;
}
}
return null;
return item;
}
}
}
@@ -18,7 +18,13 @@ public class StimulatorAlvearyPackage extends AlvearyMachine.AlvearyPackage impl
@Override
public void createMachine(Machine machine) {
new ComponentExtraBeeGUI(machine, ExtraBeeGUID.AlvearyStimulator);
ComponentInventorySlots inventory = new ComponentInventorySlots(machine);
ComponentInventorySlots inventory = new ComponentInventorySlots(machine) {
@Override
public int getInventoryStackLimit() {
return 1;
}
};
inventory.addSlot(AlvearyStimulator.SLOT_CIRCUIT, "circuit");
inventory.getSlot(AlvearyStimulator.SLOT_CIRCUIT).setValidator(new CircuitSlotValidator());
new ComponentPowerReceptor(machine);