diff options
author | md_5 <git@md-5.net> | 2015-01-05 10:05:01 +1100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2015-01-05 10:05:01 +1100 |
commit | dde25d45ef12b9909279a4944856823c6461320f (patch) | |
tree | 13917d536bcd512902b3dcf80777c90226d4c612 | |
parent | c99cdafd3f534ef0e9c5eebba27ecfc7c91025d4 (diff) | |
download | craftbukkit-dde25d45ef12b9909279a4944856823c6461320f.tar craftbukkit-dde25d45ef12b9909279a4944856823c6461320f.tar.gz craftbukkit-dde25d45ef12b9909279a4944856823c6461320f.tar.lz craftbukkit-dde25d45ef12b9909279a4944856823c6461320f.tar.xz craftbukkit-dde25d45ef12b9909279a4944856823c6461320f.zip |
SPIGOT-323: Allow force creating enchant table containers. Usefullness is not guaranteed.
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java index f045e1c7..0e841856 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -294,7 +294,14 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { if (location == null) { location = getLocation(); } - getHandle().openTileEntity((ITileEntityContainer) getHandle().world.getTileEntity(new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()))); + + // If there isn't an enchant table we can force create one, won't be very useful though. + TileEntity container = getHandle().world.getTileEntity(new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ())); + if (container == null && force) { + container = new TileEntityEnchantTable(); + } + getHandle().openTileEntity((ITileEntityContainer) container); + if (force) { getHandle().activeContainer.checkReachable = false; } |