2

I was wondering how to detect grass and dirt blocks under a player and summon a tnt under them. I tried some things on my own and managed to set off a tnt at the player location, but I cannot summon it when the player is on the grass.

1
  • What have you tried? Can you elaborate?
    – WarpPrime
    Sep 26, 2020 at 15:36

1 Answer 1

5

To do this command, have this command in an always active repeating command block:

/execute at @a if block ~ ~-1 ~ minecraft:grass_block run summon tnt ~ ~ ~

The @a part checks all players. The if block ~ ~-1 ~ minecraft:grass_block checks if a player is on a grass block. The last part, run summon tnt ~ ~ ~ summons a tnt at the player who was on a grass block. I hope this helps.

2
  • 1
    I thought numerical IDs are no longer supported. minecraft:grass_block was the correct way.
    – One 2 Many
    Sep 26, 2020 at 21:35
  • @ExpertCoder14 Oh! Oops! I will edit my post to correct that.
    – WarpPrime
    Sep 26, 2020 at 21:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .