glyphid spawn limit

This commit is contained in:
Boblet 2023-06-27 16:31:50 +02:00
parent 7c8b8385f1
commit cd7b68d7ce
2 changed files with 11 additions and 1 deletions

View File

@ -39,7 +39,15 @@ public class BlockGlyphidSpawner extends BlockContainer {
public void updateEntity() {
if(!worldObj.isRemote && worldObj.getTotalWorldTime() % 60 == 0 && this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL) {
int count = 0;
for(Object e : worldObj.loadedEntityList) {
if(e instanceof EntityGlyphid) {
count++;
if(count >= MobConfig.spawnMax) return;
}
}
float soot = PollutionHandler.getPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT);
List<EntityGlyphid> list = worldObj.getEntitiesWithinAABB(EntityGlyphid.class, AxisAlignedBB.getBoundingBox(xCoord - 6, yCoord + 1, zCoord - 6, xCoord + 7, yCoord + 9, zCoord + 7));

View File

@ -35,6 +35,7 @@ public class MobConfig {
public static double tier3Threshold = 10;
public static double tier4Threshold = 50;
public static double tier5Threshold = 100;
public static double spawnMax = 50;
public static void loadFromConfig(Configuration config) {
@ -72,5 +73,6 @@ public class MobConfig {
tier3Threshold = CommonConfig.createConfigDouble(config, CATEGORY, "12.G04_tier3Threshold", "Minimum amount of soot for tier 3 glyphids to spawn", 10);
tier4Threshold = CommonConfig.createConfigDouble(config, CATEGORY, "12.G05_tier4Threshold", "Minimum amount of soot for tier 4 glyphids to spawn", 50);
tier5Threshold = CommonConfig.createConfigDouble(config, CATEGORY, "12.G06_tier5Threshold", "Minimum amount of soot for tier 5 glyphids to spawn", 100);
spawnMax = CommonConfig.createConfigDouble(config, CATEGORY, "12.G07_spawnMax", "Maximum amount of glyphids being able to exist at once through natural spawning", 50);
}
}