Search in sources :

Example 1 with GuiVerticalRateBar

use of mekanism.client.gui.element.bar.GuiVerticalRateBar in project Mekanism by mekanism.

the class GuiIndustrialTurbine method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiInnerScreen(this, 50, 18, 112, 50, () -> {
        List<ITextComponent> list = new ArrayList<>();
        TurbineMultiblockData multiblock = tile.getMultiblock();
        if (multiblock.isFormed()) {
            list.add(GeneratorsLang.TURBINE_PRODUCTION_AMOUNT.translate(EnergyDisplay.of(multiblock.getProductionRate())));
            list.add(GeneratorsLang.TURBINE_FLOW_RATE.translate(TextUtils.format(multiblock.clientFlow)));
            list.add(GeneratorsLang.TURBINE_CAPACITY.translate(TextUtils.format(multiblock.getSteamCapacity())));
            list.add(GeneratorsLang.TURBINE_MAX_FLOW.translate(TextUtils.format(multiblock.getMaxFlowRate())));
        }
        return list;
    }));
    addButton(new GuiTurbineTab(this, tile, TurbineTab.STAT));
    addButton(new GuiVerticalPowerBar(this, new IBarInfoHandler() {

        @Override
        public ITextComponent getTooltip() {
            TurbineMultiblockData multiblock = tile.getMultiblock();
            if (multiblock.isFormed()) {
                return EnergyDisplay.of(multiblock.energyContainer).getTextComponent();
            }
            return EnergyDisplay.ZERO.getTextComponent();
        }

        @Override
        public double getLevel() {
            TurbineMultiblockData multiblock = tile.getMultiblock();
            if (multiblock.isFormed()) {
                return multiblock.energyContainer.getEnergy().divideToLevel(multiblock.energyContainer.getMaxEnergy());
            }
            return 1;
        }
    }, 164, 16));
    addButton(new GuiVerticalRateBar(this, new IBarInfoHandler() {

        @Override
        public ITextComponent getTooltip() {
            return GeneratorsLang.TURBINE_STEAM_INPUT_RATE.translate(TextUtils.format(tile.getMultiblock().lastSteamInput));
        }

        @Override
        public double getLevel() {
            TurbineMultiblockData multiblock = tile.getMultiblock();
            if (!multiblock.isFormed()) {
                return 0;
            }
            double rate = Math.min(multiblock.lowerVolume * multiblock.getDispersers() * MekanismGeneratorsConfig.generators.turbineDisperserGasFlow.get(), multiblock.vents * MekanismGeneratorsConfig.generators.turbineVentGasFlow.get());
            if (rate == 0) {
                return 0;
            }
            return Math.min(1, multiblock.lastSteamInput / rate);
        }
    }, 40, 13));
    addButton(new GuiGasGauge(() -> tile.getMultiblock().gasTank, () -> tile.getMultiblock().getGasTanks(null), GaugeType.MEDIUM, this, 6, 13));
    addButton(new GuiEnergyTab(this, () -> {
        EnergyDisplay storing;
        EnergyDisplay producing;
        TurbineMultiblockData multiblock = tile.getMultiblock();
        if (multiblock.isFormed()) {
            storing = EnergyDisplay.of(multiblock.energyContainer);
            producing = EnergyDisplay.of(MekanismConfig.general.maxEnergyPerSteam.get().divide(TurbineValidator.MAX_BLADES).multiply(multiblock.clientFlow * Math.min(multiblock.blades, multiblock.coils * MekanismGeneratorsConfig.generators.turbineBladesPerCoil.get())));
        } else {
            storing = EnergyDisplay.ZERO;
            producing = EnergyDisplay.ZERO;
        }
        return Arrays.asList(MekanismLang.STORING.translate(storing), GeneratorsLang.PRODUCING_AMOUNT.translate(producing));
    }));
    addButton(new GuiGasMode(this, 159, 72, true, () -> tile.getMultiblock().dumpMode, tile.getBlockPos(), 0));
}
Also used : TurbineMultiblockData(mekanism.generators.common.content.turbine.TurbineMultiblockData) IBarInfoHandler(mekanism.client.gui.element.bar.GuiBar.IBarInfoHandler) GuiTurbineTab(mekanism.generators.client.gui.element.GuiTurbineTab) GuiGasGauge(mekanism.client.gui.element.gauge.GuiGasGauge) GuiVerticalPowerBar(mekanism.client.gui.element.bar.GuiVerticalPowerBar) GuiEnergyTab(mekanism.client.gui.element.tab.GuiEnergyTab) GuiInnerScreen(mekanism.client.gui.element.GuiInnerScreen) GuiVerticalRateBar(mekanism.client.gui.element.bar.GuiVerticalRateBar) EnergyDisplay(mekanism.common.util.text.EnergyDisplay) ArrayList(java.util.ArrayList) List(java.util.List) GuiGasMode(mekanism.client.gui.element.button.GuiGasMode)

Example 2 with GuiVerticalRateBar

use of mekanism.client.gui.element.bar.GuiVerticalRateBar in project Mekanism by mekanism.

the class GuiMatrixStats method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiMatrixTab(this, tile, MatrixTab.MAIN));
    addButton(new GuiEnergyGauge(new IEnergyInfoHandler() {

        @Override
        public FloatingLong getEnergy() {
            return tile.getMultiblock().getEnergy();
        }

        @Override
        public FloatingLong getMaxEnergy() {
            return tile.getMultiblock().getStorageCap();
        }
    }, GaugeType.STANDARD, this, 6, 13));
    addButton(new GuiVerticalRateBar(this, new IBarInfoHandler() {

        @Override
        public ITextComponent getTooltip() {
            return MekanismLang.MATRIX_RECEIVING_RATE.translate(EnergyDisplay.of(tile.getMultiblock().getLastInput()));
        }

        @Override
        public double getLevel() {
            MatrixMultiblockData multiblock = tile.getMultiblock();
            return !multiblock.isFormed() ? 0 : multiblock.getLastInput().divideToLevel(multiblock.getTransferCap());
        }
    }, 30, 13));
    addButton(new GuiVerticalRateBar(this, new IBarInfoHandler() {

        @Override
        public ITextComponent getTooltip() {
            return MekanismLang.MATRIX_OUTPUTTING_RATE.translate(EnergyDisplay.of(tile.getMultiblock().getLastOutput()));
        }

        @Override
        public double getLevel() {
            MatrixMultiblockData multiblock = tile.getMultiblock();
            if (!multiblock.isFormed()) {
                return 0;
            }
            return multiblock.getLastOutput().divideToLevel(multiblock.getTransferCap());
        }
    }, 38, 13));
    addButton(new GuiEnergyTab(this, () -> {
        MatrixMultiblockData multiblock = tile.getMultiblock();
        return Arrays.asList(MekanismLang.STORING.translate(EnergyDisplay.of(multiblock.getEnergy(), multiblock.getStorageCap())), MekanismLang.MATRIX_INPUT_RATE.translate(EnergyDisplay.of(multiblock.getLastInput())), MekanismLang.MATRIX_OUTPUT_RATE.translate(EnergyDisplay.of(multiblock.getLastOutput())));
    }));
}
Also used : IBarInfoHandler(mekanism.client.gui.element.bar.GuiBar.IBarInfoHandler) GuiVerticalRateBar(mekanism.client.gui.element.bar.GuiVerticalRateBar) MatrixMultiblockData(mekanism.common.content.matrix.MatrixMultiblockData) GuiMatrixTab(mekanism.client.gui.element.tab.GuiMatrixTab) IEnergyInfoHandler(mekanism.client.gui.element.gauge.GuiEnergyGauge.IEnergyInfoHandler) GuiEnergyGauge(mekanism.client.gui.element.gauge.GuiEnergyGauge) GuiEnergyTab(mekanism.client.gui.element.tab.GuiEnergyTab)

Example 3 with GuiVerticalRateBar

use of mekanism.client.gui.element.bar.GuiVerticalRateBar in project Mekanism by mekanism.

the class GuiThermoelectricBoiler method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiInnerScreen(this, 60, 23, 96, 40, () -> {
        BoilerMultiblockData multiblock = tile.getMultiblock();
        return Arrays.asList(MekanismLang.TEMPERATURE.translate(MekanismUtils.getTemperatureDisplay(multiblock.getTotalTemperature(), TemperatureUnit.KELVIN, true)), MekanismLang.BOIL_RATE.translate(TextUtils.format(multiblock.lastBoilRate)), MekanismLang.MAX_BOIL_RATE.translate(TextUtils.format(multiblock.lastMaxBoil)));
    }).jeiCategories(MekanismBlocks.BOILER_CASING.getRegistryName()));
    addButton(new GuiBoilerTab(this, tile, BoilerTab.STAT));
    addButton(new GuiVerticalRateBar(this, new IBarInfoHandler() {

        @Override
        public ITextComponent getTooltip() {
            return MekanismLang.BOIL_RATE.translate(TextUtils.format(tile.getMultiblock().lastBoilRate));
        }

        @Override
        public double getLevel() {
            BoilerMultiblockData multiblock = tile.getMultiblock();
            return Math.min(1, multiblock.lastBoilRate / (double) multiblock.lastMaxBoil);
        }
    }, 44, 13));
    addButton(new GuiVerticalRateBar(this, new IBarInfoHandler() {

        @Override
        public ITextComponent getTooltip() {
            return MekanismLang.MAX_BOIL_RATE.translate(TextUtils.format(tile.getMultiblock().lastMaxBoil));
        }

        @Override
        public double getLevel() {
            BoilerMultiblockData multiblock = tile.getMultiblock();
            return Math.min(1, multiblock.lastMaxBoil * HeatUtils.getWaterThermalEnthalpy() / (multiblock.superheatingElements * MekanismConfig.general.superheatingHeatTransfer.get()));
        }
    }, 164, 13));
    addButton(new GuiGasGauge(() -> tile.getMultiblock().superheatedCoolantTank, () -> tile.getMultiblock().getGasTanks(null), GaugeType.STANDARD, this, 6, 13).setLabel(MekanismLang.BOILER_HEATED_COOLANT_TANK.translateColored(EnumColor.ORANGE)));
    addButton(new GuiFluidGauge(() -> tile.getMultiblock().waterTank, () -> tile.getMultiblock().getFluidTanks(null), GaugeType.STANDARD, this, 26, 13).setLabel(MekanismLang.BOILER_WATER_TANK.translateColored(EnumColor.INDIGO)));
    addButton(new GuiGasGauge(() -> tile.getMultiblock().steamTank, () -> tile.getMultiblock().getGasTanks(null), GaugeType.STANDARD, this, 172, 13).setLabel(MekanismLang.BOILER_STEAM_TANK.translateColored(EnumColor.GRAY)));
    addButton(new GuiGasGauge(() -> tile.getMultiblock().cooledCoolantTank, () -> tile.getMultiblock().getGasTanks(null), GaugeType.STANDARD, this, 192, 13).setLabel(MekanismLang.BOILER_COOLANT_TANK.translateColored(EnumColor.AQUA)));
    addButton(new GuiHeatTab(this, () -> {
        ITextComponent environment = MekanismUtils.getTemperatureDisplay(tile.getMultiblock().lastEnvironmentLoss, TemperatureUnit.KELVIN, false);
        return Collections.singletonList(MekanismLang.DISSIPATED_RATE.translate(environment));
    }));
}
Also used : GuiInnerScreen(mekanism.client.gui.element.GuiInnerScreen) GuiFluidGauge(mekanism.client.gui.element.gauge.GuiFluidGauge) GuiBoilerTab(mekanism.client.gui.element.tab.GuiBoilerTab) IBarInfoHandler(mekanism.client.gui.element.bar.GuiBar.IBarInfoHandler) GuiVerticalRateBar(mekanism.client.gui.element.bar.GuiVerticalRateBar) BoilerMultiblockData(mekanism.common.content.boiler.BoilerMultiblockData) GuiGasGauge(mekanism.client.gui.element.gauge.GuiGasGauge) ITextComponent(net.minecraft.util.text.ITextComponent) GuiHeatTab(mekanism.client.gui.element.tab.GuiHeatTab)

Aggregations

IBarInfoHandler (mekanism.client.gui.element.bar.GuiBar.IBarInfoHandler)3 GuiVerticalRateBar (mekanism.client.gui.element.bar.GuiVerticalRateBar)3 GuiInnerScreen (mekanism.client.gui.element.GuiInnerScreen)2 GuiGasGauge (mekanism.client.gui.element.gauge.GuiGasGauge)2 GuiEnergyTab (mekanism.client.gui.element.tab.GuiEnergyTab)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 GuiVerticalPowerBar (mekanism.client.gui.element.bar.GuiVerticalPowerBar)1 GuiGasMode (mekanism.client.gui.element.button.GuiGasMode)1 GuiEnergyGauge (mekanism.client.gui.element.gauge.GuiEnergyGauge)1 IEnergyInfoHandler (mekanism.client.gui.element.gauge.GuiEnergyGauge.IEnergyInfoHandler)1 GuiFluidGauge (mekanism.client.gui.element.gauge.GuiFluidGauge)1 GuiBoilerTab (mekanism.client.gui.element.tab.GuiBoilerTab)1 GuiHeatTab (mekanism.client.gui.element.tab.GuiHeatTab)1 GuiMatrixTab (mekanism.client.gui.element.tab.GuiMatrixTab)1 BoilerMultiblockData (mekanism.common.content.boiler.BoilerMultiblockData)1 MatrixMultiblockData (mekanism.common.content.matrix.MatrixMultiblockData)1 EnergyDisplay (mekanism.common.util.text.EnergyDisplay)1 GuiTurbineTab (mekanism.generators.client.gui.element.GuiTurbineTab)1 TurbineMultiblockData (mekanism.generators.common.content.turbine.TurbineMultiblockData)1