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.


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"? Feb 18 '16 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
    Feb 18 '16 at 17:44

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.