SPIGOT-323: Allow force creating enchant table containers. Usefullness is not guaranteed.

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2015-01-05 10:05:01 +11:00
parent 2b9c73b324
commit 4b61c24b36

View File

@ -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;
}