-
Bug
-
Resolution: Unresolved
-
None
-
1.21.1, 24w34a
-
Community Consensus
-
Commands
-
Normal
-
1299755
-
Expansion B
When a /item command modifies an item in the player's inventory that has just been replaced with a use_remainder component, it will not visually update unless removed and replaced or otherwise forcibly updated,
Test case setup (a bit contrived, a simpler case can probably be constructed):
set the following data pack item modifier in a data pack using the "test" namespace as "spell_test.json":
[ { "function": "minecraft:set_components", "components": { "minecraft:consumable":{ "consume_seconds":0.7, "animation":"bow", "sound":"item.book.page_turn", "has_consume_particles":false, "on_consume_effects":[ {"type":"minecraft:apply_effects","effects":[ {"id":"minecraft:nausea","duration":10} ]}, {"type":"minecraft:play_sound","sound":"item.firecharge.use"} ] }, "minecraft:use_remainder": { "id":"minecraft:flow_banner_pattern", "components":{ "minecraft:custom_data":"{spell:1s}" } }, "minecraft:item_name": "{\"type\": \"text\",\"text\": \"Spell Test\"}", "minecraft:custom_data": "{spell:1s}" } } ]
set the following predicate under the same namespace as "reset_spell_test.json":
{ "condition": "minecraft:entity_properties", "entity": "this", "predicate": { "slots": { "weapon.mainhand": { "items": "minecraft:flow_banner_pattern", "components": { "minecraft:custom_data": "{spell:1s}" } } } } }
put the following in a repeating command block:
execute as @a[predicate=test:reset_spell_test] run item modify entity @s weapon.mainhand test:spell_test
(the above can all be bypassed by downloading the attached data pack)
then give yourself a flow banner pattern and run the following command:
/item modify entity @s weapon.mainhand test:spell_test
then switch to survival mode and use the item.
Expected result: Item resets itself to the same state (with the custom name "Spell Test", and usable with right click) after being consumed.
Actual result: Item returns to a default state after being consumed, and is generally not usable until the player removes it from their inventory and returns it in some way (picking it up inside the inventory is sufficient to update it). It's possible to confirm the item does have the correct data already using the "/data get" command, but the client demonstrably doesn't act like it does.
Unsure if the desync here is due to using a predicate, or because it runs on an item that has just been created with a use remainder, but either way it's a big problem for certain data pack use cases.