From 1d99f8beb8b632785e7c5f7b2d6740cab1612d69 Mon Sep 17 00:00:00 2001 From: AJ Ferguson Date: Fri, 9 Jun 2023 21:23:10 -0400 Subject: [PATCH] Fix shift clicking Stonecutter output (#3854) --- .../inventory/StonecutterInventoryTranslator.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/org/geysermc/geyser/translator/inventory/StonecutterInventoryTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/inventory/StonecutterInventoryTranslator.java index 8380be63a..0663866ed 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/inventory/StonecutterInventoryTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/inventory/StonecutterInventoryTranslator.java @@ -62,19 +62,20 @@ public class StonecutterInventoryTranslator extends AbstractBlockInventoryTransl } StonecutterContainer container = (StonecutterContainer) inventory; + ItemStack javaOutput = craftingData.output(); int button = craftingData.buttonId(); + // If we've already pressed the button with this item, no need to press it again! if (container.getStonecutterButton() != button) { - ItemStack javaOutput = craftingData.output(); - // Getting the index of the item in the Java stonecutter list ServerboundContainerButtonClickPacket packet = new ServerboundContainerButtonClickPacket(inventory.getJavaId(), button); session.sendDownstreamPacket(packet); container.setStonecutterButton(button); - if (inventory.getItem(1).getJavaId() != javaOutput.getId()) { - // We don't know there is an output here, so we tell ourselves that there is - inventory.setItem(1, GeyserItemStack.from(javaOutput), session); - } + } + + if (inventory.getItem(1).getJavaId() != javaOutput.getId()) { + // We don't know there is an output here, so we tell ourselves that there is + inventory.setItem(1, GeyserItemStack.from(javaOutput), session); } return translateRequest(session, inventory, request);