How do I test if a player has an item with a custom name in inventory WITHOUT scoreboards?
-
I'm trying to test if a player has an item named "sunny", and if they do to have it turn into a shulker box.
If you could include the shulker box having a torch named "sunny" that would be very much appreciated too.The command I tried was this:
execute if entity @p[nbt={Items:[{id:"!minecraft:torch"}]},display:{Name:'{"text":"Sunny"}'}] run setblock ~ ~2 ~ minecraft:blue_shulker_box
But it said display option was not an option.
-
/execute if entity @p[nbt={Inventory:[{id:"minecraft:torch",Count:1b,tag:{display:{Name:'{"text":"Sunny"}'}}}]}] run setblock ~ ~2 ~ minecraft:blue_shulker_box
I tested this in-game and it works fine.