use of micdoodle8.mods.galacticraft.core.blocks.BlockAdvancedTile in project MorePlanets by SteveKunG.
the class ItemBlockDarkEnergyGenerator method addInformation.
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemStack, @Nullable World world, List<String> list, ITooltipFlag flag) {
if (this.getBlock() instanceof IBlockDescription) {
if (CommonRegisterHelper.isShiftKeyDown()) {
((IBlockDescription) this.block).getDescription().addDescription(itemStack, list);
} else {
if (this.getBlock() instanceof BlockTileGC) {
TileEntity te = ((BlockTileGC) this.getBlock()).createTileEntity(null, this.getBlock().getStateFromMeta(itemStack.getItemDamage() & 12));
if (te instanceof TileBaseElectricBlock) {
float powerDrawn = ((TileBaseElectricBlock) te).storage.getMaxExtract();
if (powerDrawn > 0) {
list.add(TextFormatting.GREEN + GCCoreUtil.translateWithFormat("item_desc.powerdraw.name", EnergyDisplayHelper.getEnergyDisplayS(powerDrawn * 20)));
}
}
if (te instanceof TileBaseUniversalElectrical) {
if (itemStack.hasTagCompound() && itemStack.getTagCompound().hasKey("EnergyStored")) {
int power = (int) itemStack.getTagCompound().getFloat("EnergyStored");
list.add(TextFormatting.GREEN + GCCoreUtil.translateWithFormat("desc.energy_stored.name", EnergyDisplayHelper.getEnergyDisplayS(power)));
}
}
if (te instanceof TileEntityDarkEnergyGenerator) {
if (itemStack.hasTagCompound() && itemStack.getTagCompound().hasKey("DarkEnergyFuel")) {
int power = itemStack.getTagCompound().getInteger("DarkEnergyFuel");
power = power * 100 / 1000;
list.add(TextFormatting.GREEN + GCCoreUtil.translateWithFormat("desc.dark_energy_fuel.name", power) + "%");
}
}
} else if (this.getBlock() instanceof BlockAdvancedTile) {
TileEntity te = ((BlockAdvancedTile) this.getBlock()).createTileEntity(world, this.getBlock().getStateFromMeta(itemStack.getItemDamage() & 12));
if (te instanceof TileBaseElectricBlock) {
float powerDrawn = ((TileBaseElectricBlock) te).storage.getMaxExtract();
if (powerDrawn > 0) {
list.add(TextFormatting.GREEN + GCCoreUtil.translateWithFormat("item_desc.powerdraw.name", EnergyDisplayHelper.getEnergyDisplayS(powerDrawn * 20)));
}
}
}
list.add(GCCoreUtil.translate("desc.shift_info.name"));
}
}
}
use of micdoodle8.mods.galacticraft.core.blocks.BlockAdvancedTile in project MorePlanets by SteveKunG.
the class ItemBlockDescription method addInformation.
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemStack, @Nullable World world, List<String> list, ITooltipFlag flag) {
if (this.getBlock() instanceof IBlockDescription) {
if (CommonRegisterHelper.isShiftKeyDown()) {
((IBlockDescription) this.block).getDescription().addDescription(itemStack, list);
} else {
if (this.getBlock() instanceof BlockTileGC) {
TileEntity te = ((BlockTileGC) this.getBlock()).createTileEntity(null, this.getBlock().getStateFromMeta(itemStack.getItemDamage() & 12));
if (te instanceof TileBaseElectricBlock) {
float powerDrawn = ((TileBaseElectricBlock) te).storage.getMaxExtract();
if (powerDrawn > 0) {
list.add(TextFormatting.GREEN + GCCoreUtil.translateWithFormat("item_desc.powerdraw.name", EnergyDisplayHelper.getEnergyDisplayS(powerDrawn * 20)));
}
}
if (te instanceof TileBaseUniversalElectrical) {
if (itemStack.hasTagCompound() && itemStack.getTagCompound().hasKey("EnergyStored")) {
int power = (int) itemStack.getTagCompound().getFloat("EnergyStored");
list.add(TextFormatting.GREEN + GCCoreUtil.translateWithFormat("desc.energy_stored.name", EnergyDisplayHelper.getEnergyDisplayS(power)));
}
}
} else if (this.getBlock() instanceof BlockAdvancedTile) {
TileEntity te = ((BlockAdvancedTile) this.getBlock()).createTileEntity(world, this.getBlock().getStateFromMeta(itemStack.getItemDamage() & 12));
if (te instanceof TileBaseElectricBlock) {
float powerDrawn = ((TileBaseElectricBlock) te).storage.getMaxExtract();
if (powerDrawn > 0) {
list.add(TextFormatting.GREEN + GCCoreUtil.translateWithFormat("item_desc.powerdraw.name", EnergyDisplayHelper.getEnergyDisplayS(powerDrawn * 20)));
}
}
}
list.add(GCCoreUtil.translate("desc.shift_info.name"));
}
}
}
Aggregations