Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
Add configuration options for water_ambient spawning
Dieser Commit ist enthalten in:
Ursprung
baadbf3f76
Commit
c99846cc76
@ -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;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
|
||||
protected static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -46,7 +57,39 @@
|
||||
@@ -46,7 +57,41 @@
|
||||
private final ResourceKey<World> dimensionKey;
|
||||
private final ResourceKey<DimensionManager> typeKey;
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
+ public long ticksPerAnimalSpawns;
|
||||
+ public long ticksPerMonsterSpawns;
|
||||
+ public long ticksPerWaterSpawns;
|
||||
+ public long ticksPerWaterAmbientSpawns;
|
||||
+ public long ticksPerAmbientSpawns;
|
||||
+ public boolean populating;
|
||||
+
|
||||
@ -54,12 +55,13 @@
|
||||
+ this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
|
||||
+ this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit
|
||||
+ this.ticksPerWaterSpawns = this.getServer().getTicksPerWaterSpawns(); // CraftBukkit
|
||||
+ this.ticksPerWaterAmbientSpawns = this.getServer().getTicksPerWaterAmbientSpawns(); // CraftBukkit
|
||||
+ this.ticksPerAmbientSpawns = this.getServer().getTicksPerAmbientSpawns(); // CraftBukkit
|
||||
+ // CraftBukkit end
|
||||
this.methodProfiler = supplier;
|
||||
this.worldData = worlddatamutable;
|
||||
this.x = dimensionmanager;
|
||||
@@ -57,12 +100,12 @@
|
||||
@@ -57,12 +102,12 @@
|
||||
this.worldBorder = new WorldBorder() {
|
||||
@Override
|
||||
public double getCenterX() {
|
||||
@ -74,7 +76,7 @@
|
||||
}
|
||||
};
|
||||
} else {
|
||||
@@ -72,6 +115,35 @@
|
||||
@@ -72,6 +117,35 @@
|
||||
this.serverThread = Thread.currentThread();
|
||||
this.biomeManager = new BiomeManager(this, i, dimensionmanager.getGenLayerZoomer());
|
||||
this.debugWorld = flag1;
|
||||
@ -110,7 +112,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -176,6 +248,17 @@
|
||||
@@ -176,6 +250,17 @@
|
||||
|
||||
@Override
|
||||
public boolean a(BlockPosition blockposition, IBlockData iblockdata, int i, int j) {
|
||||
@ -128,7 +130,7 @@
|
||||
if (isOutsideWorld(blockposition)) {
|
||||
return false;
|
||||
} else if (!this.isClientSide && this.isDebugWorld()) {
|
||||
@@ -183,9 +266,24 @@
|
||||
@@ -183,9 +268,24 @@
|
||||
} else {
|
||||
Chunk chunk = this.getChunkAtWorldCoords(blockposition);
|
||||
Block block = iblockdata.getBlock();
|
||||
@ -154,7 +156,7 @@
|
||||
return false;
|
||||
} else {
|
||||
IBlockData iblockdata2 = this.getType(blockposition);
|
||||
@@ -196,6 +294,7 @@
|
||||
@@ -196,6 +296,7 @@
|
||||
this.getMethodProfiler().exit();
|
||||
}
|
||||
|
||||
@ -162,7 +164,7 @@
|
||||
if (iblockdata2 == iblockdata) {
|
||||
if (iblockdata1 != iblockdata2) {
|
||||
this.b(blockposition, iblockdata1, iblockdata2);
|
||||
@@ -222,12 +321,65 @@
|
||||
@@ -222,12 +323,65 @@
|
||||
|
||||
this.a(blockposition, iblockdata1, iblockdata2);
|
||||
}
|
||||
@ -228,7 +230,7 @@
|
||||
public void a(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {}
|
||||
|
||||
@Override
|
||||
@@ -309,6 +461,17 @@
|
||||
@@ -309,6 +463,17 @@
|
||||
IBlockData iblockdata = this.getType(blockposition);
|
||||
|
||||
try {
|
||||
@ -246,7 +248,7 @@
|
||||
iblockdata.doPhysics(this, blockposition, block, blockposition1, false);
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours");
|
||||
@@ -351,6 +514,14 @@
|
||||
@@ -351,6 +516,14 @@
|
||||
|
||||
@Override
|
||||
public IBlockData getType(BlockPosition blockposition) {
|
||||
@ -261,7 +263,7 @@
|
||||
if (isOutsideWorld(blockposition)) {
|
||||
return Blocks.VOID_AIR.getBlockData();
|
||||
} else {
|
||||
@@ -498,9 +669,11 @@
|
||||
@@ -498,9 +671,11 @@
|
||||
TileEntity tileentity1 = (TileEntity) this.tileEntityListPending.get(i);
|
||||
|
||||
if (!tileentity1.isRemoved()) {
|
||||
@ -273,7 +275,7 @@
|
||||
|
||||
if (this.isLoaded(tileentity1.getPosition())) {
|
||||
Chunk chunk = this.getChunkAtWorldCoords(tileentity1.getPosition());
|
||||
@@ -508,6 +681,12 @@
|
||||
@@ -508,6 +683,12 @@
|
||||
|
||||
chunk.setTileEntity(tileentity1.getPosition(), tileentity1);
|
||||
this.notify(tileentity1.getPosition(), iblockdata, iblockdata, 3);
|
||||
@ -286,7 +288,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -548,12 +727,25 @@
|
||||
@@ -548,12 +729,25 @@
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
@ -312,7 +314,7 @@
|
||||
TileEntity tileentity = null;
|
||||
|
||||
if (this.tickingTileEntities) {
|
||||
@@ -588,6 +780,13 @@
|
||||
@@ -588,6 +782,13 @@
|
||||
public void setTileEntity(BlockPosition blockposition, @Nullable TileEntity tileentity) {
|
||||
if (!isOutsideWorld(blockposition)) {
|
||||
if (tileentity != null && !tileentity.isRemoved()) {
|
||||
@ -326,7 +328,7 @@
|
||||
if (this.tickingTileEntities) {
|
||||
tileentity.setLocation(this, blockposition);
|
||||
Iterator iterator = this.tileEntityListPending.iterator();
|
||||
@@ -612,7 +811,7 @@
|
||||
@@ -612,7 +813,7 @@
|
||||
}
|
||||
|
||||
public void removeTileEntity(BlockPosition blockposition) {
|
||||
|
@ -245,6 +245,7 @@ public final class CraftServer implements Server {
|
||||
private int monsterSpawn = -1;
|
||||
private int animalSpawn = -1;
|
||||
private int waterAnimalSpawn = -1;
|
||||
private int waterAmbientSpawn = -1;
|
||||
private int ambientSpawn = -1;
|
||||
private File container;
|
||||
private WarningState warningState = WarningState.DEFAULT;
|
||||
@ -331,6 +332,7 @@ public final class CraftServer implements Server {
|
||||
monsterSpawn = configuration.getInt("spawn-limits.monsters");
|
||||
animalSpawn = configuration.getInt("spawn-limits.animals");
|
||||
waterAnimalSpawn = configuration.getInt("spawn-limits.water-animals");
|
||||
waterAmbientSpawn = configuration.getInt("spawn-limits.water-ambient");
|
||||
ambientSpawn = configuration.getInt("spawn-limits.ambient");
|
||||
console.autosavePeriod = configuration.getInt("ticks-per.autosave");
|
||||
warningState = WarningState.value(configuration.getString("settings.deprecated-verbose"));
|
||||
@ -669,6 +671,11 @@ public final class CraftServer implements Server {
|
||||
return this.configuration.getInt("ticks-per.water-spawns");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTicksPerWaterAmbientSpawns() {
|
||||
return this.configuration.getInt("ticks-per.water-ambient-spawns");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTicksPerAmbientSpawns() {
|
||||
return this.configuration.getInt("ticks-per.ambient-spawns");
|
||||
@ -752,6 +759,7 @@ public final class CraftServer implements Server {
|
||||
monsterSpawn = configuration.getInt("spawn-limits.monsters");
|
||||
animalSpawn = configuration.getInt("spawn-limits.animals");
|
||||
waterAnimalSpawn = configuration.getInt("spawn-limits.water-animals");
|
||||
waterAmbientSpawn = configuration.getInt("spawn-limits.water-ambient");
|
||||
ambientSpawn = configuration.getInt("spawn-limits.ambient");
|
||||
warningState = WarningState.value(configuration.getString("settings.deprecated-verbose"));
|
||||
TicketType.PLUGIN.loadPeriod = configuration.getInt("chunk-gc.period-in-ticks");
|
||||
@ -792,6 +800,12 @@ public final class CraftServer implements Server {
|
||||
world.ticksPerWaterSpawns = this.getTicksPerWaterSpawns();
|
||||
}
|
||||
|
||||
if (this.getTicksPerWaterAmbientSpawns() < 0) {
|
||||
world.ticksPerWaterAmbientSpawns = 1;
|
||||
} else {
|
||||
world.ticksPerWaterAmbientSpawns = this.getTicksPerWaterAmbientSpawns();
|
||||
}
|
||||
|
||||
if (this.getTicksPerAmbientSpawns() < 0) {
|
||||
world.ticksPerAmbientSpawns = 1;
|
||||
} else {
|
||||
@ -1647,6 +1661,11 @@ public final class CraftServer implements Server {
|
||||
return waterAnimalSpawn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWaterAmbientSpawnLimit() {
|
||||
return waterAmbientSpawn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAmbientSpawnLimit() {
|
||||
return ambientSpawn;
|
||||
|
@ -277,6 +277,7 @@ public class CraftWorld implements World {
|
||||
private int monsterSpawn = -1;
|
||||
private int animalSpawn = -1;
|
||||
private int waterAnimalSpawn = -1;
|
||||
private int waterAmbientSpawn = -1;
|
||||
private int ambientSpawn = -1;
|
||||
|
||||
private static final Random rand = new Random();
|
||||
@ -1944,6 +1945,16 @@ public class CraftWorld implements World {
|
||||
world.ticksPerWaterSpawns = ticksPerWaterSpawns;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTicksPerWaterAmbientSpawns() {
|
||||
return world.ticksPerWaterAmbientSpawns;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTicksPerWaterAmbientSpawns(int ticksPerWaterAmbientSpawns) {
|
||||
world.ticksPerWaterAmbientSpawns = ticksPerWaterAmbientSpawns;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTicksPerAmbientSpawns() {
|
||||
return world.ticksPerAmbientSpawns;
|
||||
@ -2016,6 +2027,20 @@ public class CraftWorld implements World {
|
||||
waterAnimalSpawn = limit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWaterAmbientSpawnLimit() {
|
||||
if (waterAmbientSpawn < 0) {
|
||||
return server.getWaterAmbientSpawnLimit();
|
||||
}
|
||||
|
||||
return waterAmbientSpawn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWaterAmbientSpawnLimit(int limit) {
|
||||
waterAmbientSpawn = limit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAmbientSpawnLimit() {
|
||||
if (ambientSpawn < 0) {
|
||||
|
@ -27,6 +27,7 @@ spawn-limits:
|
||||
monsters: 70
|
||||
animals: 10
|
||||
water-animals: 15
|
||||
water-ambient: 20
|
||||
ambient: 15
|
||||
chunk-gc:
|
||||
period-in-ticks: 600
|
||||
@ -34,6 +35,7 @@ ticks-per:
|
||||
animal-spawns: 400
|
||||
monster-spawns: 1
|
||||
water-spawns: 1
|
||||
water-ambient-spawns: 1
|
||||
ambient-spawns: 1
|
||||
autosave: 6000
|
||||
aliases: now-in-commands.yml
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren