Add configuration options for water_ambient spawning

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2020-06-26 18:39:42 +10:00
parent b60f49f0ea
commit 8144dfbd7f
5 changed files with 71 additions and 18 deletions

View File

@@ -21,7 +21,7 @@
continue;
}
}
@@ -70,10 +75,44 @@
@@ -70,10 +75,49 @@
EnumCreatureType[] aenumcreaturetype = SpawnerCreature.c;
int i = aenumcreaturetype.length;
@@ -31,6 +31,7 @@
+ boolean spawnMonsterThisTick = worldserver.ticksPerMonsterSpawns != 0L && worlddata.getTime() % worldserver.ticksPerMonsterSpawns == 0L;
+ 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;
+ // CraftBukkit end
+
for (int j = 0; j < i; ++j) {
@@ -55,6 +56,10 @@
+ spawnThisTick = spawnAmbientThisTick;
+ limit = worldserver.getWorld().getAmbientSpawnLimit();
+ break;
+ case WATER_AMBIENT:
+ spawnThisTick = spawnWaterAmbientThisTick;
+ limit = worldserver.getWorld().getWaterAmbientSpawnLimit();
+ break;
+ }
- if ((flag || !enumcreaturetype.d()) && (flag1 || enumcreaturetype.d()) && (flag2 || !enumcreaturetype.e()) && spawnercreature_d.a(enumcreaturetype)) {
@@ -67,7 +72,7 @@
a(enumcreaturetype, worldserver, chunk, (entitytypes, blockposition, ichunkaccess) -> {
return spawnercreature_d.a(entitytypes, blockposition, ichunkaccess);
}, (entityinsentient, ichunkaccess) -> {
@@ -148,10 +187,13 @@
@@ -148,10 +192,13 @@
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);
@@ -85,7 +90,7 @@
if (j >= entityinsentient.getMaxSpawnGroup()) {
return;
}
@@ -333,7 +375,7 @@
@@ -333,7 +380,7 @@
if (entityinsentient.a(generatoraccess, EnumMobSpawn.CHUNK_GENERATION) && entityinsentient.a((IWorldReader) generatoraccess)) {
groupdataentity = entityinsentient.prepare(generatoraccess, generatoraccess.getDamageScaler(entityinsentient.getChunkCoordinates()), EnumMobSpawn.CHUNK_GENERATION, groupdataentity, (NBTTagCompound) null);
@@ -94,7 +99,7 @@
flag = true;
}
}
@@ -458,8 +500,10 @@
@@ -458,8 +505,10 @@
return this.d;
}