Archiviert
13
0

Make the spawning listen to the server spawn-settings

Dieser Commit ist enthalten in:
Erik Broes 2011-02-13 01:21:50 +01:00
Ursprung f789c9e744
Commit 40f7986a11
4 geänderte Dateien mit 25 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -245,10 +245,14 @@ public class EntityEgg extends Entity {
break; break;
} }
// The world we're spawning in accepts this creature
boolean isAnimal = entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal;
if ((isAnimal && this.world.L) || (!isAnimal && this.world.K)) {
entity.c(this.locX, this.locY, this.locZ, this.yaw, 0.0F); entity.c(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
this.world.a(entity); this.world.a(entity);
} }
} }
}
// CraftBukkit end // CraftBukkit end
for (int l = 0; l < 8; ++l) { for (int l = 0; l < 8; ++l) {

Datei anzeigen

@ -49,6 +49,13 @@ public class TileEntityMobSpawner extends TileEntity {
return; return;
} }
// CraftBukkit start - The world we're spawning in accepts this creature
boolean isAnimal = entityliving instanceof EntityAnimal || entityliving instanceof EntityWaterAnimal;
if ((isAnimal && !this.a.L) || (!isAnimal && !this.a.K)) {
return;
}
// CraftBukkit end
int j = this.a.a(entityliving.getClass(), AxisAlignedBB.b((double) this.b, (double) this.c, (double) this.d, (double) (this.b + 1), (double) (this.c + 1), (double) (this.d + 1)).b(8.0D, 4.0D, 8.0D)).size(); int j = this.a.a(entityliving.getClass(), AxisAlignedBB.b((double) this.b, (double) this.c, (double) this.d, (double) (this.b + 1), (double) (this.c + 1), (double) (this.d + 1)).b(8.0D, 4.0D, 8.0D)).size();
if (j >= 6) { if (j >= 6) {

Datei anzeigen

@ -61,8 +61,8 @@ public class World implements IBlockAccess {
public boolean x; public boolean x;
private ArrayList I = new ArrayList(); private ArrayList I = new ArrayList();
private int J = 0; private int J = 0;
private boolean K = true; public boolean K = true; // CraftBukkit private->public
private boolean L = true; public boolean L = true; // CraftBukkit private->public
static int y = 0; static int y = 0;
private Set M = new HashSet(); private Set M = new HashSet();
private int N; private int N;
@ -1439,7 +1439,11 @@ public class World implements IBlockAccess {
} }
public void f() { public void f() {
// CraftBukkit start -- Only call spawner if we have players online and the world allows for mobs or animals
if ((this.K || this.L) && (this instanceof WorldServer && ((WorldServer) this).getServer().getHandle().b.size() > 0))
SpawnerCreature.a(this, this.K, this.L); SpawnerCreature.a(this, this.K, this.L);
// CraftBukkit end
this.G.a(); this.G.a();
int i = this.a(1.0F); int i = this.a(1.0F);

Datei anzeigen

@ -47,9 +47,11 @@ public class WorldServer extends World implements BlockChangeDelegate {
} }
public void a(Entity entity, boolean flag) { public void a(Entity entity, boolean flag) {
if (!this.D.m && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) { // CraftBukkit start -- We prevent spawning in general, so this butching is not needed
entity.q(); //if (!this.D.m && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
} // entity.q();
//}
// CraftBukkit end
if (entity.passenger == null || !(entity.passenger instanceof EntityHuman)) { if (entity.passenger == null || !(entity.passenger instanceof EntityHuman)) {
super.a(entity, flag); super.a(entity, flag);