Mojira Archive
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.

 

 

Duplicate

Elemend

2020-12-27, 04:52 PM

2020-12-29, 02:45 AM

2020-12-29, 02:45 AM

1

1

Confirmed

(Unassigned)

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

20w51a

-