Fix StackOverflowError for new dispenser interaction (#10949)

This commit is contained in:
Lulu13022002 2024-06-23 22:24:17 +02:00
parent 079105010e
commit 189504bc7f

View file

@ -71,6 +71,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
return stack;
@@ -0,0 +0,0 @@ public interface DispenseItemBehavior {
// Chain to handler for new item
ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem());
- if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != ArmorItem.DISPENSE_ITEM_BEHAVIOR) {
+ if (idispensebehavior != DispenseItemBehavior.NOOP && idispensebehavior != this) { // Paper - fix possible StackOverflowError
idispensebehavior.dispense(pointer, eventStack);
return stack;
}
diff --git a/src/main/java/net/minecraft/world/item/ArmorItem.java b/src/main/java/net/minecraft/world/item/ArmorItem.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/item/ArmorItem.java