mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 13:07:06 +01:00
Make the spawning listen to the server spawn-settings
This commit is contained in:
parent
f789c9e744
commit
40f7986a11
4 changed files with 25 additions and 8 deletions
|
@ -245,8 +245,12 @@ public class EntityEgg extends Entity {
|
|||
break;
|
||||
}
|
||||
|
||||
entity.c(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
|
||||
this.world.a(entity);
|
||||
// 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);
|
||||
this.world.a(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
|
|
@ -49,6 +49,13 @@ public class TileEntityMobSpawner extends TileEntity {
|
|||
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();
|
||||
|
||||
if (j >= 6) {
|
||||
|
|
|
@ -61,8 +61,8 @@ public class World implements IBlockAccess {
|
|||
public boolean x;
|
||||
private ArrayList I = new ArrayList();
|
||||
private int J = 0;
|
||||
private boolean K = true;
|
||||
private boolean L = true;
|
||||
public boolean K = true; // CraftBukkit private->public
|
||||
public boolean L = true; // CraftBukkit private->public
|
||||
static int y = 0;
|
||||
private Set M = new HashSet();
|
||||
private int N;
|
||||
|
@ -1439,7 +1439,11 @@ public class World implements IBlockAccess {
|
|||
}
|
||||
|
||||
public void f() {
|
||||
SpawnerCreature.a(this, this.K, this.L);
|
||||
// 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);
|
||||
// CraftBukkit end
|
||||
|
||||
this.G.a();
|
||||
int i = this.a(1.0F);
|
||||
|
||||
|
|
|
@ -47,9 +47,11 @@ public class WorldServer extends World implements BlockChangeDelegate {
|
|||
}
|
||||
|
||||
public void a(Entity entity, boolean flag) {
|
||||
if (!this.D.m && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
|
||||
entity.q();
|
||||
}
|
||||
// CraftBukkit start -- We prevent spawning in general, so this butching is not needed
|
||||
//if (!this.D.m && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
|
||||
// entity.q();
|
||||
//}
|
||||
// CraftBukkit end
|
||||
|
||||
if (entity.passenger == null || !(entity.passenger instanceof EntityHuman)) {
|
||||
super.a(entity, flag);
|
||||
|
|
Loading…
Reference in a new issue