diff options
author | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-09-18 00:03:58 +0100 |
---|---|---|
committer | Erik Broes <erikbroes@grum.nl> | 2011-09-18 11:19:03 +0200 |
commit | 65052c8a59ecfdf927e5bbfe4257c7a7c90e55e4 (patch) | |
tree | 5da9d9e68b6e26b3b6b59705fd5de221fd94d916 /src/main/java/net/minecraft | |
parent | 3f4ee9ab563b38d69a596b556bfd1989f8c7b7b2 (diff) | |
download | craftbukkit-65052c8a59ecfdf927e5bbfe4257c7a7c90e55e4.tar craftbukkit-65052c8a59ecfdf927e5bbfe4257c7a7c90e55e4.tar.gz craftbukkit-65052c8a59ecfdf927e5bbfe4257c7a7c90e55e4.tar.lz craftbukkit-65052c8a59ecfdf927e5bbfe4257c7a7c90e55e4.tar.xz craftbukkit-65052c8a59ecfdf927e5bbfe4257c7a7c90e55e4.zip |
Workaround for crash when chests mix up with furnaces - need to investigate cause
Diffstat (limited to 'src/main/java/net/minecraft')
-rw-r--r-- | src/main/java/net/minecraft/server/TileEntityChest.java | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java index e5761b05..4e03b295 100644 --- a/src/main/java/net/minecraft/server/TileEntityChest.java +++ b/src/main/java/net/minecraft/server/TileEntityChest.java @@ -119,19 +119,19 @@ public class TileEntityChest extends TileEntity implements IInventory { this.d = null; this.e = null; if (this.world.getTypeId(this.x - 1, this.y, this.z) == Block.CHEST.id) { - this.d = (TileEntityChest) this.world.getTileEntity(this.x - 1, this.y, this.z); + this.d = getTileEntity(this.x - 1, this.y, this.z); // CraftBukkit } if (this.world.getTypeId(this.x + 1, this.y, this.z) == Block.CHEST.id) { - this.c = (TileEntityChest) this.world.getTileEntity(this.x + 1, this.y, this.z); + this.c = getTileEntity(this.x + 1, this.y, this.z); // CraftBukkit } if (this.world.getTypeId(this.x, this.y, this.z - 1) == Block.CHEST.id) { - this.b = (TileEntityChest) this.world.getTileEntity(this.x, this.y, this.z - 1); + this.b = getTileEntity(this.x, this.y, this.z - 1); // CraftBukkit } if (this.world.getTypeId(this.x, this.y, this.z + 1) == Block.CHEST.id) { - this.e = (TileEntityChest) this.world.getTileEntity(this.x, this.y, this.z + 1); + this.e = getTileEntity(this.x, this.y, this.z + 1); // CraftBukkit } if (this.b != null) { @@ -152,6 +152,19 @@ public class TileEntityChest extends TileEntity implements IInventory { } } + // CraftBukkit start + private TileEntityChest getTileEntity(int x, int y, int z) { + TileEntity entity = this.world.getTileEntity(x, y, z); + + if (entity instanceof TileEntityChest) { + return (TileEntityChest)entity; + } else { + world.getServer().getLogger().severe("Block at " + x + "," + y + "," + z + " is a chest but has a " + entity.getClass().getName()); + return null; + } + } + // CraftBukkit end + public void h_() { super.h_(); this.h(); |