0

I am making a system of commands where trapdoors are traps, so whenever someone holds the trap in their hand, the trap happens to everyone. I already made part of the command for the birch trapdoor:

execute if @a[type=player,nbt={SelectedItem:{id:"minecraft:birch_trapdoor",Count:1b}}]

but I want it to summon a layer of falling birch logs above the player's head and cannot think of a way to do this efficiently.

1
0

First of all, I made that this command will summon an anvil at the top of their head. Just place 2 command blocks in this way.

The first command block needs to be on repeat mode and always active:

/execute if entity @a[nbt={SelectedItem:{id:"minecraft:birch_trapdoor",Count:1b}}] at @a[name=!PutYourNameHereAndDontDeleteTheExclamationMark] run setblock ~ ~10 ~ minecraft:damaged_anvil

The second command block needs to be on chain mode, conditional, always active (be sure the arrows are in the same way):

/execute as @p[nbt={SelectedItem:{id:"minecraft:birch_trapdoor",Count:1b}}] run clear @s birch_trapdoor 1
4
  • The @a[name=!PutYourNameHereAndDontDeleteTheExclamationMark] is that the trap doesn't work on yourself and only works on other players, So you won't get hurt. Jan 17 at 16:31
  • Thank you, but I looked for a a layer of falling birch, not anvils. I found a better way, though. Nice pfp btw.
    – Korogue
    Jan 20 at 22:15
  • But if you try with summoning birch log falling blocks, It doesn't do any damage at all. Jan 20 at 22:20
  • You can make them deal damage using the FallHurtAmount NBT tag. By the way, I have resolved my issue, so you can look at my solution now.
    – Korogue
    Jan 20 at 23:14
0

I brainstormed an answer to my own question: Since it's a manhunt(minecraft manhunt but), it's unlikely anyone is gonna bother to make blue concrete powder. So, I will /fill blue concrete powder above everyone's head: execute if @a[type=player,nbt={SelectedItem:{id:"minecraft:birch_trapdoor",Count:1b}}] at @a fill ~-1 ~3 ~-1 ~1 ~3 ~1 blue_concrete_powder

If it weren't a manhunt, I would put more effort on this and put a custom tag on it somehow, but it isn't a survival server, so it's fine.

Then, I will have a command block that run with a small delay time after the first so the concrete powder can turn into an entity:

execute as @e[type=falling_block,nbt={BlockState:{Name:"minecraft:blue_concrete_powder"},Time:2}] data merge entity @s {Passengers:{id:"falling_block",nbt:{BlockState:{Name:"birch_log"}}}}

Finally, we kill all blue concrete powders:

kill @e[type=falling_block,nbt={BlockState:{Name:"blue_concrete_powder"}]

If you don't understand what this does, it /fills a layer of blue concrete powder, lets them turn into entities as they fall, then /data merges a passenger of falling birch logs onto the falling blocks. Afterwards, the blue concrete powder is /killed, leaving the birch logs flying at the player.

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.