diff --git a/src/main/java/com/cleanroommc/groovyscript/event/EventHandler.java b/src/main/java/com/cleanroommc/groovyscript/event/EventHandler.java index 39130c913..99f81c5b4 100644 --- a/src/main/java/com/cleanroommc/groovyscript/event/EventHandler.java +++ b/src/main/java/com/cleanroommc/groovyscript/event/EventHandler.java @@ -127,8 +127,8 @@ public static void onItemCrafted(PlayerEvent.ItemCraftedEvent event) { Container container = ((InventoryCraftingAccess) inventoryCrafting).getEventHandler(); if (container != null) { for (Slot slot : container.inventorySlots) { - if (slot instanceof SlotCrafting) { - craftResult = (InventoryCraftResult) slot.inventory; + if (slot instanceof SlotCrafting && slot.inventory instanceof InventoryCraftResult result) { + craftResult = result; player = ((SlotCraftingAccess) slot).getPlayer(); break; }