public boolean onBlockActivated( World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if (!world.isRemote) { DMPedestalTile tile = ((DMPedestalTile) world.getTileEntity(x, y, z)); if (player.isSneaking()) { player.openGui(PECore.instance, Constants.PEDESTAL_GUI, world, x, y, z); } else { if (tile.getItemStack() != null && tile.getItemStack().getItem() instanceof IPedestalItem) { tile.setActive(!tile.getActive()); } PELogger.logDebug("Pedestal: " + (tile.getActive() ? "ON" : "OFF")); } PacketHandler.sendToAllAround( new ClientSyncPedestalPKT(tile), new NetworkRegistry.TargetPoint(world.provider.dimensionId, x, y, z, 32)); } return true; }
public void breakBlock(World world, int x, int y, int z, Block block, int meta) { DMPedestalTile tile = ((DMPedestalTile) world.getTileEntity(x, y, z)); if (tile.getItemStack() != null) { WorldHelper.spawnEntityItem(world, tile.getItemStack().copy(), x, y, z); } tile.invalidate(); super.breakBlock(world, x, y, z, block, meta); }