Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-257688

Spawn eggs from versions prior to 1.13 have extraneous NBT

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • None
    • 22w46a
    • Confirmed
    • (Unassigned)

      Discovered while testing the fix for MC-257113.

      The bug

      If a spawn egg is obtained from the Creative inventory in 1.12.2 or earlier, upgrading the world to the latest version will result in that spawn egg having extra NBT. Specifically, the NBT which is present on the item is an EntityTag, which serves to store what entity the spawn egg should spawn when used, which is redundant since this is accomplished by the spawn egg item already.

      As a result of this, despite upgraded spawn eggs being otherwise functionally identical to spawn eggs obtained from the Creative inventory, they will not stack with each other. In addition, these upgraded spawn eggs will not show the Creative inventory tab from which they originate when moused over.

      Important note

      The presence of an EntityTag on the spawn egg is only redundant iff the entity in question has a spawn egg of its own. Other entities, such as projectiles, armor stands, item frames and many more, do not have their own spawn egg, and as such preservation of this EntityTag is essential for these spawn eggs to still work when upgraded.

      Currently, pre-1.13 spawn egg items which do not have a 1.13+ item form counterpart will become pig spawn eggs with an EntityTag of the original entity they used to contain. This behaviour should be kept in the game as to maintain backwards compatibility as much as possible (although, instead of a pig spawn egg, it'd be nice if a "generic spawn egg" was added which these could upgrade to instead, which would also come with NBT-customizable colors like potions do - but that's a feature request).

      How to reproduce

      A 1.12.2 world file is attached to this ticket. Download and extract this world into your Minecraft directory accordingly and load it in the latest version.

      To confirm that the eggs have unnecessary NBT and that they are functionally identical to spawn eggs without this NBT:

      1. Load the attached world in the latest development build
      2. Make sure Advanced Tooltips are enabled (F3+H)
      3. Obtain a slime spawn egg from the Creative inventory's spawn eggs tab
      4. Open the chest and take out the slime spawn egg within
      5. Attempt to stack these two spawn eggs together using however many tried-and-tested methods you're willing to
      6. Use these spawn eggs to create slimes or slime spawner blocks to confirm they work exactly the same

      If the upgraded slime spawn egg is the only item in your inventory, the command /data get entity @s will reveal the EntityTag on the item.

      Expected results

      The slime spawn egg from the chest would not have extra NBT and therefore would stack with slime spawn eggs from the Creative inventory as well as inform the player of the tab they're in when moused over.

      Actual results

      The slime spawn egg from the chest inherits an unuseful EntityTag.

      How to fix

      As mentioned before, NBT on spawn eggs from pre-1.13 worlds should only be discarded if the following two conditions are met:

      1. The NBT present on the spawn egg solely dictates what mob the spawn egg spawns, and does not contain any more specific information whose deletion would result in a spawn egg which creates a mob with different attributes from a normal spawn egg, such as equipped armor or slime size.
      2. The entity which the spawn egg creates also has its own spawn egg in the latest version with its own item ID.

        1. 2022-11-17_20.43.10.png
          2022-11-17_20.43.10.png
          87 kB
        2. 2022-11-17_20.43.11.png
          2022-11-17_20.43.11.png
          88 kB
        3. 2022-11-17_20.43.19.png
          2022-11-17_20.43.19.png
          108 kB
        4. 2022-11-17_20.43.31.png
          2022-11-17_20.43.31.png
          107 kB
        5. NBT Upgrade Demo.zip
          292 kB

            Unassigned Unassigned
            Awesoman3000 Connor Steppie
            Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: