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

Inconsistent saving of nbt tag "Damage 0" on tools between RAM and Disk

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • 19w35a
    • None
    • Unconfirmed
    • (Unassigned)

      Whenever the world is (re)loaded, a tool with 0 damage (full durability) will load in the Damage tag as Damage: 0. However, when the tool is spawned, (through commands, crafting, creative menu or otherwise..) The Damage: 0 is omitted.

      To visualise this, here is a comparison:

      New carrot on a stick:

       

       

      Same carrot on a stick after quitting to menu and reopening the world:

        

       

      Notice the ... tag: {Damage: 0} ...

       

      Clearly this is an inconsistency in the code, which makes writing mcfunctions more difficult. For example, testing if a tool has 0 damage is impossible. Testing for "Execute this function IF Damage NBT tag is absent" or "Execute this function IF Damage NBT tag is equal to 0" are 2 entirely different commands, with the same principal to figure out if the damage on a tool is 0. Except either will only work in each different case. The first will only work on newly spawned tools, but after a world reload, only the second method would work.

       

      Here are the commands in question:

      Only works when tool is initially spawned:

      /execute unless data entity @s SelectedItem.tag.Damage run say hi

      Only works when world is reloaded:
      /execute if data entity @s {SelectedItem:{tag: {Damage:0s} } } run say hi

       

      To reproduce:

      1. Spawn a tool in a fresh world and verify it's nbt. It should not contain any "tag: {Damage: 0}"
      2. Close and reopen the world
      3. Verify that the nbt has changed to include "tag: {Damage: 0}"

            Unassigned Unassigned
            m124367 AgentM
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: