Search in sources :

Example 1 with TileEntityNuclearWasteGenerator

use of stevekung.mods.moreplanets.module.planets.nibiru.tileentity.TileEntityNuclearWasteGenerator in project MorePlanets by SteveKunG.

the class BlockNuclearWasteGenerator method breakBlock.

@Override
public void breakBlock(World world, BlockPos pos, IBlockState state) {
    TileEntity tile = world.getTileEntity(pos);
    if (tile instanceof TileEntityNuclearWasteGenerator) {
        TileEntityNuclearWasteGenerator generator = (TileEntityNuclearWasteGenerator) tile;
        GalacticraftCore.packetPipeline.sendToDimension(new PacketSimpleMP(EnumSimplePacketMP.C_REMOVE_GENERATOR_GUIDE_POS, world.provider.getDimension(), generator.getPos()), world.provider.getDimension());
    }
    super.breakBlock(world, pos, state);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityNuclearWasteGenerator(stevekung.mods.moreplanets.module.planets.nibiru.tileentity.TileEntityNuclearWasteGenerator) PacketSimpleMP(stevekung.mods.moreplanets.network.PacketSimpleMP)

Example 2 with TileEntityNuclearWasteGenerator

use of stevekung.mods.moreplanets.module.planets.nibiru.tileentity.TileEntityNuclearWasteGenerator in project MorePlanets by SteveKunG.

the class BlockNuclearWasteGenerator method harvestBlock.

@Override
public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity tile, ItemStack heldStack) {
    if (tile instanceof TileEntityNuclearWasteGenerator) {
        TileEntityNuclearWasteGenerator electric = (TileEntityNuclearWasteGenerator) tile;
        ItemStack itemStack = new ItemStack(this);
        if (electric.getEnergyStoredGC() > 0) {
            itemStack.setTagCompound(new NBTTagCompound());
            itemStack.getTagCompound().setFloat("EnergyStored", electric.getEnergyStoredGC());
        }
        Block.spawnAsEntity(world, pos, itemStack);
    }
}
Also used : TileEntityNuclearWasteGenerator(stevekung.mods.moreplanets.module.planets.nibiru.tileentity.TileEntityNuclearWasteGenerator) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ItemStack(net.minecraft.item.ItemStack)

Example 3 with TileEntityNuclearWasteGenerator

use of stevekung.mods.moreplanets.module.planets.nibiru.tileentity.TileEntityNuclearWasteGenerator in project MorePlanets by SteveKunG.

the class BlockNuclearWasteGenerator method onBlockPlacedBy.

@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack itemStack) {
    world.setBlockState(pos, this.getDefaultState(), 3);
    if (itemStack.hasTagCompound() && itemStack.getTagCompound().hasKey("EnergyStored")) {
        if (world.getTileEntity(pos) instanceof TileEntityNuclearWasteGenerator) {
            TileEntityNuclearWasteGenerator electric = (TileEntityNuclearWasteGenerator) world.getTileEntity(pos);
            electric.storage.setEnergyStored(itemStack.getTagCompound().getFloat("EnergyStored"));
        }
    }
}
Also used : TileEntityNuclearWasteGenerator(stevekung.mods.moreplanets.module.planets.nibiru.tileentity.TileEntityNuclearWasteGenerator)

Example 4 with TileEntityNuclearWasteGenerator

use of stevekung.mods.moreplanets.module.planets.nibiru.tileentity.TileEntityNuclearWasteGenerator 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 5 with TileEntityNuclearWasteGenerator

use of stevekung.mods.moreplanets.module.planets.nibiru.tileentity.TileEntityNuclearWasteGenerator in project MorePlanets by SteveKunG.

the class WailaTileEntityProviderMP method getNBTData.

@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound nbt, World world, BlockPos pos) {
    if (tile instanceof TileEntityDummy) {
        TileEntityDummy dummy = (TileEntityDummy) tile;
        if (world.getTileEntity(dummy.mainBlockPosition) instanceof TileEntityDarkEnergyReceiver) {
            TileEntityDarkEnergyReceiver receiver = (TileEntityDarkEnergyReceiver) world.getTileEntity(dummy.mainBlockPosition);
            nbt.setString("Status", receiver.getGuiStatusWaila());
            return receiver.writeToNBT(nbt);
        }
        if (world.getTileEntity(dummy.mainBlockPosition) instanceof TileEntityShieldGenerator) {
            TileEntityShieldGenerator shield = (TileEntityShieldGenerator) world.getTileEntity(dummy.mainBlockPosition);
            nbt.setString("Status", shield.getStatus());
            return shield.writeToNBT(nbt);
        }
    }
    if (tile instanceof TileEntityDarkEnergyReceiver) {
        TileEntityDarkEnergyReceiver receiver = (TileEntityDarkEnergyReceiver) tile;
        nbt.setString("Status", receiver.getGuiStatusWaila());
        return receiver.writeToNBT(nbt);
    }
    if (tile instanceof TileEntityDarkEnergyGenerator) {
        TileEntityDarkEnergyGenerator generator = (TileEntityDarkEnergyGenerator) tile;
        nbt.setInteger("GenerateWatts", generator.generateWatts);
        return generator.writeToNBT(nbt);
    }
    if (tile instanceof TileEntityDarkEnergyStorageCluster) {
        TileEntityDarkEnergyStorageCluster energy = (TileEntityDarkEnergyStorageCluster) tile;
        nbt.setFloat("MaxEnergy", energy.getMaxEnergyStoredGC());
        nbt.setFloat("MaxOutput", energy.storage.getMaxExtract());
        return energy.writeToNBT(nbt);
    }
    if (tile instanceof TileEntityNuclearWasteStorageCluster) {
        TileEntityNuclearWasteStorageCluster energy = (TileEntityNuclearWasteStorageCluster) tile;
        nbt.setFloat("MaxEnergy", energy.getMaxEnergyStoredGC());
        nbt.setFloat("MaxOutput", energy.storage.getMaxExtract());
        return energy.writeToNBT(nbt);
    }
    if (tile instanceof TileEntityRocketCrusher) {
        TileEntityRocketCrusher crusher = (TileEntityRocketCrusher) tile;
        nbt.setInteger("ProcessTime", crusher.processTimeRequired);
        return crusher.writeToNBT(nbt);
    }
    if (tile instanceof TileEntityShieldGenerator) {
        TileEntityShieldGenerator shield = (TileEntityShieldGenerator) tile;
        nbt.setString("Status", shield.getStatus());
        return shield.writeToNBT(nbt);
    }
    if (tile instanceof TileEntityNuclearWasteGenerator) {
        TileEntityNuclearWasteGenerator generator = (TileEntityNuclearWasteGenerator) tile;
        nbt.setString("Status", generator.getStatus());
        nbt.setFloat("MaxEnergy", generator.getMaxEnergyStoredGC());
        nbt.setFloat("MaxOutput", generator.storage.getMaxExtract());
        return generator.writeToNBT(nbt);
    }
    return tile.writeToNBT(nbt);
}
Also used : TileEntityNuclearWasteGenerator(stevekung.mods.moreplanets.module.planets.nibiru.tileentity.TileEntityNuclearWasteGenerator) TileEntityDarkEnergyGenerator(stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDarkEnergyGenerator)

Aggregations

TileEntityNuclearWasteGenerator (stevekung.mods.moreplanets.module.planets.nibiru.tileentity.TileEntityNuclearWasteGenerator)6 TileEntity (net.minecraft.tileentity.TileEntity)3 TileEntityDarkEnergyGenerator (stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDarkEnergyGenerator)3 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 Block (net.minecraft.block.Block)1 IBlockState (net.minecraft.block.state.IBlockState)1 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)1 ItemStack (net.minecraft.item.ItemStack)1 BlockPos (net.minecraft.util.math.BlockPos)1 BlockDummy (stevekung.mods.moreplanets.blocks.BlockDummy)1 ContainerCrashedAlienProbe (stevekung.mods.moreplanets.module.planets.diona.inventory.ContainerCrashedAlienProbe)1 ContainerDarkEnergyGenerator (stevekung.mods.moreplanets.module.planets.diona.inventory.ContainerDarkEnergyGenerator)1 TileEntityCrashedAlienProbe (stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityCrashedAlienProbe)1 TileEntityDarkEnergyCore (stevekung.mods.moreplanets.module.planets.diona.tileentity.TileEntityDarkEnergyCore)1 ContainerNuclearWasteGenerator (stevekung.mods.moreplanets.module.planets.nibiru.inventory.ContainerNuclearWasteGenerator)1 PacketSimpleMP (stevekung.mods.moreplanets.network.PacketSimpleMP)1