summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEvilSeph <evilseph@gmail.com>2011-09-19 22:53:36 -0400
committerEvilSeph <evilseph@gmail.com>2011-09-20 01:20:05 -0400
commit167febd8e69d3e53f584f0a3d39e02dec2353bc5 (patch)
treeb86b217572af2888712960fcec558fb5768da59e /src
parentd01a3acd827201aad5be65a557725ab6ce465221 (diff)
downloadcraftbukkit-167febd8e69d3e53f584f0a3d39e02dec2353bc5.tar
craftbukkit-167febd8e69d3e53f584f0a3d39e02dec2353bc5.tar.gz
craftbukkit-167febd8e69d3e53f584f0a3d39e02dec2353bc5.tar.lz
craftbukkit-167febd8e69d3e53f584f0a3d39e02dec2353bc5.tar.xz
craftbukkit-167febd8e69d3e53f584f0a3d39e02dec2353bc5.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/net/minecraft/server/EntityEgg.java8
-rw-r--r--src/main/java/net/minecraft/server/TileEntityMobSpawner.java7
-rw-r--r--src/main/java/net/minecraft/server/World.java7
3 files changed, 9 insertions, 13 deletions
diff --git a/src/main/java/net/minecraft/server/EntityEgg.java b/src/main/java/net/minecraft/server/EntityEgg.java
index 3cf3c43e..5459af4d 100644
--- a/src/main/java/net/minecraft/server/EntityEgg.java
+++ b/src/main/java/net/minecraft/server/EntityEgg.java
@@ -249,12 +249,8 @@ public class EntityEgg extends Entity {
break;
}
- // The world we're spawning in accepts this creature
- boolean isAnimal = entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal;
- 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);
- }
+ entity.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
+ this.world.addEntity(entity, SpawnReason.EGG);
// CraftBukkit end
}
}
diff --git a/src/main/java/net/minecraft/server/TileEntityMobSpawner.java b/src/main/java/net/minecraft/server/TileEntityMobSpawner.java
index a7704187..c40e65bd 100644
--- a/src/main/java/net/minecraft/server/TileEntityMobSpawner.java
+++ b/src/main/java/net/minecraft/server/TileEntityMobSpawner.java
@@ -54,13 +54,6 @@ 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.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();
if (j >= 6) {
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 4814f90d..f4cf254d 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -839,6 +839,13 @@ public class World implements IBlockAccess {
// CraftBukkit start
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);
if (event.isCancelled()) {