How to check if there are more mobs in one area than the other?
So, let's say I have an area (defined by x, z) from 0, 0 to 5, 5 and another area from 7, 0 to 12, 5.
I now want to check if there are more chicken, sheeps, ect. in area 1 than on area 2 and tell this the player. Is there a way to achieve that?
(If this isn't possible it would be also okay to just print out the count of area 1 and area 2.)
Best Answer
Use a /testfor command block for each area and each type of mob. Using comparators, you can detect the amount of mobs in the area in the form of redstone strength (upto 15). you can then use more comparators to determine which output is stronger.
Pictures about "How to check if there are more mobs in one area than the other?"



How do you check how many mobs are around you Minecraft?
CommandsCommandDescriptionF3 +QGives help/shows all the F3 commandsF3 +TReloads all textures, models and sounds within a packF3 +\u21e7 ShiftToggles profile graph with debug screenF3 +\u21e7 AltToggles Frame Time Graph with Debug Screen13 more rowsWhat are all the F3 commands in Minecraft?
Rather than spawning them in (and not being able to see where they naturally spawn, their habitats, etc.), it would be cool to have a /locatemob and/or /moblocate command that works as follows: /moblocate <mob/entity>, and the result would simply be the same as the /locate - /locatebiome commands, simply giving you the ...Can you locate mobs in Minecraft?
However, mobs only spawn within a square area of 15\xd715 chunks, or 240 blocks per side, centered on the player, so you must stay fairly close to your farm for it to churn out mobs.Learn The Minecraft Mob Spawning Algorithm in 5 Minutes
More answers regarding how to check if there are more mobs in one area than the other?
Answer 2
I don't think it is possible with one command but what you can do is setup one command block for each block, and each command block tests for an entity then adds it to a scoreboard. This way obviously is not practical because it used allot of command blocks but if your areas are small it's doable.
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Alexander Suhorucov, Amina Filkins, Pavel Danilyuk, Pavel Danilyuk
