enter image description here

Hello, I'm trying to set a clock but been having difficulties with the arrangement of the blocks and deciding which if the blocks are condition or unconditional setting. I am testing for a button being pressed thus activating following fill commands.

Commands in order:

/testforblock X Y Z minecraft:stone_button 
/fill X1 Y1 Z1 X2 Y2 Z2 minecraft:air
/fill X1 Y1 Z1 X2 Y2 Z2 minecraft:stone

In the repeating block there is no command and is working as a clock

enter image description here

In 1.8.9. I could set a clock connecting to a command block /testforblock -89 57 678 minecraft:stone_button 5 which means it's active/true. The comparator does not repeat the signal but still active the command block /say hey. Once the button is pressed the /testforblock block is inactive but is then active again because it is testing for the button that isn't pressed. I am trying to do this into 1.9.

  • I have issues with the green blocks so i usually stick with the repeated ones.
    – Akidus
    Commented Mar 3, 2016 at 2:12
  • It's easy to see what type a command block is, and whether it's conditional or not, and the assumption is that the needs redstone setting is almost always false. Given that, you should just write out the actual commands you're using in your question. Also, I see redstone lamps that get powered through comparators in another contraption. Don't do this, there are better ways.
    – MBraedley
    Commented Mar 3, 2016 at 12:18
  • OK, I'll edit my question and dont worry about the lamp, it was just a test. Also If you look at the picture that in the comment on Skylinerw's answer it you'll kinda understand what I'm trying to do but put it into 1.9. I was a bit hesitant on what I should of put in my question because there are some people who would just edit and complain on how you should asked the question instead of actually helping. Commented Mar 3, 2016 at 16:02
  • Thanks for the edit, I understand what you're looking for now. I've answered accordingly.
    – Skylinerw
    Commented Mar 3, 2016 at 17:01

2 Answers 2


Without the use of redstone and block updates, it can become a bit complicated to replicate it. You will need to check the SuccessCount value of the command block running the initial /testforblock command to determine when the block is no longer there. Image setup:


  1. The initial /testforblock command, checking for the stone button.

    /testforblock -89 57 678 minecraft:stone_button 5
  2. Conditional. If the /testforblock command succeeded, set the impulse command block (#5) to have an auto tag value of 1, which causes it to run its command. Unlike a repeating command block, it will only run its command a single time. auto has to be set back to 0 before it can activate again. Change "X Y Z" to the coordinates of the impulse block.

    /blockdata X Y Z {auto:1b}
  3. A secondary /testforblock that checks the SuccessCount tag value of the repeating command block. If the value was 0, that means the stone button was not at the location, which means the impulse command block must have auto set back to 0.

    /testforblock X Y Z minecraft:repeating_command_block -1 {SuccessCount:0}
  4. Conditional. If the SuccessCount value was indeed 0, set the impulse block's auto tag value to 0.

    /blockdata X Y Z {auto:0b}
  5. This would be the command you want to run a single time when the stone button is at the location, but will be able to run a single time again if the stone button were to be removed and placed back down.

    /say Test

The benefit of doing it this way is to reduce the number of block updates occur, as /blockdata does not create block updates. The reduction is good for server performance.

  • I set it the way you had it and it nothing is working. I tried arranging the coordinates of the blockdata to see if anything would work but nothing. Commented Mar 3, 2016 at 18:44
  • @JordanRamirez You will need to be more descriptive about what "not working" means, such as which command blocks aren't working as well as the errors or unexpected behavior you're receiving. The mechanism works just fine when I set it up; you need to be absolutely sure the coordinates are pointing to the correct location for all commands, as that's the only variable input in the setup.
    – Skylinerw
    Commented Mar 3, 2016 at 19:03
  • Sorry for the blurriness but I followed the steps to setup and when I press the button the say command does not show. youtube.com/watch?v=lLSp7JryD1M&feature=youtu.be Commented Mar 3, 2016 at 21:08
  • @JordanRamirez The last chain block's coordinates need to point to the impulse block, not the repeating block. Since it pointed to the repeating block, it will turn off the clock. All your chain blocks are also set to "needs redstone", meaning they will never activate until they receive a redstone signal. You need to change them to "Always Active" instead.
    – Skylinerw
    Commented Mar 3, 2016 at 21:27
  • OK, I changed the coordinates and the chain blocks are "Always Active". However the /say command doesn't appear. Seriously what am I doing wrong? Commented Mar 3, 2016 at 23:47

Step 1: Look at the button, type /testforblock, then press tab, space, tab, space, then tab.

Step 2: Once you have the command ready, (for me it's /testforblock 77 72 56 stone_button 13) it should work when pressed. They way to find this out is get a random number after the block, press enter, and it should give you an error saying the number you should've pressed.

Step 3: This part's all about being quick. Since the command's in your chat history, it makes it much easier. First, click the button. Right after that, enter your chat, press the up arrow, and press enter. It should give you a new number because that's the number it is while it's pressed. When the button's placed on a block facing the way you have it in a picture, the number is 13.

Step 4: Copy the command. Put it in your repeating command block, and it should work! If it either doesn't work or you're confused, let me know and I can make a video about it!

Note: This works in 1.9 or higher.

You must log in to answer this question.

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