3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-14 18:40:10 +01:00

Fix StackOverflowError for new dispenser interaction (#10949)

Dieser Commit ist enthalten in:
Lulu13022002 2024-06-23 22:24:17 +02:00 committet von GitHub
Ursprung b2e5587a2e
Commit 97afc9a00c
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194
2 geänderte Dateien mit 11 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -14,7 +14,7 @@ Additionally equippable mob heads, wither skulls, and carved pumpkins
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
index 7826e2a52da47914aca39fef958b8f398a2ff937..f96734580a29e0436ac808e41c6cbc3f35eff5f5 100644
index 7826e2a52da47914aca39fef958b8f398a2ff937..0c0b8a49b3342cd015381c6a93fab23c32cd32e6 100644
--- a/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 {
@ -71,6 +71,15 @@ index 7826e2a52da47914aca39fef958b8f398a2ff937..f96734580a29e0436ac808e41c6cbc3f
}
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
index fb518f87cc4ccd810fb32cade2fdd7e09ab0abfc..647a4601deace52f8d855f512a73671f82b4762a 100644
--- a/src/main/java/net/minecraft/world/item/ArmorItem.java

Datei anzeigen

@ -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
index f96734580a29e0436ac808e41c6cbc3f35eff5f5..7bf250bba4179a506c0a39b7866a9389552d2905 100644
index 0c0b8a49b3342cd015381c6a93fab23c32cd32e6..60d3319016beb4f60cbc26dde165f64cf7577602 100644
--- a/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 {