mojira.dev
MC-269487

data merge command makes armor stand have a visible, but non-existent shield

In a .mcfunction file, I run the following two commands

summon armor_stand ~2.07 ~3.65 ~-0.7 {HandItems: [{}, {components: {banner_patterns: [{color: cyan, pattern: stripe_bottom}], base_color: white}, id: shield}], Invisible: true, NoGravity: true, Pose: {LeftArm: [0f, 90f, 90f]}, Rotation: [0f, 0f], ShowArms: true, Tags: [banner_shield_stand, banner_stand, banners]}
execute as @e[tag=banner_stand] run data merge entity @s {HandItems: [{}, {components: {banner_patterns: [{color: "cyan"}], base_color: "white"}}]}
summon armor_stand ~2.07 ~3.65 ~-0.7 {HandItems: [{}, {components: {banner_patterns: [{color: cyan, pattern: stripe_bottom}], base_color: white}, id: shield}], Invisible: true, NoGravity: true, Pose: {LeftArm: [0f, 90f, 90f]}, Rotation: [0f, 0f], ShowArms: true, Tags: [banner_shield_stand, banner_stand, banners]}
execute as @e[tag=banner_stand] run data merge entity @s {HandItems: [{}, {components: {banner_patterns: [{color: "cyan"}], base_color: "white"}}]}

An invisible armor stand holding a shield appears – you can see the shield hovering in the air (I doubt invisibility is critical here, but this is as far as I've simplified it.)

But if you look at the armor stand's HandItems

/data get entity @e[tag=banner_stand, limit=1] HandItems
/data get entity @e[tag=banner_stand, limit=1] HandItems

The result is [{}, {}]

Clearly this is not true, you can see the shield. But that's what the data command says.

Further, if you log out and log back, the armor stand will vanish.

I'm not sure what's wrong with the data merge command, but if it is not run, the stand is just fine.

Steps to reproduce

1) Run

/function p:foo
/function p:foo

when inside the attached world
2) Run

/data get entity @e[tag=banner_stand, limit=1] HandItems
/data get entity @e[tag=banner_stand, limit=1] HandItems

3) Observe that the return is empty

Expected results

The command would return data containing the fact the armor stand is holding a shield

Observed results

The command returns empty data

Attachments

Comments 4

Please attach the needed files to reproduce this issue.

I've created a datapack with the mcfunction file in it, created a world with that pack, and uploaded it. In that world, run

/function p:foo
/function p:foo

The data command is better as:

/data get entity @e[tag=banner_stand, limit=1] HandItems
Just so you don't have to play around with the UUID in the command.

[media]

This is also in 24w12a, and the bug still exists here.

We were unable to reproduce the 'visible, but non-existent' part here - did you have two of the original armor stands in the world?

/data merge is also working as expected here: the second command has created an invalid component that is missing the pattern type and item ID, as entries within lists do not get merged by this command.

kcrca

(Unassigned)

Confirmed

Platform

Important

Commands

24w11a, 24w12a, 24w13a

Retrieved