Skip to content

Commit

Permalink
fixed shift-clicking *anywhere* clearing the crafting grid
Browse files Browse the repository at this point in the history
closes #219
  • Loading branch information
Ellpeck committed Nov 30, 2024
1 parent c72d1cc commit 8894d1d
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,16 @@ protected int getSlotXOffset() {
@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);
Expand Down

0 comments on commit 8894d1d

Please sign in to comment.