I'm trying to recreate a form of the game Runner in a spleef format. Basically, I want a redstone signal to be sent out when the player stands on a Snow block in order to delete the block (replace it with air using setblock) a second or two after. How would I accomplish this?
Minecraft – How to set a command block in Minecraft 1.9 to send out a redstone signal whenever it detects a player on a specific type of block
minecraft-commandsminecraft-java-edition
Related Topic
- Minecraft – How to make a commandblock do setblock at a certain player
- Minecraft – How to do a /setblock for under a player
- Minecraft – How to Create a Lava Survival PvP Map?
- Minecraft-Java-Edition,Minecraft-Commands – How to Make Command Block Output a Negative Signal
- Minecraft – I need help with a command block chain
Best Answer
The
/execute
command will allow you to detect blocks relative to a player. The syntax is:So, you can run the following in the command block:
The above will give a redstone signal when it successfully finds a snow block below the player, which is what your question asks.
However, using testfor commands and comparators for something like this is generally a bad idea; how will you know what block to delete 2 seconds later when the player has moved away from it, for example? Plus it'll be completely incompatible with multiplayer.
You may want to, instead, use the
/execute
command'sdetect
syntax, which allows you to detect a block from an entity, then run a command from the same entity if that block was found. You could use this to delete the block that was found, or summon a marker stand to delete it after a delay: