Skip to content

Commit 5841779

Browse files
authored
check that the inventory is InventoryCraftResult (#274)
1 parent 2341ccc commit 5841779

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/com/cleanroommc/groovyscript/event/EventHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ public static void onItemCrafted(PlayerEvent.ItemCraftedEvent event) {
127127
Container container = ((InventoryCraftingAccess) inventoryCrafting).getEventHandler();
128128
if (container != null) {
129129
for (Slot slot : container.inventorySlots) {
130-
if (slot instanceof SlotCrafting) {
131-
craftResult = (InventoryCraftResult) slot.inventory;
130+
if (slot instanceof SlotCrafting && slot.inventory instanceof InventoryCraftResult result) {
131+
craftResult = result;
132132
player = ((SlotCraftingAccess) slot).getPlayer();
133133
break;
134134
}

0 commit comments

Comments
 (0)