-
Bug
-
Resolution: Unresolved
-
None
-
1.21.2 Pre-Release 3, 1.21.3
-
None
-
Confirmed
-
Creative
-
Advancements, Commands
-
Low
-
Platform
Description:
In the following situation:
- A "/item" command (that modifies slot X) is contained within a reward function of an "inventory_changed" criteria advancement.
- Slot X is changed on a player that has their inventory open and is in creative mode, triggering said advancement.
The original item change on slot X that triggered the advancement overrides the modification made by the "/item" command (even though, logically, the "/item" command happens after, and should affect the final item).
Furthermore, if the reward function of said advancement contains a command to revoke the same advancement and the same situation occurs:
For as long as the player stays in creative and keeps their inventory open: The item generated by the "/item" command and the item from the inventory original change will "fight" repeatedly in slot X. Once the player exits creative mode or their inventory, the item generated by the "/item" command will finally occupy slot X.
To Reproduce:
- Create a world with the attached datapack.
- Attempt to put any item from the creative inventory in the first hotbar slot.
- Observe that the slot rapidly switches between a slimeball and the item placed in the slot until you exit your inventory.
The attached datapack contains the advancement 'example:inv_change' which triggers on inventory change, and has the following reward function:
execute unless items entity @s hotbar.0 slime_ball run item replace entity @s hotbar.0 with slime_ball[item_name='{"text":"example"}']
advancement revoke @s only example:inv_change
A video is attached demonstrating the bug behavior.
Note:
If the "/item" command is replaced with "/clear", the item in the first hotbar slot is simply cleared as what is logically expected.