How can I summon a mob at the same place as a dropped item? I tried /summon Zombie @e[type=Ingot.iron] but I couldn't get it to work.
Also, is it possible to summon mobs to a named item, e.g. an iron ingot named "Zombie"?
minecraft-commandsminecraft-java-edition
How can I summon a mob at the same place as a dropped item? I tried /summon Zombie @e[type=Ingot.iron] but I couldn't get it to work.
Also, is it possible to summon mobs to a named item, e.g. an iron ingot named "Zombie"?
Best Answer
/summon
doesn't take a a target to summon the mob at, so you'll need to use/execute
, and selectors can't select items by type, so you'll need to use/scoreboard players set
(which can set a score for items with specific NBT data) to set the entity's score first, and then select it based on that scoreboard objective.First, set up a dummy scoreboard objective that we will use to keep track of items that are iron ingots:
Then run this on a clock, to set all dropped iron ingot's
isIronIngot
score to 1:Now, whenever you want to spawn a zombie at the iron ingots, use this command:
Which will make anything with an isIronIngot score of (at least) 1 summon a zombie.
To have this only work with ingots named "Zombie", replace the second command with: