I want to create a trap with an iron trapdoor hidden by a carpet.

When a player stands on a carpet, the carpet disappears for five seconds and the trapdoor beneath it opens, and the player falls into a lava pit.

I have managed to activate iron trapdoors by creating an always active command block that detects standing on the trapdoor and creatres redstone torches under the iron doors (each set of trapdoors forms a 2x2 square that should open simultaneously).

Could you give me some hints how I could achieve it?

UPDATE 1: Minecraft version 1.13.2

UPDATE 2: I've managed to create trapdoor trap by creating a set of command blocks beneath the trap, so I just need to detect carpets.

  • 1
    first and foremost; what Minecraft version are you using? syntax for commands were changed a lot in 1.13. – EarthToAccess Apr 12 at 19:57
  • 1.13.2. Sorry, I forgot about it. – Тимофей Ломоносов Apr 13 at 4:23

an easy way that you can do this involves the method you described, plus one more for the carpets.
i'm going to assume that you used the method of execute as @a at @s if block ~ ~-1 ~ minecraft:<block> run <command> for detecting if you have the block as a trap door under the player's feet. you can then do the same thing with the carpet, except instead of trap doors, you use the colored carpet, and you can use /fill to remove the carpet;

execute as @a at @s if block ~ ~-1 ~ minecraft:white_carpet run fill <xyz position of corner one> <xyz of corner two> air replace white_carpet

you could then make a separate command similar to that, except instead of replacing the carpet with air, do the other way around, and instead if detecting if they're standing on carpet, detect the lava;

execute as @a at @s if block ~ ~-1 ~ minecraft:lava run fill <xyz position of corner one> <xyz of corner two> white_carpet replace air
  • The problem is that the same /execute command doesn't work with carpet since technically I'm still standing on the trapdoor. I've tried that command: I've triggered the trapdoor but I can't move down through a carpet. – Тимофей Ломоносов Apr 13 at 15:35
  • It worked when I replaced the coordinates in the carpet to ~ ~ ~ – Тимофей Ломоносов Apr 13 at 17:08
  • oh, good! i forgot that carpet technically fills the block above the one it's placed on. glad it worked! – EarthToAccess Apr 13 at 23:30

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.