I was wondering how to execute a command relative to an entity in Minecraft using commands for a map I was working on. I am somewhat familiar with the use of the /execute command, but wanted to use the /summon to make a grenade using item drops or arrows, then have TNT summoned to the area that the item is in.

1 Answer 1


The /execute command is used to execute another command relative to something, the syntax you'll need is:

/execute <entity> <x> <y> <z> <command>

You should use target selectors with selector arguments to select to entity you want to execute from.

To summon TNT from an item drop, you could do:

/execute @e[type=Item] ~ ~ ~ /summon PrimedTnt

(Be careful with this command, as all item drops will act as a grenade)

  • How would I do it for an item with a certain name, such as a snowball with the name "Grenade"? Commented Feb 18, 2016 at 17:32
  • @Bookmaster_VP Create a dummy objective (I'll call mine "IsGrenade" as an example), run /scoreboard players set @e[type=Item] IsGrenade 1 {Item:{id:"minecraft:snowball",tag:{display:{Name:"Grenade"}}}}, then you can target the snowball items with @e[score_IsGrenade_min=1]
    – SirBenet
    Commented Feb 18, 2016 at 17:44

You must log in to answer this question.

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