mojira.dev
MC-209714

Advancement reward function creates ghost item

I wanted to use the /item command to switch the item in the offhand to the players mainhand. I wanted to use an advancement reward with an inventory_changed trigger and thought at first that the /item command itself doesn't work. As it turns out, the commands will work (if there are no syntax errors, heh), it's just that the item it's supposed to switch is still deleted.

  • To reproduce the Isse, I have an advancement called "offhand" which will trigger when there is either a carrot, a stick, a stone or a carrot on a stick in the players offhand and no item in the mainhand. So essentially, get an item in the mainhand and press the button to switch it to your offhand. The function is called: "switch_items". I attached a data pack with the function and the advancement file. 

item entity @s weapon.mainhand copy entity @s weapon.offhand
item entity @s weapon.offhand replace minecraft:air 1
advancement revoke @s only item:offhand

 

As soon as any of those 4 items are in the offhand they disappear when you're in creative. When you're in survival, the item becomes a ghost item. you can recover it by clicking on free slots in your inventory.

 

 

Linked issues

Attachments

Comments 1

Oh, I made a mistake. The 1 at the end of the command is read as an item modifier. This makes this command fail, of course. If the 1 is removed it works as it should. So nevermind, this issue isn't one and can be closed.

 

There is an Issue still here, however. I mentioned the commands being executed as an advancement reward. This changes things. There is a bug here, need to rewrite that report

and this is in some way a duplicate of MC-187281
This Issue can be closed, thank you.

 

Elemend

(Unassigned)

Confirmed

(Unassigned)

command, data-loss, data-pack, datapack, ghost-item, item, survival

20w51a

Retrieved