geforkt von Mirrors/Paper
Added configurable animal and monster ticks per spawn setting.
Dieser Commit ist enthalten in:
Ursprung
c38fcb360a
Commit
63b9ed9ab4
@ -77,6 +77,8 @@ public class World implements IBlockAccess {
|
|||||||
public boolean allowMonsters; // CraftBukkit - private -> public
|
public boolean allowMonsters; // CraftBukkit - private -> public
|
||||||
public boolean allowAnimals; // CraftBukkit - private -> public
|
public boolean allowAnimals; // CraftBukkit - private -> public
|
||||||
private LongHashset chunkTickList; // CraftBukkit
|
private LongHashset chunkTickList; // CraftBukkit
|
||||||
|
public long ticksPerAnimalSpawns; // CraftBukkit
|
||||||
|
public long ticksPerMonsterSpawns; // CraftBukkit
|
||||||
private int U;
|
private int U;
|
||||||
int[] H;
|
int[] H;
|
||||||
private List V;
|
private List V;
|
||||||
@ -148,6 +150,8 @@ public class World implements IBlockAccess {
|
|||||||
this.allowMonsters = true;
|
this.allowMonsters = true;
|
||||||
this.allowAnimals = true;
|
this.allowAnimals = true;
|
||||||
this.chunkTickList = new LongHashset(); // CraftBukkit
|
this.chunkTickList = new LongHashset(); // CraftBukkit
|
||||||
|
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
|
||||||
|
this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit
|
||||||
this.U = this.random.nextInt(12000);
|
this.U = this.random.nextInt(12000);
|
||||||
this.H = new int['\u8000'];
|
this.H = new int['\u8000'];
|
||||||
this.V = new ArrayList();
|
this.V = new ArrayList();
|
||||||
@ -1722,8 +1726,9 @@ public class World implements IBlockAccess {
|
|||||||
|
|
||||||
// MethodProfiler.a("mobSpawner"); // CraftBukkit - not in production code
|
// MethodProfiler.a("mobSpawner"); // CraftBukkit - not in production code
|
||||||
// CraftBukkit start - Only call spawner if we have players online and the world allows for mobs or animals
|
// CraftBukkit start - Only call spawner if we have players online and the world allows for mobs or animals
|
||||||
|
long time = this.worldData.getTime();
|
||||||
if ((this.allowMonsters || this.allowAnimals) && (this instanceof WorldServer && this.getServer().getHandle().players.size() > 0)) {
|
if ((this.allowMonsters || this.allowAnimals) && (this instanceof WorldServer && this.getServer().getHandle().players.size() > 0)) {
|
||||||
SpawnerCreature.spawnEntities(this, this.allowMonsters, this.allowAnimals && this.worldData.getTime() % 400L == 0L);
|
SpawnerCreature.spawnEntities(this, this.allowMonsters && (this.ticksPerMonsterSpawns != 0 && time % this.ticksPerMonsterSpawns == 0L), this.allowAnimals && (this.ticksPerAnimalSpawns != 0 && time % this.ticksPerAnimalSpawns == 0L));
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
// MethodProfiler.b("chunkSource"); // CraftBukkit - not in production code
|
// MethodProfiler.b("chunkSource"); // CraftBukkit - not in production code
|
||||||
|
@ -357,6 +357,14 @@ public final class CraftServer implements Server {
|
|||||||
return this.configuration.getInt("settings.ping-packet-limit", 100);
|
return this.configuration.getInt("settings.ping-packet-limit", 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getTicksPerAnimalSpawns() {
|
||||||
|
return this.configuration.getInt("ticks-per.animal-spawns");
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTicksPerMonsterSpawns() {
|
||||||
|
return this.configuration.getInt("ticks-per.monster-spawns");
|
||||||
|
}
|
||||||
|
|
||||||
public PluginManager getPluginManager() {
|
public PluginManager getPluginManager() {
|
||||||
return pluginManager;
|
return pluginManager;
|
||||||
}
|
}
|
||||||
@ -410,6 +418,17 @@ public final class CraftServer implements Server {
|
|||||||
for (WorldServer world : console.worlds) {
|
for (WorldServer world : console.worlds) {
|
||||||
world.difficulty = difficulty;
|
world.difficulty = difficulty;
|
||||||
world.setSpawnFlags(monsters, animals);
|
world.setSpawnFlags(monsters, animals);
|
||||||
|
if (this.getTicksPerAnimalSpawns() < 0) {
|
||||||
|
world.ticksPerAnimalSpawns = 400;
|
||||||
|
} else {
|
||||||
|
world.ticksPerAnimalSpawns = this.getTicksPerAnimalSpawns();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.getTicksPerMonsterSpawns() < 0) {
|
||||||
|
world.ticksPerMonsterSpawns = 1;
|
||||||
|
} else {
|
||||||
|
world.ticksPerMonsterSpawns = this.getTicksPerMonsterSpawns();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pluginManager.clearPlugins();
|
pluginManager.clearPlugins();
|
||||||
|
@ -982,4 +982,20 @@ public class CraftWorld implements World {
|
|||||||
public boolean canGenerateStructures() {
|
public boolean canGenerateStructures() {
|
||||||
return world.getWorldData().o();
|
return world.getWorldData().o();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getTicksPerAnimalSpawns() {
|
||||||
|
return world.ticksPerAnimalSpawns;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTicksPerAnimalSpawns(int ticksPerAnimalSpawns) {
|
||||||
|
world.ticksPerAnimalSpawns = ticksPerAnimalSpawns;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getTicksPerMonsterSpawns() {
|
||||||
|
return world.ticksPerMonsterSpawns;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTicksPerMonsterSpawns(int ticksPerMonsterSpawns) {
|
||||||
|
world.ticksPerMonsterSpawns = ticksPerMonsterSpawns;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,9 @@ settings:
|
|||||||
update-folder: update
|
update-folder: update
|
||||||
ping-packet-limit: 100
|
ping-packet-limit: 100
|
||||||
use-exact-login-location: false
|
use-exact-login-location: false
|
||||||
|
ticks-per:
|
||||||
|
animal-spawns: 400
|
||||||
|
monster-spawns: 1
|
||||||
aliases:
|
aliases:
|
||||||
icanhasbukkit:
|
icanhasbukkit:
|
||||||
- version
|
- version
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren