Search in sources :

Example 1 with IProbeInfo

use of mcjty.theoneprobe.api.IProbeInfo in project GregTech by GregTechCE.

the class ElectricContainerInfoProvider method addProbeInfo.

@Override
protected void addProbeInfo(IEnergyContainer capability, IProbeInfo probeInfo, TileEntity tileEntity, EnumFacing sideHit) {
    long energyStored = capability.getEnergyStored();
    long maxStorage = capability.getEnergyCapacity();
    // do not add empty max storage progress bar
    if (maxStorage == 0)
        return;
    IProbeInfo horizontalPane = probeInfo.horizontal(probeInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER));
    String additionalSpacing = tileEntity.hasCapability(GregtechTileCapabilities.CAPABILITY_WORKABLE, sideHit) ? "   " : "";
    horizontalPane.text(TextStyleClass.INFO + "{*gregtech.top.energy_stored*} " + additionalSpacing);
    horizontalPane.progress(energyStored, maxStorage, probeInfo.defaultProgressStyle().suffix("/" + maxStorage + " EU").borderColor(0x00000000).backgroundColor(0x00000000).filledColor(0xFFFFE000).alternateFilledColor(0xFFEED000));
}
Also used : IProbeInfo(mcjty.theoneprobe.api.IProbeInfo)

Example 2 with IProbeInfo

use of mcjty.theoneprobe.api.IProbeInfo in project RFTools by McJty.

the class SequencerBlock method addProbeInfo.

@Override
@Optional.Method(modid = "theoneprobe")
public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data) {
    super.addProbeInfo(mode, probeInfo, player, world, blockState, data);
    TileEntity te = world.getTileEntity(data.getPos());
    if (te instanceof SequencerTileEntity) {
        SequencerTileEntity tileEntity = (SequencerTileEntity) te;
        IProbeInfo horizontal = probeInfo.horizontal(probeInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER));
        horizontal.text(TextFormatting.GREEN + "Mode: " + tileEntity.getMode().getDescription());
        TheOneProbeSupport.addSequenceElement(horizontal, tileEntity.getCycleBits(), tileEntity.getCurrentStep(), mode == ProbeMode.EXTENDED);
        int currentStep = tileEntity.getCurrentStep();
        boolean rc = tileEntity.checkOutput();
        probeInfo.text(TextFormatting.GREEN + "Step: " + TextFormatting.WHITE + currentStep + TextFormatting.GREEN + " -> " + TextFormatting.WHITE + (rc ? "on" : "off"));
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) IProbeInfo(mcjty.theoneprobe.api.IProbeInfo)

Example 3 with IProbeInfo

use of mcjty.theoneprobe.api.IProbeInfo in project EnderIO by SleepyTrousers.

the class TOPCompatibility method mkRfLine.

private void mkRfLine(ProbeMode mode, EioBox eiobox, TOPData data) {
    if (data.hasRF) {
        if (mode != ProbeMode.NORMAL || TopConfig.showPowerByDefault.get()) {
            IProbeInfo rfLine = eiobox.get().horizontal(eiobox.center()).item(Material.POWDER_INFINITY.getStack());
            if (data.hasRFIO) {
                rfLine = rfLine.vertical();
            }
            if (data.isPowered) {
                rfLine.progress(data.rf, data.maxrf, eiobox.getProbeinfo().defaultProgressStyle().suffix(EnderIO.lang.localize("top.suffix.rf")).filledColor(0xffd63223).alternateFilledColor(0xffd63223));
            } else {
                rfLine.text(loc("top.machine.outofpower"));
            }
            if (data.hasRFIO) {
                rfLine = rfLine.horizontal();
                // 
                rfLine.vertical(eiobox.getProbeinfo().defaultLayoutStyle().spacing(-1)).text(loc("top.rf.header.avg")).text(loc("top.rf.header.maxin")).text(loc("top.rf.header.maxout"));
                // LangPower.format should be run on the client, but we have no way to do that
                String line1 = loc("top.rf.value", (data.avgRF == 0 ? TextFormatting.WHITE : data.avgRF > 0 ? TextFormatting.GREEN + "+" : TextFormatting.RED) + LangPower.format(data.avgRF));
                String line2 = loc("top.rf.value", LangPower.format(data.maxRFIn));
                String line3 = loc("top.rf.value", LangPower.format(data.maxRFOut));
                rfLine = rfLine.vertical(eiobox.getProbeinfo().defaultLayoutStyle().spacing(-1)).text(line1).text(line2).text(line3);
            }
        } else {
            eiobox.addMore();
        }
    }
}
Also used : IProbeInfo(mcjty.theoneprobe.api.IProbeInfo)

Example 4 with IProbeInfo

use of mcjty.theoneprobe.api.IProbeInfo in project GregTech by GregTechCE.

the class FuelableInfoProvider method addProbeInfo.

@Override
protected void addProbeInfo(IFuelable capability, IProbeInfo probeInfo, TileEntity tileEntity, EnumFacing sideHit) {
    Collection<IFuelInfo> fuels = capability.getFuels();
    if (fuels == null || fuels.isEmpty()) {
        probeInfo.text(TextStyleClass.WARNING + "{*gregtech.top.fuel_none*}");
        return;
    }
    for (IFuelInfo fuelInfo : fuels) {
        final String fuelName = fuelInfo.getFuelName();
        final int fuelRemaining = fuelInfo.getFuelRemaining();
        final int fuelCapacity = fuelInfo.getFuelCapacity();
        final int fuelMinConsumed = fuelInfo.getFuelMinConsumed();
        final long burnTime = fuelInfo.getFuelBurnTimeLong() / 20;
        IProbeInfo horizontalPane = probeInfo.horizontal(probeInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER));
        if (fuelInfo instanceof ItemFuelInfo) {
            horizontalPane.text(TextStyleClass.INFO + "{*gregtech.top.fuel_name*} ").itemLabel(((ItemFuelInfo) fuelInfo).getItemStack());
        } else {
            horizontalPane.text(TextStyleClass.INFO + "{*gregtech.top.fuel_name*} {*" + fuelName + "*}");
        }
        horizontalPane = probeInfo.horizontal(probeInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER));
        horizontalPane.progress(fuelRemaining, fuelCapacity, probeInfo.defaultProgressStyle().suffix("/" + fuelCapacity + " ").borderColor(0x00000000).backgroundColor(0x00000000).filledColor(0xFFFFE000).alternateFilledColor(0xFFEED000));
        if (fuelRemaining < fuelMinConsumed)
            horizontalPane.text("{*gregtech.top.fuel_min_consume*} " + fuelMinConsumed);
        else
            horizontalPane.text("{*gregtech.top.fuel_burn*} " + burnTime + " {*gregtech.top.fuel_time*}");
    }
}
Also used : IFuelInfo(gregtech.api.capability.IFuelInfo) ItemFuelInfo(gregtech.api.capability.impl.ItemFuelInfo) IProbeInfo(mcjty.theoneprobe.api.IProbeInfo)

Example 5 with IProbeInfo

use of mcjty.theoneprobe.api.IProbeInfo in project GregTech by GregTechCE.

the class TransformerInfoProvider method addProbeInfo.

@Override
protected void addProbeInfo(IEnergyContainer capability, IProbeInfo probeInfo, TileEntity tileEntity, EnumFacing sideHit) {
    if (tileEntity instanceof MetaTileEntityHolder) {
        MetaTileEntity metaTileEntity = ((MetaTileEntityHolder) tileEntity).getMetaTileEntity();
        if (metaTileEntity instanceof MetaTileEntityTransformer) {
            MetaTileEntityTransformer mteTransformer = (MetaTileEntityTransformer) metaTileEntity;
            String inputVoltageN = GTValues.VN[GTUtility.getTierByVoltage(capability.getInputVoltage())];
            String outputVoltageN = GTValues.VN[GTUtility.getTierByVoltage(capability.getOutputVoltage())];
            long inputAmperage = capability.getInputAmperage();
            long outputAmperage = capability.getOutputAmperage();
            IProbeInfo horizontalPane = probeInfo.vertical(probeInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER));
            String transformInfo;
            // Step Up/Step Down line
            if (mteTransformer.isInverted()) {
                transformInfo = "{*gregtech.top.transform_up*} ";
            } else {
                transformInfo = "{*gregtech.top.transform_down*} ";
            }
            transformInfo += inputVoltageN + " (" + inputAmperage + "A) -> " + outputVoltageN + " (" + outputAmperage + "A)";
            horizontalPane.text(TextStyleClass.INFO + transformInfo);
            // Input/Output side line
            horizontalPane = probeInfo.vertical(probeInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER));
            if (capability.inputsEnergy(sideHit)) {
                transformInfo = "{*gregtech.top.transform_input*} " + inputVoltageN + " (" + inputAmperage + "A)";
                horizontalPane.text(TextStyleClass.INFO + transformInfo);
            } else if (capability.outputsEnergy(sideHit)) {
                transformInfo = "{*gregtech.top.transform_output*} " + outputVoltageN + " (" + outputAmperage + "A)";
                horizontalPane.text(TextStyleClass.INFO + transformInfo);
            }
        }
    }
}
Also used : MetaTileEntityHolder(gregtech.api.metatileentity.MetaTileEntityHolder) MetaTileEntityTransformer(gregtech.common.metatileentities.electric.MetaTileEntityTransformer) MetaTileEntity(gregtech.api.metatileentity.MetaTileEntity) IProbeInfo(mcjty.theoneprobe.api.IProbeInfo)

Aggregations

IProbeInfo (mcjty.theoneprobe.api.IProbeInfo)7 TileEntity (net.minecraft.tileentity.TileEntity)2 IFuelInfo (gregtech.api.capability.IFuelInfo)1 ItemFuelInfo (gregtech.api.capability.impl.ItemFuelInfo)1 MetaTileEntity (gregtech.api.metatileentity.MetaTileEntity)1 MetaTileEntityHolder (gregtech.api.metatileentity.MetaTileEntityHolder)1 MetaTileEntityTransformer (gregtech.common.metatileentities.electric.MetaTileEntityTransformer)1