mojira.dev
MC-123213

Armor stand's nbt: Head Pose is ignored when its Head Pose data is [0.0f,0.0f,0.0f]

When creating an armor stand:
1./summon armor_stand ~ ~ ~ {Pose:{Head:[30.0f,0.0f,0.0f]}}
And teleport its rotation:
2./teleport @e[type=armor_stand] ~ ~ ~ 60 0

it would summon an armor stand with Pose nbt.
But if type this command:
3./data merge entity @e[type=armor_stand,limit=1,sort=nearest] {Pose:{Head:[0.0f,0.0f,0.0f]}}

Althought the armor stand would change its head rotation display to 0 0 0, we cannot type this command to change its head display to as the same as its rotation(the second command change its rotation) because the Pose nbt is gone:
4./execute as @e[type=armor_stand] store result entity @s Pose.Head[0] float 0.1 run data get entity @s Rotation[1] 10

The reason why it type Head[0] and Rotation[1] is due to the bug https://bugs.mojang.com/browse/MC-122057

Linked issues

Comments 2

Confirmed, each of the Head, Body, LeftArm, RightArm, LeftLeg, RightLeg tag in Pose are not saved to nbt when they have their default position (It's not necesseraly [0,0,0] for arm and legs).
It looks intentionnal to not save extra data when there is no need to, but we didn't have /data get back then.

To avoid that issue, you can use a value very close to the default one, like this :

{Pose:{Head:[0.0f,0.0f,1e-9f]}}

This is actually bad though, and not resolved. For example, if you constantly add 1 to the armor_stand's Head[0] rotation, you'll have to make sure to always offset it by a very small amount. This means constantly scaling up and down again using execute store.
The broken part about this is that you cannot set a single value of the Pose arrays without ensuring all values in the array are set first, the execute store no longer works if the data is deleted because all values are equal to 0.0f.
Try repeating these 2 commands (create dummy scoreboard called rotation, and set it to -10 first):

scoreboard players add @e[type=minecraft:armor_stand,sort=nearest,limit=1] rotation 1
execute as @e[type=minecraft:armor_stand,sort=nearest,limit=1] store result entity @s Pose.Head[0] float 0.1 run scoreboard players get @s rotation
This will work until rotation = 0, where it will stop because the entire Pose array is now deleted, because all values equal 0.0f.

jellywayne

(Unassigned)

Confirmed

Minecraft 17w50a

Retrieved