Search in sources :

Example 1 with TileEntityDarkEnergyCore

use of stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDarkEnergyCore in project MorePlanets by SteveKunG.

the class WailaTileEntityProviderMP method getWailaHead.

@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> tooltip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
    TileEntity tile = accessor.getTileEntity();
    Block block = accessor.getBlock();
    IBlockState state = accessor.getBlockState();
    NBTTagCompound nbt = accessor.getNBTData();
    if (nbt.hasKey("EnergyF") && !(block == MPBlocks.DUMMY_BLOCK && (state.getValue(BlockDummy.VARIANT) == BlockDummy.BlockType.NUCLEAR_WASTE_TANK_MIDDLE || state.getValue(BlockDummy.VARIANT) == BlockDummy.BlockType.NUCLEAR_WASTE_TANK_TOP))) {
        tooltip.add(TextFormatting.GREEN + GCCoreUtil.translate("gui.message.energy") + ": " + EnergyDisplayHelper.getEnergyDisplayS(nbt.getFloat("EnergyF")));
    }
    // block
    if (block == MPBlocks.DUMMY_BLOCK) {
        BlockDummy.BlockType type = state.getValue(BlockDummy.VARIANT);
        if (type == BlockDummy.BlockType.DARK_ENERGY_SOLAR1 || type == BlockDummy.BlockType.DARK_ENERGY_SOLAR2 || type == BlockDummy.BlockType.DARK_ENERGY_SOLAR3 || type == BlockDummy.BlockType.DARK_ENERGY_SOLAR4) {
            int process = nbt.getInteger("ActivatedTick") * 100 / 12000;
            int destruct = nbt.getInteger("FailedTick");
            if (destruct > 0) {
                destruct = 600 - destruct;
                tooltip.add(TextFormatting.DARK_RED + GCCoreUtil.translate("gui.status.destruct.name") + ": " + CommonRegisterHelper.ticksToElapsedTime(destruct));
            } else {
                tooltip.add(GCCoreUtil.translate("gui.message.status.name") + ": " + nbt.getString("Status"));
            }
            if (process > 0 && process < 100) {
                tooltip.add("Process: " + process + "%");
            }
        }
        if (type == BlockDummy.BlockType.WARP_PAD) {
            if (tile instanceof TileEntityDummy) {
                TileEntityDummy dummy = (TileEntityDummy) tile;
                TileEntitySpaceWarpPadFull warp = (TileEntitySpaceWarpPadFull) accessor.getWorld().getTileEntity(dummy.mainBlockPosition);
                String dimension = GCCoreUtil.translate("gui.status.unknown.name");
                String name = GCCoreUtil.translate("gui.status.unknown.name");
                String dest = GCCoreUtil.translate("gui.status.unknown.name");
                if (warp.hasWarpCore() && warp.containingItems.get(1).hasTagCompound()) {
                    NBTTagCompound compound = warp.containingItems.get(1).getTagCompound();
                    dimension = String.valueOf(compound.getInteger("DimensionID"));
                    name = WorldUtil.getProviderForDimensionClient(compound.getInteger("DimensionID")).getDimensionType().getName();
                    dest = compound.getInteger("X") + " " + compound.getInteger("Y") + " " + compound.getInteger("Z");
                }
                tooltip.add(GCCoreUtil.translate("gui.status.dimension.name") + ": " + dimension + " ");
                tooltip.add(GCCoreUtil.translate("gui.status.name.name") + ": " + name);
                tooltip.add(GCCoreUtil.translate("gui.status.destination.name") + ": " + dest);
            }
        }
        if (type == BlockDummy.BlockType.SHIELD_GENERATOR_TOP) {
            int chargeCooldown = nbt.getInteger("ShieldChargeCooldown");
            tooltip.add(GCCoreUtil.translate("gui.message.status.name") + ": " + nbt.getString("Status"));
            tooltip.add(GCCoreUtil.translate("gui.status.shield_damage.name") + ": " + nbt.getInteger("ShieldDamage"));
            tooltip.add(GCCoreUtil.translate("gui.status.shield_size.name") + ": " + nbt.getInteger("MaxShieldSize"));
            tooltip.add(GCCoreUtil.translate("gui.status.shield_capacity.name") + ": " + nbt.getInteger("ShieldCapacity") + "/" + nbt.getInteger("MaxShieldCapacity"));
            if (chargeCooldown > 0) {
                tooltip.add(GCCoreUtil.translate("gui.status.shield_charge_cooldown.name") + ": " + chargeCooldown / 20);
            }
        }
    }
    // tile
    if (tile instanceof TileEntityDarkEnergyReceiver) {
        int process = nbt.getInteger("ActivatedTick") * 100 / 12000;
        int destruct = nbt.getInteger("FailedTick");
        if (destruct > 0) {
            destruct = 600 - destruct;
            tooltip.add(TextFormatting.DARK_RED + GCCoreUtil.translate("gui.status.destruct.name") + ": " + CommonRegisterHelper.ticksToElapsedTime(destruct));
        } else {
            tooltip.add(GCCoreUtil.translate("gui.message.status.name") + ": " + nbt.getString("Status"));
        }
        if (process > 0 && process < 100) {
            tooltip.add(GCCoreUtil.translate("gui.status.process.name") + ": " + process + "%");
        }
    }
    if (tile instanceof TileEntityDarkEnergyCore) {
        int transform = nbt.getInteger("ProduceTime");
        if (transform > 0) {
            tooltip.add(GCCoreUtil.translate("gui.status.transform_time.name") + ": " + CommonRegisterHelper.ticksToElapsedTime(transform));
        }
    }
    if (tile instanceof TileEntityDarkEnergyGenerator) {
        int generateWatts = nbt.getInteger("GenerateWatts");
        int fuel = nbt.getInteger("DarkEnergyFuel");
        tooltip.add(GCCoreUtil.translate("gui.message.generating.name") + ": " + (generateWatts > 0 ? EnergyDisplayHelper.getEnergyDisplayS(generateWatts) + "/t" : GCCoreUtil.translate("gui.status.not_generating.name")));
        tooltip.add(GCCoreUtil.translate("gui.status.dark_energy_fuel.name") + ": " + (fuel > 0 ? String.valueOf(fuel * 100 / 1000) + "%" : TextFormatting.GOLD + GCCoreUtil.translate("gui.status.empty.name")));
    }
    if (tile instanceof TileEntitySpaceWarpPadFull) {
        TileEntitySpaceWarpPadFull warp = (TileEntitySpaceWarpPadFull) tile;
        String dimension = GCCoreUtil.translate("gui.status.unknown.name");
        String name = GCCoreUtil.translate("gui.status.unknown.name");
        String dest = GCCoreUtil.translate("gui.status.unknown.name");
        if (warp.hasWarpCore() && warp.containingItems.get(1).hasTagCompound()) {
            NBTTagCompound compound = warp.containingItems.get(1).getTagCompound();
            dimension = String.valueOf(compound.getInteger("DimensionID"));
            name = WorldUtil.getProviderForDimensionClient(compound.getInteger("DimensionID")).getDimensionType().getName();
            dest = compound.getInteger("X") + " " + compound.getInteger("Y") + " " + compound.getInteger("Z");
        }
        tooltip.add(GCCoreUtil.translate("gui.status.dimension.name") + ": " + dimension + " ");
        tooltip.add(GCCoreUtil.translate("gui.status.name.name") + ": " + name);
        tooltip.add(GCCoreUtil.translate("gui.status.destination.name") + ": " + dest);
    }
    if (tile instanceof TileEntityDarkEnergyStorageCluster || tile instanceof TileEntityNuclearWasteStorageCluster || tile instanceof TileEntityNuclearWasteGenerator) {
        tooltip.add(TextFormatting.GREEN + GCCoreUtil.translate("gui.message.max_energy") + ": " + EnergyDisplayHelper.getEnergyDisplayS(nbt.getFloat("MaxEnergy")));
        tooltip.add(GCCoreUtil.translate("gui.max_output.desc") + ": " + EnergyDisplayHelper.getEnergyDisplayS(nbt.getFloat("MaxOutput")) + "/t");
        if (nbt.hasKey("Status")) {
            tooltip.add(GCCoreUtil.translate("gui.message.status.name") + ": " + nbt.getString("Status"));
        }
    }
    if (tile instanceof TileEntityRocketCrusher) {
        int scale = (int) ((double) nbt.getInteger("ProcessTicks") / (double) nbt.getInteger("ProcessTime") * 100);
        if (scale > 0) {
            tooltip.add(GCCoreUtil.translate("gui.electric_compressor.desc.0") + ": " + scale + "%");
        }
    }
    if (tile instanceof TileEntityBlackHoleStorage) {
        String owner = GCCoreUtil.translate("gui.status.unknown.name");
        String collectMode = nbt.getString("CollectMode").equals("item") ? GCCoreUtil.translate("gui.status.collect_item.name") : nbt.getString("CollectMode").equals("item_and_xp") ? GCCoreUtil.translate("gui.status.collect_item_and_xp.name") : GCCoreUtil.translate("gui.status.collect_xp.name");
        try {
            owner = accessor.getWorld().getPlayerEntityByUUID(UUID.fromString(nbt.getString("OwnerUUID"))).getName();
        } catch (Exception e) {
            owner = "";
        }
        int xp = nbt.hasKey("XpFluid", Constants.NBT.TAG_COMPOUND) ? nbt.getCompoundTag("XpFluid").getInteger("Amount") : 0;
        tooltip.add(GCCoreUtil.translate("gui.status.owner.name") + ": " + owner);
        tooltip.add(GCCoreUtil.translate("gui.status.mode.name") + ": " + collectMode);
        tooltip.add(GCCoreUtil.translate("desc.bhs_xp.name") + ": " + xp + "/" + 1000000);
    }
    if (tile instanceof TileEntityShieldGenerator) {
        int chargeCooldown = nbt.getInteger("ShieldChargeCooldown");
        tooltip.add(GCCoreUtil.translate("gui.message.status.name") + ": " + nbt.getString("Status"));
        tooltip.add(GCCoreUtil.translate("gui.status.shield_damage.name") + ": " + nbt.getInteger("ShieldDamage"));
        tooltip.add(GCCoreUtil.translate("gui.status.shield_size.name") + ": " + nbt.getInteger("MaxShieldSize"));
        tooltip.add(GCCoreUtil.translate("gui.status.shield_capacity.name") + ": " + nbt.getInteger("ShieldCapacity") + "/" + nbt.getInteger("MaxShieldCapacity"));
        if (chargeCooldown > 0) {
            tooltip.add(GCCoreUtil.translate("gui.status.shield_charge_cooldown.name") + ": " + chargeCooldown / 20);
        }
    }
    return tooltip;
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) TileEntityNuclearWasteGenerator(stevekung.mods.moreplanets.module.planets.nibiru.tileentity.TileEntityNuclearWasteGenerator) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) TileEntityDarkEnergyCore(stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDarkEnergyCore) TileEntity(net.minecraft.tileentity.TileEntity) Block(net.minecraft.block.Block) TileEntityDarkEnergyGenerator(stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDarkEnergyGenerator) BlockDummy(stevekung.mods.moreplanets.blocks.BlockDummy)

Example 2 with TileEntityDarkEnergyCore

use of stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDarkEnergyCore in project MorePlanets by SteveKunG.

the class TileEntityItemStackRendererMP method renderByItem.

@Override
public void renderByItem(ItemStack itemStack) {
    Block block = Block.getBlockFromItem(itemStack.getItem());
    if (block == DionaBlocks.DIONA_ANCIENT_CHEST) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityDionaAncientChest());
    } else if (block == DionaBlocks.DIONA_TREASURE_CHEST) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityDionaTreasureChest());
    } else if (block == ChalosBlocks.CHALOS_ANCIENT_CHEST) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityChalosAncientChest());
    } else if (block == ChalosBlocks.CHALOS_TREASURE_CHEST) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityChalosTreasureChest());
    } else if (block == DionaBlocks.ZELIUS_EGG) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityZeliusEgg());
        GlStateManager.enableBlend();
    } else if (block == DionaBlocks.LARGE_INFECTED_CRYSTALLIZE) {
        TileEntityLargeInfectedCrystallizeRenderer.INSTANCE.render();
    } else if (block == MPBlocks.DARK_ENERGY_RECEIVER) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityDarkEnergyReceiver());
    } else if (itemStack.getItem() == DionaItems.INFECTED_CRYSTALLIZE_BOMB) {
        RenderInfectedCrystallizeBomb.INSTANCE.render();
    } else if (block == NibiruBlocks.NIBIRU_ANCIENT_CHEST) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityNibiruAncientChest());
    } else if (block == NibiruBlocks.NIBIRU_TREASURE_CHEST) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityNibiruTreasureChest());
    } else if (block == ChalosBlocks.CHEESE_SPORE_CHEST) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityCheeseSporeChest());
    } else if (block == NibiruBlocks.INFECTED_CHEST) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityInfectedChest());
    } else if (block == NibiruBlocks.MULTALIC_CRYSTAL) {
        TileEntityMultalicCrystalRenderer.INSTANCE.render();
    } else if (block == DionaBlocks.DARK_ENERGY_CORE) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityDarkEnergyCore());
        GlStateManager.enableBlend();
    } else if (block == NibiruBlocks.ALIEN_BERRY_CHEST) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityAlienBerryChest());
    } else if (block == NibiruBlocks.JUICER_EGG) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityJuicerEgg());
        TileEntityJuicerEggRenderer.renderItem(null, true);
    } else if (block == NibiruBlocks.NUCLEAR_WASTE_TANK) {
        TileEntityNuclearWasteTankRenderer.INSTANCE.render();
    } else if (block == NibiruBlocks.VEIN_FRAME) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityVeinFrame());
        GlStateManager.enableBlend();
    } else if (block == DionaBlocks.DARK_ENERGY_GENERATOR) {
        TileEntityDarkEnergyGeneratorRenderer.INSTANCE.render();
    } else if (block == MPBlocks.BLACK_HOLE_STORAGE) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityBlackHoleStorage());
        GlStateManager.enableBlend();
    } else if (block == MPBlocks.ALIEN_DEFENDER_BEACON) {
        ClientRegisterHelper.registerTileEntityItemStackRendering(new TileEntityAlienDefenderBeacon());
        GlStateManager.enableBlend();
        GlStateManager.enableCull();
    } else if (block == MPBlocks.SHIELD_GENERATOR) {
        TileEntityShieldGeneratorRenderer.INSTANCE.render();
    } else {
        this.old.renderByItem(itemStack);
    }
}
Also used : TileEntityCheeseSporeChest(stevekung.mods.moreplanets.module.planets.chalos.tileentity.TileEntityCheeseSporeChest) TileEntityChalosTreasureChest(stevekung.mods.moreplanets.module.planets.chalos.tileentity.TileEntityChalosTreasureChest) TileEntityDionaTreasureChest(stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDionaTreasureChest) TileEntityDarkEnergyReceiver(stevekung.mods.moreplanets.tileentity.TileEntityDarkEnergyReceiver) TileEntityDionaAncientChest(stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDionaAncientChest) TileEntityDarkEnergyCore(stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDarkEnergyCore) TileEntityBlackHoleStorage(stevekung.mods.moreplanets.tileentity.TileEntityBlackHoleStorage) TileEntityChalosAncientChest(stevekung.mods.moreplanets.module.planets.chalos.tileentity.TileEntityChalosAncientChest) Block(net.minecraft.block.Block) TileEntityAlienDefenderBeacon(stevekung.mods.moreplanets.tileentity.TileEntityAlienDefenderBeacon) TileEntityZeliusEgg(stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityZeliusEgg)

Aggregations

Block (net.minecraft.block.Block)2 TileEntityDarkEnergyCore (stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDarkEnergyCore)2 IBlockState (net.minecraft.block.state.IBlockState)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 TileEntity (net.minecraft.tileentity.TileEntity)1 BlockDummy (stevekung.mods.moreplanets.blocks.BlockDummy)1 TileEntityChalosAncientChest (stevekung.mods.moreplanets.module.planets.chalos.tileentity.TileEntityChalosAncientChest)1 TileEntityChalosTreasureChest (stevekung.mods.moreplanets.module.planets.chalos.tileentity.TileEntityChalosTreasureChest)1 TileEntityCheeseSporeChest (stevekung.mods.moreplanets.module.planets.chalos.tileentity.TileEntityCheeseSporeChest)1 TileEntityDarkEnergyGenerator (stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDarkEnergyGenerator)1 TileEntityDionaAncientChest (stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDionaAncientChest)1 TileEntityDionaTreasureChest (stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDionaTreasureChest)1 TileEntityZeliusEgg (stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityZeliusEgg)1 TileEntityNuclearWasteGenerator (stevekung.mods.moreplanets.module.planets.nibiru.tileentity.TileEntityNuclearWasteGenerator)1 TileEntityAlienDefenderBeacon (stevekung.mods.moreplanets.tileentity.TileEntityAlienDefenderBeacon)1 TileEntityBlackHoleStorage (stevekung.mods.moreplanets.tileentity.TileEntityBlackHoleStorage)1 TileEntityDarkEnergyReceiver (stevekung.mods.moreplanets.tileentity.TileEntityDarkEnergyReceiver)1