From fa515f0941085419112580f49d3d1f1d528e6a3b Mon Sep 17 00:00:00 2001 From: mezz Date: Wed, 2 May 2018 21:57:28 -0700 Subject: [PATCH] Fix #2114 Limit crafting operations to 64 crafts per shift-click --- src/main/java/forestry/core/gui/ContainerForestry.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/forestry/core/gui/ContainerForestry.java b/src/main/java/forestry/core/gui/ContainerForestry.java index edcb79754..207692099 100644 --- a/src/main/java/forestry/core/gui/ContainerForestry.java +++ b/src/main/java/forestry/core/gui/ContainerForestry.java @@ -37,6 +37,7 @@ import invtweaks.api.container.ContainerSectionCallback; public abstract class ContainerForestry extends Container { public static final int PLAYER_HOTBAR_OFFSET = 27; public static final int PLAYER_INV_SLOTS = PLAYER_HOTBAR_OFFSET + 9; + private int transferCount = 0; // number of items that have been shift-click-transfered during this click protected final void addPlayerInventory(InventoryPlayer playerInventory, int xInv, int yInv) { // Player inventory @@ -87,6 +88,7 @@ public abstract class ContainerForestry extends Container { } } + transferCount = 0; return super.slotClick(slotId, dragType_or_button, clickTypeIn, player); } @@ -101,7 +103,12 @@ public abstract class ContainerForestry extends Container { return ItemStack.EMPTY; } - return SlotUtil.transferStackInSlot(inventorySlots, player, slotIndex); + if (transferCount < 64) + { + transferCount++; + return SlotUtil.transferStackInSlot(inventorySlots, player, slotIndex); + } + return ItemStack.EMPTY; } protected abstract boolean canAccess(EntityPlayer player);