From 92a9fb31beecad244701553454073b1cdc98ae95 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Tue, 11 Jun 2024 06:59:14 +1000 Subject: [PATCH] Fix spawn egg equality check and copy constructor By: md_5 --- .../bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java index a8ca531c2f..3222591759 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java @@ -111,6 +111,12 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta { CraftMetaSpawnEgg(CraftMetaItem meta) { super(meta); + + if (!(meta instanceof CraftMetaSpawnEgg egg)) { + return; + } + + this.entityTag = egg.entityTag; } CraftMetaSpawnEgg(DataComponentPatch tag) { @@ -167,7 +173,7 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta { } boolean isSpawnEggEmpty() { - return entityTag != null; + return !(entityTag != null); } @Override