Search in sources :

Example 1 with MetaTileEntityTransformer

use of gregtech.common.metatileentities.electric.MetaTileEntityTransformer 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

MetaTileEntity (gregtech.api.metatileentity.MetaTileEntity)1 MetaTileEntityHolder (gregtech.api.metatileentity.MetaTileEntityHolder)1 MetaTileEntityTransformer (gregtech.common.metatileentities.electric.MetaTileEntityTransformer)1 IProbeInfo (mcjty.theoneprobe.api.IProbeInfo)1