In Minecraft how can I track how many mobs are alive?
Solution 1:
I figured out that if I summon an armor stand on a pressure plate(heavy) every time a bee is summoned it tells me how many bees there and once a certain amount of bees are summoned I can make things happen:
Solution 2:
If you could simply be watching while people played this you could turn off mob spawning once a certain number of mobs spawn. However, this only works if you are not intending to publish this creation.
I’d look it up and see if there is a way to use command blocks to do this, because I am not the best at the technical side of Minecraft.
Edit: I realized my answer doesn’t make sense. If you were going to be there you could just as easily break the beehives or use a /kill command and teleport the players. You could do some calculations and figure out how long it takes, on average, for that many bees to spawn and run a command block to break the beehives after that amount of time, but this method seems very difficult. As a last resort you could change your mini game so that this isn’t a problem.
Solution 3:
I think the best option would be to utilize dummy scoreboards to to keep track of the bees count (you could also make it decrease if a bee is killed) and then have a check before you spawn new bees to make sure the count is below a certain number.
https://minecraft.fandom.com/wiki/Scoreboard