summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNathan Adams <dinnerbone@dinnerbone.com>2011-12-11 15:59:55 +0000
committerNathan Adams <dinnerbone@dinnerbone.com>2011-12-11 15:59:55 +0000
commit1fc8092ea69b0eb59a2f01da07eb5e0bd67d5542 (patch)
treec0eeb0fd8a505e965075a4851bf1bbf1bc2f193a /src
parent88d1512507664f41d7f164fb10a21a851f5ca8d7 (diff)
downloadcraftbukkit-1fc8092ea69b0eb59a2f01da07eb5e0bd67d5542.tar
craftbukkit-1fc8092ea69b0eb59a2f01da07eb5e0bd67d5542.tar.gz
craftbukkit-1fc8092ea69b0eb59a2f01da07eb5e0bd67d5542.tar.lz
craftbukkit-1fc8092ea69b0eb59a2f01da07eb5e0bd67d5542.tar.xz
craftbukkit-1fc8092ea69b0eb59a2f01da07eb5e0bd67d5542.zip
Fixed corrupt mob spawners crashing on load - this fixes BUKKIT-69, BUKKIT-144
Diffstat (limited to 'src')
-rw-r--r--src/main/java/net/minecraft/server/TileEntityMobSpawner.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/TileEntityMobSpawner.java b/src/main/java/net/minecraft/server/TileEntityMobSpawner.java
index 7b499ebc..40acc4d8 100644
--- a/src/main/java/net/minecraft/server/TileEntityMobSpawner.java
+++ b/src/main/java/net/minecraft/server/TileEntityMobSpawner.java
@@ -48,11 +48,20 @@ public class TileEntityMobSpawner extends TileEntity {
byte b0 = 4;
for (int i = 0; i < b0; ++i) {
- EntityLiving entityliving = (EntityLiving) ((EntityLiving) EntityTypes.a(this.mobName, this.world));
+ // CraftBukkit start - bad entity detection
+ Entity mob = EntityTypes.a(this.mobName, this.world);
+
+ if (!(mob instanceof EntityLiving)) {
+ mobName = "Pig";
+ return;
+ }
+
+ EntityLiving entityliving = (EntityLiving) ((EntityLiving) mob);
if (entityliving == null) {
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();