It will succesfully run the command, but when you check the commandblock you aren't standing above a wool block, so it says '[21:28:27] Failed to execute 'detect' as Heroblind55246'. Try to do something like this:
/execute @a ~ ~ ~ detect ~ ~-4 ~ minecraft:wool 15 say hi
I hope it will work!
You have to use a combination of relative rotational coordinates and a scoreboard objective. The latter is to ensure that players are only rotated once per stepping above a coal block.
Fancy single objective solution
Set up your objective as:
/scoreboard objectives add overCoal dummy
On a 20Hz. clock, run the following commands to set the score:
/execute @a[r=10000] ~ ~ ~ detect ~ ~-2 ~ minecraft:coal_block 0 scoreboard players add @a[c=1] overCoal 3
/scoreboard players remove @a[score_overCoal_min=1] overCoal 2
/scoreboard players set @a[score_overCoal_min=3] overCoal 2
/scoreboard players set @a[score_overCoal=-1] overCoal 0
This might look confusing at first, what with adding 3 and subtracting 2, but it does the trick. Basically, every tick the player is above a coal block, his score is incremented by +3-2=+1, but only to a maximum of 2 (3rd command). The moment the player steps off, the score decreases by 2 (thereby avoiding the value of 1), to a minimum of 0 (4th command).
This means that after these 4 commands are run, the score is:
- 0 if the player is not above a coal block.
- 1 if the player has been above a coal block for exactly 1 tick.
- 2 if the player was above the coal block for longer.
All that is left is to put a command to rotate the players with a score of exactly 1:
/tp @a[score_overCoal=1,score_overCoal_min=1] ~ ~ ~ ~<R> ~
where <R>
is the amount of degrees you want to rotate the player.
Simpler 2 objective solution
If the above solution was too confusing for your taste, a more intuitive way is to use 2 objectives:
/scoreboard objectives add overCoal dummy
/scoreboard objectives add overCoalTime dummy
On a 20Hz. clock, run the following commands to set the score:
/scoreboard players set @a overCoal 0
/execute @a[r=10000] ~ ~ ~ detect ~ ~-2 ~ minecraft:coal_block 0 scoreboard players set @a[c=1] overCoal 1
/scoreboard players set @a[score_overCoal=0] overCoalTime 0
/scoreboard players add @a[score_overCoal_min=1] overCoalTime 1
This achieves basically the same as above, but for overCoalTime
instead.
Best Answer
For situations like this, I'd recommend running the command being executed itself (the
/fill
command) to see what the error is.The main error appears to be that you're trying to fill a quarter of a million blocks, which is more the maximum (
32678
) that Minecraft allows for. You could reduce your fill region:Or, if the huge area is important, split it up into multiple commands:
(I'd suggest not running either of these on a clock)
That should be it, but keep in mind that the command will also fail if there are no gold blocks to replace, or if you're too low-down/high-up so that the relative coordinate are selecting an area outside of the world.