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:
![RCB > CCCB > CCB > CCCB > ICB](https://i.stack.imgur.com/jxs7m.png)
The initial /testforblock
command, checking for the stone button.
/testforblock -89 57 678 minecraft:stone_button 5
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}
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}
Conditional. If the SuccessCount
value was indeed 0, set the impulse block's auto
tag value to 0.
/blockdata X Y Z {auto:0b}
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.
There is no n
parameter. The correct parameter you're looking for is name
. The wiki has a list of all valid parameters here.
testfor @p[1303,56,518,2,name=JAMES_the_camel]
For 1.11-1.12, which removes shorthand coordinates:
testfor @p[x=1303,y=56,z=518,r=2,name=JAMES_the_camel]
And for 1.13+, which overhauled the command system (where /testfor
has essentially been merged into /execute
):
execute if entity @p[x=1303,y=56,z=518,distance=..2,name=JAMES_the_camel]
As well, because your chain is unconditional, it's going to activate no matter what and open the door. If you set it to conditional, it will only run its command if the command block physically behind it was successful. You will want to set your chain block to conditional or otherwise activate another set of command blocks based on the success of /testfor
.
Best Answer
After discussing it in the comments, it was found that this problem was a bug in an older version. (1.16.1)
If you are having a similar problem, try updating to the latest version of MCBE. (1.16.20)