1

Command help

Duckwizard_76 6/23/20 6:56 pm history
152
6/24/2020 6:55 pm
I can't figure out why this command won't work can anyone help I'm on Java 1.16. I have tried both these commands and Other than other minor tweaks I have no idea what to do. I want it to run a command when a blaze rod named "BlockKey" is in the players inventory in any slot and the player has slot 0 selected with no item in it. (or any random item as long as it works without anything.)


execute as @a if entity @a[​nbt={Inventory:{Item:{id:"blaze_rod",tag:{Name:"BlockKey"}}}SelectedItemSlot:0}] run summon minecraft:bat ~ ~ ~

execute as @a if entity @a[​nbt={Inventory:{Item:{id:"blaze_rod",tag:{Name:"\"BlockKey\""}}}SelectedItemSlot:0}] run summon minecraft:bat ~ ~ ~
Posted by
Duckwizard_76
Level 1 : New Miner
0

  Have something to say?

JoinSign in

2

CowsDaBest_YT
06/24/2020 4:05 am
Level 50 : Grandmaster Explorer
execute as @a[​nbt={SelectedItemSlot:0,Inventory:[{id:"minecraft:blaze_rod",tag:{display:{Name:'{"text":"BlockKey"}'}}}]}] run say wow!
1
Duckwizard_76
06/24/2020 6:55 pm
Level 1 : New Miner
Thanks! I got it to work after I used your command and realised I couldn't use the blaze_rod given by the command :

/give @p minecraft:blaze_rod{display:{Name:"\"BlockKey\""}}

I assume this has to do with the wrong syntax of the name
1

Welcome