Mojira Archive
MC-87252

Optional tags gets removed when set to false/0/empty

The Bug

When the CustomNameVisible tag is set to false (0b) the game automatically removes the tag from the NBT data of the Entity. This also affects newly summoned Entities which do not have it by default if it is not true.
This is a big problem as you cannot test for it then.

Steps to Reproduce

  • Summon a husk with its "CustomNameVisible" tag set to "0b".
     /summon minecraft:husk ~ ~ ~ {CustomNameVisible:0b}
    
  • Use the data command on the husk to inspect the value of its "CustomNameVisible" tag.
    /data get entity @e[type=minecraft:husk,limit=1,sort=nearest] CustomNameVisible
    

    → Notice how the error message, "Found no elements matching CustomNameVisible" is displayed in the chat, therefore indicating that optional NBT data tags get removed when set to "0", "false", or "empty".

Expected Behavior

The expected behavior would be that optional NBT data tags would not get removed when set to "0", "false", or "empty".