mojira.dev
MC-248752

Using /loot in functions creates invisible items until used manually ingame

Using a function file I tried to call "loot give @s loot <loot table> which gave me an invisible item that took up a slot in my inventory. I tried executing the same function file over and over with no results. My inventory updated once I called the loot table myself ingame and gave me every item that I had called each time.

Strangely it doesn't update if my inventory changes in any other way (eg, calling a different loot table, even manually), and the space in my inventory will still be taken up

This may be related to MC-197349

Linked issues

Attachments

Comments 3

user-f2760

Please attach the data pack you used, so this can be investigated.

DylanTheSpud

Attached the data pack used. Use the command "/loot give @s loot potatopack:tarnished_banner" and attempt to place it on Peaceful difficulty in Survival.

The result should be that the banner is added back to your inventory through the function "potatopack:block/tarnished_banner/place/fail/start", but instead an invisible item takes up a slot. You can see that this happens if you pick up some other items or run other loot commands, and when you run the "/loot give @s loot potatopack:tarnished_banner" command manually again, the slot is updated

j_p_smith

The issue here is that your advancement potatopack:technical/block/tarnished_banner/place detects when a Survival player places an armour stand, and then gives them an identical armour stand in the same tick. It is a known issue (MC-239935) that this creates a ghost item. As a workaround, you could include some kind of unique identifier somewhere in the NBT of each "tarnished banner" item.

DylanTheSpud

(Unassigned)

Unconfirmed

(Unassigned)

1.18.1

Retrieved