added mobcaps to API

This commit is contained in:
gnembon committed 2020-06-07 16:55:32 -03:00
1 parent f5dd01cce8
commit 0fc71e97ef
4 files changed
+59 -2

No files matched your search

@@ -82,6 +82,11 @@ public class SpawnReporter
local_spawns.put(cat, local_spawns.get(cat)+1);
}
public static final int MAGIC_NUMBER = (int)Math.pow(17.0D, 2.0D);
public static double currentMagicNumber()
{
return MAGIC_NUMBER / (Math.pow(2.0,(SpawnReporter.mobcap_exponent/4)));
}
public static List<BaseText> printMobcapsForDimension(ServerWorld world, boolean multiline)
{
@@ -103,7 +108,7 @@ public class SpawnReporter
for (SpawnGroup enumcreaturetype : SpawnGroup.values())
{
int cur = dimCounts.getOrDefault(enumcreaturetype, -1);
int max = chunkcount * (int)((double)enumcreaturetype.getCapacity() * (Math.pow(2.0,(SpawnReporter.mobcap_exponent/4)))) / (int)Math.pow(17.0D, 2.0D); // from ServerChunkManager.CHUNKS_ELIGIBLE_FOR_SPAWNING
int max = chunkcount * (int)((double)enumcreaturetype.getCapacity() / currentMagicNumber()); // from ServerChunkManager.CHUNKS_ELIGIBLE_FOR_SPAWNING
String color = Messenger.heatmap_color(cur, max);
String mobColor = Messenger.creatureTypeColor(enumcreaturetype);
if (multiline)