mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-21 00:17:56 +01:00
Fix StackOverflowError for new dispenser interaction (#10949)
This commit is contained in:
parent
b2e5587a2e
commit
97afc9a00c
@ -14,7 +14,7 @@ Additionally equippable mob heads, wither skulls, and carved pumpkins
|
|||||||
are subject to the same possible error.
|
are subject to the same possible error.
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||||
index 7826e2a52da47914aca39fef958b8f398a2ff937..f96734580a29e0436ac808e41c6cbc3f35eff5f5 100644
|
index 7826e2a52da47914aca39fef958b8f398a2ff937..0c0b8a49b3342cd015381c6a93fab23c32cd32e6 100644
|
||||||
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||||
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||||
@@ -239,7 +239,7 @@ public interface DispenseItemBehavior {
|
@@ -239,7 +239,7 @@ public interface DispenseItemBehavior {
|
||||||
@ -71,6 +71,15 @@ index 7826e2a52da47914aca39fef958b8f398a2ff937..f96734580a29e0436ac808e41c6cbc3f
|
|||||||
}
|
}
|
||||||
|
|
||||||
return stack;
|
return stack;
|
||||||
|
@@ -918,7 +918,7 @@ 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
|
diff --git a/src/main/java/net/minecraft/world/item/ArmorItem.java b/src/main/java/net/minecraft/world/item/ArmorItem.java
|
||||||
index fb518f87cc4ccd810fb32cade2fdd7e09ab0abfc..647a4601deace52f8d855f512a73671f82b4762a 100644
|
index fb518f87cc4ccd810fb32cade2fdd7e09ab0abfc..647a4601deace52f8d855f512a73671f82b4762a 100644
|
||||||
--- a/src/main/java/net/minecraft/world/item/ArmorItem.java
|
--- a/src/main/java/net/minecraft/world/item/ArmorItem.java
|
||||||
|
@ -5,7 +5,7 @@ Subject: [PATCH] Properly track the changed item from dispense events
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||||
index f96734580a29e0436ac808e41c6cbc3f35eff5f5..7bf250bba4179a506c0a39b7866a9389552d2905 100644
|
index 0c0b8a49b3342cd015381c6a93fab23c32cd32e6..60d3319016beb4f60cbc26dde165f64cf7577602 100644
|
||||||
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||||
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
||||||
@@ -134,10 +134,14 @@ public interface DispenseItemBehavior {
|
@@ -134,10 +134,14 @@ public interface DispenseItemBehavior {
|
||||||
|
Loading…
Reference in New Issue
Block a user