Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-6975

Spawnegg serialization tries to convert item types to the one specified in the NBT data

XMLWordPrintable

    • 1.18.2-R0.1-SNAPSHOT (git-Paper-265)
    • Various plugins using item deserialization and serialization
    • Yes

      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)

            Unassigned Unassigned
            Kronox Kronox
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: