Fixed shift-clicking stacks from the result slot not putting them into the correct location and fixed shift-clicking not clearing the input grid

This commit is contained in:
Sollace 2022-09-11 19:26:19 +02:00
parent 8f7fa1ae7e
commit 17a989f2a0

View file

@ -185,6 +185,7 @@ public class SpellbookScreenHandler extends ScreenHandler {
@Override @Override
public ItemStack transferSlot(PlayerEntity player, int index) { public ItemStack transferSlot(PlayerEntity player, int index) {
System.out.println("Transfer slot: " + index);
Slot sourceSlot = slots.get(index); Slot sourceSlot = slots.get(index);
if (sourceSlot == null || !sourceSlot.hasStack()) { if (sourceSlot == null || !sourceSlot.hasStack()) {
@ -194,7 +195,11 @@ public class SpellbookScreenHandler extends ScreenHandler {
ItemStack transferredStack = sourceSlot.getStack(); ItemStack transferredStack = sourceSlot.getStack();
ItemStack stack = transferredStack.copy(); ItemStack stack = transferredStack.copy();
if (index >= HOTBAR_START) { if (sourceSlot instanceof ResultSlot result) {
result.onTakeItem(player, stack);
}
if (index >= HOTBAR_START && !(sourceSlot instanceof ResultSlot || sourceSlot instanceof InputSlot)) {
if (!gemSlot.hasStack() && gemSlot.canInsert(stack)) { if (!gemSlot.hasStack() && gemSlot.canInsert(stack)) {
if (insertItem(transferredStack, GEM_SLOT_INDEX, GEM_SLOT_INDEX + 1, false)) { if (insertItem(transferredStack, GEM_SLOT_INDEX, GEM_SLOT_INDEX + 1, false)) {
onContentChanged(input); onContentChanged(input);