In creative, the debug stick can change the state of a fence block so that north, south, east, and west values are all set to false. This will prevent the fence block from connecting to adjacent blocks. I would like to allow players in my survival Realm to do something similar without needing to enter creative mode.

Because the debug stick cannot be used in survival, I am trying to set up two command blocks and a carrot on a stick to achieve similar functionality. When right clicked, the carrot on a stick would locate the nearest fence block and adjust the state accordingly.

First I run this command (not in a command block):

/scoreboard objectives add clicked minecraft.used:minecraft.carrot_on_a_stick

Next I set up a repeating command block. This is the code I am struggling with:

/execute at @a[scores={clicked=1..},nbt={SelectedItem:{id:"minecraft:carrot_on_a_stick",tag:{display:{Name:"\"Block State Wand\""}}}}] run setblock  @e[type=fence,limit=1,sort=nearest] north false, south false, east false, west false

Then I have a second chained command block like such:

/scoreboard players reset @a[scores={clicked=1..}] clicked

I am new to command blocks and do not fully understand the correct syntax. Can someone help me figure out the code for the first command block?

  • This is a bad idea. You need to re-implement Minecraft's way of detecting which block someone is looking at and then also re-implement the entire functionality fo the debug stick, which requires getting and setting commands for every singly combination of block states of every single block in the game, because you can't change a single block state with a command. Sadly I also don't know any good alternatives. Things like "put them into Creative mode when holding a debug stick" would just give them access to all the Creative mode features and trying to prevent that is another rabbit hole. Jan 5, 2020 at 14:26

1 Answer 1


I recently had this exact same problem while doing something similar. Funny thing, you can't actually detect an objective score. You first need to apply the objective score to the player like this:

/scoreboard objectives add clicked minecraft.used:minecraft.carrot_on_a_stick
/scoreboard player set @p clicked 0

I was confused the first time too. The only thing missing was that second command. After that, everything should work fine.

  • What do you mean? You can definitely detect scores, no need to set it to 0. Also, this doesn't answer the question at all. Jan 7, 2020 at 22:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .