mojira.dev
MC-152315

Execute store on player only works if the item already has tags

Items that do not have tag:{} can not have data stored on them with execute store, the following command should store test:1b on the first item on my hotbar.

/execute as @p store success entity @s Inventory[{Slot:0b}].tag.test byte 1 run gamerule randomTickSpeed

I checked this with the following command and got the output below.

/data get entity @p Inventory[{Slot:0b}]

#output: {Slot: 0b, id: "minecraft:redstone", Count: 64b}

However if put an item in that slot that has tag:{}

/replaceitem entity @p hotbar.0 minecraft:redstone{} 5
#item data: {Slot: 0b, id: "minecraft:redstone", Count: 5b, tag: {}}

Then run the same command 

/execute as @p store success entity @s Inventory[{Slot:0b}].tag.test byte 1 run gamerule randomTickSpeed
#item data: {Slot: 0b, id: "minecraft:redstone", Count: 5b, tag: {test: 1b}}

 

This was discovered while attempting to clear an item from the player only if the item has no data, the command below for example matches items with tag:{}

/clear @p minecraft:redstone{} 0

Linked issues

Comments

No comments.

Alpha

(Unassigned)

Unconfirmed

Minecraft 1.14.1

Retrieved