#934: Support for configuring Water Underground Creatures spawn settings

By: Doc <nachito94@msn.com>
This commit is contained in:
CraftBukkit/Spigot
2021-10-05 11:29:52 +11:00
parent f27c8f74f8
commit 2d0a775210
5 changed files with 71 additions and 18 deletions

View File

@@ -22,7 +22,7 @@
continue;
}
}
@@ -108,10 +114,49 @@
@@ -108,10 +114,54 @@
EnumCreatureType[] aenumcreaturetype = SpawnerCreature.SPAWNING_CATEGORIES;
int i = aenumcreaturetype.length;
@@ -33,6 +33,7 @@
+ boolean spawnWaterThisTick = worldserver.ticksPerWaterSpawns != 0L && worlddata.getTime() % worldserver.ticksPerWaterSpawns == 0L;
+ boolean spawnAmbientThisTick = worldserver.ticksPerAmbientSpawns != 0L && worlddata.getTime() % worldserver.ticksPerAmbientSpawns == 0L;
+ boolean spawnWaterAmbientThisTick = worldserver.ticksPerWaterAmbientSpawns != 0L && worlddata.getTime() % worldserver.ticksPerWaterAmbientSpawns == 0L;
+ boolean spawnWaterUndergroundCreatureThisTick = worldserver.ticksPerWaterUndergroundCreatureSpawns != 0L && worlddata.getTime() % worldserver.ticksPerWaterUndergroundCreatureSpawns == 0L;
+ // CraftBukkit end
+
for (int j = 0; j < i; ++j) {
@@ -53,6 +54,10 @@
+ spawnThisTick = spawnWaterThisTick;
+ limit = worldserver.getWorld().getWaterAnimalSpawnLimit();
+ break;
+ case UNDERGROUND_WATER_CREATURE:
+ spawnThisTick = spawnWaterUndergroundCreatureThisTick;
+ limit = worldserver.getWorld().getWaterUndergroundCreatureSpawnLimit();
+ break;
+ case AMBIENT:
+ spawnThisTick = spawnAmbientThisTick;
+ limit = worldserver.getWorld().getAmbientSpawnLimit();
@@ -73,7 +78,7 @@
Objects.requireNonNull(spawnercreature_d);
SpawnerCreature.c spawnercreature_c = spawnercreature_d::a;
@@ -196,10 +241,14 @@
@@ -196,10 +246,14 @@
entityinsentient.setPositionRotation(d0, (double) i, d1, worldserver.random.nextFloat() * 360.0F, 0.0F);
if (a(worldserver, entityinsentient, d2)) {
groupdataentity = entityinsentient.prepare(worldserver, worldserver.getDamageScaler(entityinsentient.getChunkCoordinates()), EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null);
@@ -92,7 +97,7 @@
if (j >= entityinsentient.getMaxSpawnGroup()) {
return;
}
@@ -370,7 +419,7 @@
@@ -370,7 +424,7 @@
if (entityinsentient.a((GeneratorAccess) worldaccess, EnumMobSpawn.CHUNK_GENERATION) && entityinsentient.a((IWorldReader) worldaccess)) {
groupdataentity = entityinsentient.prepare(worldaccess, worldaccess.getDamageScaler(entityinsentient.getChunkCoordinates()), EnumMobSpawn.CHUNK_GENERATION, groupdataentity, (NBTTagCompound) null);
@@ -101,7 +106,7 @@
flag = true;
}
}
@@ -486,8 +535,10 @@
@@ -486,8 +540,10 @@
return this.unmodifiableMobCategoryCounts;
}