mojira.dev
MC-299992

Unexpected behavior when giving or testing for an item with certain components manually specified as their default values

By data generator, we can get items.json. It tells us the blue egg has default component chicken/variant with default value “minecraft:cold”. But command execute don’t think blue egg has this default value.

How to Reproduce

Hold a blue egg on mainhand, then run these command:

/execute if items entity @s weapon.mainhand *[chicken/variant]
/execute if items entity @s weapon.mainhand *[chicken/variant="minecraft:cold"]

Expected Result

Both two command should be succeed.

Observed Result

You will see the first command run succeed and the second failed. Command execute doesn't think blue egg has default value “minecraft:cold” of chicken/variant component.

Note

jukebox_playable, provides_trim_material and instrument component also have this behavior.

Attachments

Comments 2

Can confirm. Relatedly, /give @s bread[food={nutrition:5,saturation:6f}] gives bread with no component data, but /give @s minecraft:blue_egg[minecraft:chicken/variant="minecraft:cold"] gives a blue egg with the component in its NBT.

wplxfore

(Unassigned)

Confirmed

(Unassigned)

1.21.8

Retrieved