Search in sources :

Example 1 with BlockTileGC

use of micdoodle8.mods.galacticraft.core.blocks.BlockTileGC 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"));
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileBaseElectricBlock(micdoodle8.mods.galacticraft.core.energy.tile.TileBaseElectricBlock) IBlockDescription(stevekung.mods.moreplanets.util.blocks.IBlockDescription) BlockTileGC(micdoodle8.mods.galacticraft.core.blocks.BlockTileGC) TileEntityDarkEnergyGenerator(stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDarkEnergyGenerator) BlockAdvancedTile(micdoodle8.mods.galacticraft.core.blocks.BlockAdvancedTile) TileBaseUniversalElectrical(micdoodle8.mods.galacticraft.core.energy.tile.TileBaseUniversalElectrical) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with BlockTileGC

use of micdoodle8.mods.galacticraft.core.blocks.BlockTileGC 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"));
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileBaseElectricBlock(micdoodle8.mods.galacticraft.core.energy.tile.TileBaseElectricBlock) IBlockDescription(stevekung.mods.moreplanets.util.blocks.IBlockDescription) BlockTileGC(micdoodle8.mods.galacticraft.core.blocks.BlockTileGC) BlockAdvancedTile(micdoodle8.mods.galacticraft.core.blocks.BlockAdvancedTile) TileBaseUniversalElectrical(micdoodle8.mods.galacticraft.core.energy.tile.TileBaseUniversalElectrical) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

BlockAdvancedTile (micdoodle8.mods.galacticraft.core.blocks.BlockAdvancedTile)2 BlockTileGC (micdoodle8.mods.galacticraft.core.blocks.BlockTileGC)2 TileBaseElectricBlock (micdoodle8.mods.galacticraft.core.energy.tile.TileBaseElectricBlock)2 TileBaseUniversalElectrical (micdoodle8.mods.galacticraft.core.energy.tile.TileBaseUniversalElectrical)2 TileEntity (net.minecraft.tileentity.TileEntity)2 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)2 IBlockDescription (stevekung.mods.moreplanets.util.blocks.IBlockDescription)2 TileEntityDarkEnergyGenerator (stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDarkEnergyGenerator)1