How to execute a command relative to an entity

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)