@Override @SideOnly(Side.CLIENT) public void addInformation( ItemStack itemStack, EntityPlayer par2EntityPlayer, List list, boolean par4) { list.add( Lang.localize("tile.enderio.blockCapacitorBank.tooltipPrefix", false) + " " + PowerDisplayUtil.formatPower(PowerHandlerUtil.getStoredEnergyForItem(itemStack)) + " " + PowerDisplayUtil.abrevation()); super.addInformation(itemStack, par2EntityPlayer, list, par4); }
@Override public void onBlockPlacedBy( World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) { if (world.isRemote) { return; } TileEntity te = world.getBlockTileEntity(x, y, z); if (te instanceof TileCapacitorBank) { TileCapacitorBank cb = (TileCapacitorBank) te; cb.addEnergy(PowerHandlerUtil.getStoredEnergyForItem(stack)); } world.markBlockForUpdate(x, y, z); }
public static ItemStack createItemStackWithPower(float storedEnergy) { ItemStack res = new ItemStack(EnderIO.blockCapacitorBank); PowerHandlerUtil.setStoredEnergyForItem(res, storedEnergy); return res; }