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.

4

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.

| improve this answer | |
  • 1
    I thought numerical IDs are no longer supported. minecraft:grass_block was the correct way. – ExpertCoder14 Sep 26 at 21:35
  • @ExpertCoder14 Oh! Oops! I will edit my post to correct that. – FTL's account will be deleted Sep 26 at 21:50

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.