Search in sources :

Example 6 with IProbeInfo

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

the class WorkableInfoProvider method addProbeInfo.

@Override
protected void addProbeInfo(IWorkable capability, IProbeInfo probeInfo, TileEntity tileEntity, EnumFacing sideHit) {
    int currentProgress = capability.getProgress();
    int maxProgress = capability.getMaxProgress();
    if (maxProgress > 0) {
        int progressScaled = maxProgress == 0 ? 0 : (int) Math.floor(currentProgress / (maxProgress * 1.0) * 100);
        IProbeInfo horizontalPane = probeInfo.horizontal(probeInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER));
        horizontalPane.text(TextStyleClass.INFO + "{*gregtech.top.progress*} ");
        horizontalPane.progress(progressScaled, 100, probeInfo.defaultProgressStyle().suffix("%").borderColor(0x00000000).backgroundColor(0x00000000).filledColor(0xFF000099).alternateFilledColor(0xFF000077));
    }
}
Also used : IProbeInfo(mcjty.theoneprobe.api.IProbeInfo)

Example 7 with IProbeInfo

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

the class ProcessorBlock 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 ProcessorTileEntity) {
        ProcessorTileEntity processor = (ProcessorTileEntity) te;
        if (processor.hasNetworkCard()) {
            probeInfo.text(TextFormatting.GREEN + "Channel: " + processor.getChannelName());
            probeInfo.text(TextFormatting.GREEN + "Nodes: " + processor.getNodeCount());
        }
        if (mode == ProbeMode.EXTENDED) {
            List<String> lastMessages = processor.getLastMessages(6);
            if (!lastMessages.isEmpty()) {
                IProbeInfo v = probeInfo.vertical(probeInfo.defaultLayoutStyle().borderColor(0xffff0000));
                for (String s : lastMessages) {
                    v.text("    " + s);
                }
            }
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) 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