1

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"?

5

/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:

/scoreboard objectives add isIronIngot dummy

Then run this on a clock, to set all dropped iron ingot's isIronIngot score to 1:

/scoreboard players set @e[type=Item] isIronIngot 1 {Item:{id:"minecraft:iron_ingot"}}

Now, whenever you want to spawn a zombie at the iron ingots, use this command:

/execute @e[score_isIronIngot_min=1] ~ ~ ~ /summon Zombie

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:

/scoreboard players set @e[type=Item] isIronIngot 1 {Item:{id:"minecraft:iron_ingot",tag:{display:{Name:"Zombie"}}}}
  • Thx ill try this out next time im online i hope it gos well cuz im designing a blaze turret when u drop the ingot it summons the turret which is a custom blaze – crazyjr2 Mar 5 '15 at 19:28
1

I feel that there is definitely an easier way:

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

It should work, just the only downside is that /execute cannot support NBT's like {Item:{id:"minecraft:iron_ingot"}}

  • I Managed It Kinda, But Only To Non Named Items I Gave Up On That And Started Using Spawn Eggs Functions eg. – crazyjr2 Apr 10 '15 at 12:06
  • /execute @e[type=Zombie,name=FireBall] ~ ~1 ~ /summon Fireball ~ ~ ~ {direction:[],ExplosionPower:3] It Works :) – crazyjr2 Apr 10 '15 at 12:08
0

You could use the following command:

/entitydata @e[type=Item,c=1] {CustomName:"ironIngot"}

to give the item a name. (ironIngot is only an example)

Then you use this command:

/execute @e[name=ironIngot] ~ ~ ~ summon Zombie ~ ~ ~ {}

to summon the zombie.

I left the brackets empty to indicate that you could give tags to the zombie to customise it

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.