I have been building a mob farm and wanted to see the total amount of entities that are spawning or dying per hour. I have tried using scoreboards to track the number of zombie deaths or spawns as either would be a good measurement, however, I couldn't get it to work for 2 reasons:

  1. Because the methods I tried only worked if it was a player kill and not something else (magma blocks in my farm).

  2. When trying to detect zombie spawns the score added for spawning each zombie was removed when they died. If I was trying to track the total amount I would need the score not to decrease.

Either measurement of zombie deaths spawns would be fine as they both give indication of what my farm is producing.

The method below almost works for tracking deaths, it just only detects it if I kill the zombie, not if it dies by other causes. Maybe a dummy scoreboard would work better, because it can be changed to detect anything rather than a set value, but I'm not sure how to change this.

/scoreboard objectives add ZombieDeaths minecraft.killed:minecraft.zombie

/scoreboard objectives setdisplay sidebar ZombieDeaths

/execute if entity @a[scores={ZombieDeaths=1}] run score add scoreboard players add @a ZombieDeaths 1

  • one possible method to detect deaths is checking for entities with a specific deathtime nbt tag, but i'm not sure if lower tps would cause double counting or another error could happen Commented May 10, 2023 at 4:53

1 Answer 1


Tracking entity deaths is a lot more difficult and prone to errors than tracking spawns, as you'd have to deal with despawning, unloading, etc., so I'll be explaining how to do track spawning instead.

It's as easy as adding 1 to a dummy score every time you find the entity.
The important part for spawn tracking is that every entity is only counted once though, and we can achieve that by adding a tag to the entity after we counted it and only count it if it doesn't have the tag.

Example for zombies everywhere. Use target selectors to limit the selection of zombies to only your farm.

setup (run in chat once):

scoreboard objectives add zombies dummy

repeating-chain of commandblocks:

execute as @e[type=zombie,tag=!counted] run scoreboard players add total zombies 1
tag @e[type=zombie,tag=!counted] add counted

Now the total fake player in the zombies scoreboard objective will have the total amount of spawned zombies in it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .