fixed shift-clicking *anywhere* clearing the crafting grid

closes #219
This commit is contained in:
Ell 2024-11-30 18:36:43 +01:00
parent c72d1cc09c
commit 8894d1d8c4

View file

@ -65,15 +65,16 @@ public class CraftingTerminalContainer extends ItemTerminalContainer {
@Override
public void clicked(int slotId, int dragType, ClickType clickTypeIn, Player player) {
if (slotId > 0) {
var slot = this.slots.get(slotId);
var ghostItems = this.getTile().ghostItems;
if (clickTypeIn == ClickType.PICKUP) {
var slot = this.slots.get(slotId);
if (slot.container == this.craftInventory && !slot.hasItem())
if (slot.container == this.craftInventory && !slot.hasItem()) {
if (clickTypeIn == ClickType.PICKUP) {
ghostItems.setStackInSlot(slot.getSlotIndex(), ItemStack.EMPTY);
} else if (clickTypeIn == ClickType.QUICK_MOVE) {
// clear the entire grid when holding shift
for (var i = 0; i < ghostItems.getSlots(); i++)
ghostItems.setStackInSlot(i, ItemStack.EMPTY);
} else if (clickTypeIn == ClickType.QUICK_MOVE) {
// clear the entire grid when holding shift
for (var i = 0; i < ghostItems.getSlots(); i++)
ghostItems.setStackInSlot(i, ItemStack.EMPTY);
}
}
}
super.clicked(slotId, dragType, clickTypeIn, player);