Minecraft – Using command blocks to spawn player-killed mobs

minecraft-commandsminecraft-java-edition

To explain, when a player kills certain mobs, they have a chance to drop specific items. For example, when a player kills a zombie, they have a chance to drop iron tools, armour, iron ingots, and even potatoes or carrots.

If I wanted to create a mob-grinder, is there a way to spawn mobs that act as if they can be killed by players, if a player hasn't actually touched them using only commands/command blocks? (No mods)

Best Answer

I don't quite understand what you mean but there were 2 things I thought you could have meant.

The first one was to spawn the Mob with half a heart so there a one-shot-kill and for that, you would do: /summon Zombie ~ ~ ~ {Attributes:[{Name:generic.maxHealth,Base:0.5}]}

The second thing I got was to make the Mob Invulnerable and for that, you would do: /summon Zombie ~ ~ ~ {Invulnerable:1}

However, if you're trying to spawn a mob that has an attribute to define "Hit by player", unfortunately there is no such command.