-1

When a player has an oak staircase directly in front of them, I would like a command block to place a barrier under them.

The command I have used that fails is:

/execute @a ~ ~ ~ detect ~1 ~1 ~ minecraft:oak_stairs /setblock ~ ~-1 ~ barrier

I will use multiple command blocks with a similar command to make it work on all sides of the player.

I also need a way to where the player leaves the oak stairs it would remove the barrier.

My Minecraft has messed up and nothing I can do can fix it but it cant show my the command block output no matter what I try. Can someone please try and help me with this, nothing I can find helps me at all.

  • Please only ask one question. If you have another question, post another question. – IronAnvil Apr 9 '18 at 1:12
1

You're very close! The game thinks that /setblock is the block state, so simply add a value for the oak stair before /setblock. Unfortunately, you will need to do it for every block state, unless there is a way of targeting every block type with detect (If there is, please inform me. That would be most useful) Thanks to IronAnvil, I can now inform you that to target any oak stair, simply put -1 as the block state.

In this case, you would go

/execute @a ~ ~ ~ detect ~1 ~1 ~ minecraft:oak_stairs -1 /setblock ~ ~-1 ~ barrier

which would look for oak stairs facing west, to the east of the player, to then place a barrier underneath.

Hope I could help!

  • 2
    From the wiki on execute command under the dataValue argument: "Must be a valid block data for that type of block or -1 to match any block data." – IronAnvil Apr 9 '18 at 0:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.