3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-17 13:30:06 +01:00

Fixed allow-animals not applying to chunk generation.

Moved the legitimacy checking into World.addEntity for better organisation and to better account for future methods being added that control whether or not an entity should spawn.
Dieser Commit ist enthalten in:
EvilSeph 2011-09-19 22:53:36 -04:00
Ursprung d01a3acd82
Commit 167febd8e6
3 geänderte Dateien mit 9 neuen und 13 gelöschten Zeilen

Datei anzeigen

@ -249,12 +249,8 @@ public class EntityEgg extends Entity {
break; break;
} }
// The world we're spawning in accepts this creature entity.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
boolean isAnimal = entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal; this.world.addEntity(entity, SpawnReason.EGG);
if ((isAnimal && this.world.allowAnimals) || (!isAnimal && this.world.allowMonsters)) {
entity.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
this.world.addEntity(entity, SpawnReason.EGG);
}
// CraftBukkit end // CraftBukkit end
} }
} }

Datei anzeigen

@ -54,13 +54,6 @@ 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.world.allowAnimals) || (!isAnimal && !this.world.allowMonsters)) {
return;
}
// CraftBukkit end
int j = this.world.a(entityliving.getClass(), AxisAlignedBB.b((double) this.x, (double) this.y, (double) this.z, (double) (this.x + 1), (double) (this.y + 1), (double) (this.z + 1)).b(8.0D, 4.0D, 8.0D)).size(); int j = this.world.a(entityliving.getClass(), AxisAlignedBB.b((double) this.x, (double) this.y, (double) this.z, (double) (this.x + 1), (double) (this.y + 1), (double) (this.z + 1)).b(8.0D, 4.0D, 8.0D)).size();
if (j >= 6) { if (j >= 6) {

Datei anzeigen

@ -839,6 +839,13 @@ public class World implements IBlockAccess {
// CraftBukkit start // CraftBukkit start
if (entity instanceof EntityLiving && !(entity instanceof EntityPlayer)) { if (entity instanceof EntityLiving && !(entity instanceof EntityPlayer)) {
boolean isAnimal = entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal;
boolean isMonster = entity instanceof EntityMonster || entity instanceof EntityGhast || entity instanceof EntitySlime;
if (spawnReason == SpawnReason.NATURAL || spawnReason == SpawnReason.SPAWNER || spawnReason == SpawnReason.BED || spawnReason == SpawnReason.EGG) {
if (isAnimal && !allowAnimals || isMonster && !allowMonsters) return false;
}
CreatureSpawnEvent event = CraftEventFactory.callCreatureSpawnEvent((EntityLiving) entity, spawnReason); CreatureSpawnEvent event = CraftEventFactory.callCreatureSpawnEvent((EntityLiving) entity, spawnReason);
if (event.isCancelled()) { if (event.isCancelled()) {