mojira.dev
MC-111064

carried tag of enderman is not saved to NBT when value is 0

The bug

When you summon an enderman with carried:0s, it is treated as if the enderman is holding nothing, however if the enderman is holding nothing the carried tag is not written to the NBT data.
This is pretty inconsistent because if 0s is treated as holding nothing, you would expect it to be saved to NBT if the enderman is holding nothing as well.

From MC-94027:

In 1.8 versions is possible to test if a enderman don't carries a block

How to reproduce

  1. Summon an enderman holding nothing

    /summon enderman ~ ~ ~ {carried:0s}
  2. Try to test for carried:0s

    /testfor @e[type=enderman] {carried:0s}

    1.13:

    /execute as @e[type=enderman,nbt={carried:0s}] run say enderman with nothing

    → The command fails

Linked issues

Comments 7

Can confirm for MC 1.12.1.

Can confirm for 17w43b snapshot

Confirmed for 17w46a Snapshot, but now the commands to reproduce the bug are:

/summon enderman ~ ~ ~ {carried:0s}
/execute as @e[type=enderman,nbt={carried:0s}] run say enderman with nothing

carried has been removed in favor of carriedBlockState. When carriedBlockState is set to air, it is not saved to NBT.

Perfect, but that's still the same as it was before because ideally it should be saved as "minecraft:air"...
Anyway with the addition of selectors that read NBTs it's easier to find a solution for people who need it in their command systems.

This a simple solution to find a endermen holding nothing:

/execute as @e[type=enderman,nbt=!{carriedBlockState:{}}] run say enderman with nothing

For me is fixed this bug!

Saving pointless data is not worthwhile. Fortunately if you need to test for this with commands, the solution posted is perfect.

marcono1234

(Unassigned)

Confirmed

air, carried, enderman, nbt

Minecraft 1.11, Minecraft 1.11.2, Minecraft 17w06a, Minecraft 1.12.1, Minecraft 1.12.2, Minecraft 17w43b, Minecraft 17w46a

Retrieved