@Override public boolean onBlockActivated( World world, int posX, int posY, int posZ, EntityPlayer player, int side, float blockX, float blockY, float blockZ) { TileEntity tileEntity = world.getTileEntity(posX, posY, posZ); if (tileEntity != null && tileEntity instanceof TileEntityLocker) { TileEntityLocker tileEntityLocker = (TileEntityLocker) tileEntity; if (!player.isSneaking()) { tileEntityLocker.openGui(player); } else { tileEntityLocker.setOpen(!tileEntityLocker.isOpen()); } } return true; }
@Override public void onBlockPlacedBy( World world, int posX, int posY, int posZ, EntityLivingBase placer, ItemStack itemstack) { TileEntity tile = world.getTileEntity(posX, posY, posZ); if (tile != null && tile instanceof TileEntityLocker && placer != null) { TileEntityLocker locker = (TileEntityLocker) tile; locker.setDirection(getFacing(placer)); } }
@Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int posX, int posY, int posZ) { TileEntity tile = world.getTileEntity(posX, posY, posZ); if (tile != null) { TileEntityLocker locker = (TileEntityLocker) tile; return locker.isOpen() ? null : super.getCollisionBoundingBoxFromPool(world, posX, posY, posZ); } return super.getCollisionBoundingBoxFromPool(world, posX, posY, posZ); }