[SPIGOT-6975] Spawnegg serialization tries to convert item types to the one specified in the NBT data Created: 20/Mar/22  Updated: 25/Dec/24  Resolved: 02/Apr/22

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Kronox Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: Craftbukkit, ItemStack, SpawnEgg, bug, serialization

Issue Links:
Duplicate
duplicates SPIGOT-5485 Support for spawn eggs with different... Resolved
Relates
relates to SPIGOT-5485 Support for spawn eggs with different... Resolved
Version: 1.18.2-R0.1-SNAPSHOT (git-Paper-265)
Plugin: Various plugins using item deserialization and serialization
Guidelines Read: Yes

 Description   

As soon as the ID of the entity to be spawned is specified in the NBT entity data of a spawnegg while the ItemStack is serialized, an attempt is made to transform the associated item type into the respective matching spawnegg.

However, having an entity id that is different from the item type is a feature supported by Minecraft to allow spawneggs with a certain appearance to spawn another entity.

{ id: "minecraft:sheep_spawn_egg", tag: { EntityTag: { id:"minecraft:cow" } }

creates an spawnegg that looks like a sheep which in fact will spawn a cow. CraftBukkit serialization turns it into 

{ id: "minecraft:cow_spawn_egg" }

which shouldn't happen.

The behavior becomes even more inconsistent with e.g. bees and foxes. If these are specified in the id field of the entity data, the spawnegg will default to a turtle spawnegg.

Example give-command for an itemstack to reproduce the issue:

/give @p sheep_spawn_egg{EntityTag:{id:"minecraft:cow"}} 1

Example plugin affected by the issue: Shopkeepers by blablubbabc

(Spent about 2h debugging and investigating the issue)



 Comments   
Comment by blablubbabc [ 22/Mar/22 ]

https://hub.spigotmc.org/jira/browse/SPIGOT-5485

Generated at Fri Mar 14 17:31:33 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.