Properly forward DispenseEvent #getItem to saddle

Correctly use the DispenseEvent's #getItem ItemStack when placing the
saddle on entities during a dispense behaviour instead of the original
stack.
Dieser Commit ist enthalten in:
Bjarne Koll 2024-06-16 00:01:55 +02:00
Ursprung 7df472527f
Commit 3555a7776e
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 27F6CCCF55D2EE62

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..9d71388c6e8ff56228afbf8cb18c37f861d0b246 100644
index f96734580a29e0436ac808e41c6cbc3f35eff5f5..7bf250bba4179a506c0a39b7866a9389552d2905 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 {
@ -36,6 +36,15 @@ index f96734580a29e0436ac808e41c6cbc3f35eff5f5..9d71388c6e8ff56228afbf8cb18c37f8
ArmorStand entityarmorstand = (ArmorStand) EntityType.ARMOR_STAND.spawn(worldserver, consumer, blockposition, MobSpawnType.DISPENSER, false, false);
if (entityarmorstand != null) {
@@ -244,7 +249,7 @@ public interface DispenseItemBehavior {
return stack;
}
}
- ((Saddleable) list.get(0)).equipSaddle(itemstack1, SoundSource.BLOCKS);
+ ((Saddleable) list.get(0)).equipSaddle(CraftItemStack.asNMSCopy(event.getItem()), SoundSource.BLOCKS); // Paper - track changed items in dispense event
// CraftBukkit end
if (shrink) stack.shrink(1); // Paper - actually handle here
this.setSuccess(true);
@@ -414,6 +419,7 @@ public interface DispenseItemBehavior {
int y = blockposition.getY();
int z = blockposition.getZ();