I want to make it so I always have 50 entities in an area. So when 1 dies/despawns/leaves the area I want it to detect that and summon in a new entity, and yes I do want them to die/despawn/leave the area so preventing those things is not an option.
Minecraft Java Edition – How to Count Entities in an Area
minecraft-commandsminecraft-java-edition
Related Topic
- Minecraft – How to use the RootVehicle tag on other entities in Minecraft
- Minecraft Java Edition – How to Test for Any Mob Death Without Scoreboard
- Minecraft Java Edition – How to Use a Target Selector to Determine Position in an Entity’s Hitbox
- Minecraft – How to gather entities into sets
- Minecraft – How to detect death in Minecraft in a certain area
- Minecraft – Area Effect Clouds: RadiusOnUse/DurationOnUse
- Minecraft Java Edition – How to Detect & Make Entities Ride Each Other with Commands
Best Answer
Plug a redstone clock into 2 Command blocks (or use 1.9 Repeat command blocks):
The first command:
And the second:
Place a Comparator leading from the second Command Block - that is, if there are 49 entities, it succeeds. Then place your final command block next to the Comparator, into it put your
/summon
command.