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".
Linked issues
is duplicated by 1
relates to 1
Attachments
Comments 12
happens with all optional tags, IsBaby, IsVillager, VillagerProfession and NoAI are also effected.
in my opinion these should exist if you specify them in the summon/entitydata, regardless of value
Tested it further, /summon minecraft:zombie ~ ~ ~ {IsBaby:0} actually does guarantee that it won't be a baby (while normally there's a small chance that it will be), which is further evidence that this is a bug.
@@unknown no this is no evidence for that. If you just provide an empty compound it would already prevent the randomization.
Related to MC-80975.
I am able to confirm this behavior in both 1.17.1 and 21w38a. Here are some extra details regarding this problem.
The Bug:
Optional NBT data tags get removed when set to "0", "false", or "empty".
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".
Confirmed.