Search in sources :

Example 1 with GuiGasMode

use of mekanism.client.gui.element.button.GuiGasMode 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 GuiGasMode

use of mekanism.client.gui.element.button.GuiGasMode in project Mekanism by mekanism.

the class GuiChemicalTank method addGuiElements.

@Override
protected void addGuiElements() {
    // Add the side holder before the slots, as it holds a couple of the slots
    addButton(GuiSideHolder.armorHolder(this));
    super.addGuiElements();
    addButton(new GuiMergedChemicalBar<>(this, tile, tile.getChemicalTank(), 42, 16, 116, 10, true));
    addButton(new GuiInnerScreen(this, 42, 37, 118, 28, () -> {
        List<ITextComponent> ret = new ArrayList<>();
        Current current = tile.getChemicalTank().getCurrent();
        if (current == Current.EMPTY) {
            ret.add(MekanismLang.CHEMICAL.translate(MekanismLang.NONE));
            ret.add(MekanismLang.GENERIC_FRACTION.translate(0, tile.getTier() == ChemicalTankTier.CREATIVE ? MekanismLang.INFINITE : TextUtils.format(tile.getTier().getStorage())));
        } else if (current == Current.GAS) {
            addStored(ret, tile.getChemicalTank().getGasTank(), MekanismLang.GAS);
        } else if (current == Current.INFUSION) {
            addStored(ret, tile.getChemicalTank().getInfusionTank(), MekanismLang.INFUSE_TYPE);
        } else if (current == Current.PIGMENT) {
            addStored(ret, tile.getChemicalTank().getPigmentTank(), MekanismLang.PIGMENT);
        } else if (current == Current.SLURRY) {
            addStored(ret, tile.getChemicalTank().getSlurryTank(), MekanismLang.SLURRY);
        } else {
            throw new IllegalStateException("Unknown current type");
        }
        return ret;
    }));
    addButton(new GuiGasMode(this, 159, 72, true, () -> tile.dumping, tile.getBlockPos(), 0));
}
Also used : GuiInnerScreen(mekanism.client.gui.element.GuiInnerScreen) ArrayList(java.util.ArrayList) List(java.util.List) GuiGasMode(mekanism.client.gui.element.button.GuiGasMode) Current(mekanism.api.chemical.merged.MergedChemicalTank.Current)

Example 3 with GuiGasMode

use of mekanism.client.gui.element.button.GuiGasMode in project Mekanism by mekanism.

the class GuiElectrolyticSeparator method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiEnergyTab(this, tile.getEnergyContainer(), tile::getEnergyUsed));
    addButton(new GuiFluidGauge(() -> tile.fluidTank, () -> tile.getFluidTanks(null), GaugeType.STANDARD, this, 5, 10));
    addButton(new GuiGasGauge(() -> tile.leftTank, () -> tile.getGasTanks(null), GaugeType.SMALL, this, 58, 18));
    addButton(new GuiGasGauge(() -> tile.rightTank, () -> tile.getGasTanks(null), GaugeType.SMALL, this, 100, 18));
    addButton(new GuiVerticalPowerBar(this, tile.getEnergyContainer(), 164, 15));
    addButton(new GuiProgress(tile::getActive, ProgressType.BI, this, 80, 30).jeiCategory(tile));
    addButton(new GuiGasMode(this, 7, 72, false, () -> tile.dumpLeft, tile.getBlockPos(), 0));
    addButton(new GuiGasMode(this, 159, 72, true, () -> tile.dumpRight, tile.getBlockPos(), 1));
}
Also used : GuiFluidGauge(mekanism.client.gui.element.gauge.GuiFluidGauge) GuiProgress(mekanism.client.gui.element.progress.GuiProgress) GuiGasGauge(mekanism.client.gui.element.gauge.GuiGasGauge) GuiVerticalPowerBar(mekanism.client.gui.element.bar.GuiVerticalPowerBar) GuiGasMode(mekanism.client.gui.element.button.GuiGasMode) GuiEnergyTab(mekanism.client.gui.element.tab.GuiEnergyTab)

Aggregations

GuiGasMode (mekanism.client.gui.element.button.GuiGasMode)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 GuiInnerScreen (mekanism.client.gui.element.GuiInnerScreen)2 GuiVerticalPowerBar (mekanism.client.gui.element.bar.GuiVerticalPowerBar)2 GuiGasGauge (mekanism.client.gui.element.gauge.GuiGasGauge)2 GuiEnergyTab (mekanism.client.gui.element.tab.GuiEnergyTab)2 Current (mekanism.api.chemical.merged.MergedChemicalTank.Current)1 IBarInfoHandler (mekanism.client.gui.element.bar.GuiBar.IBarInfoHandler)1 GuiVerticalRateBar (mekanism.client.gui.element.bar.GuiVerticalRateBar)1 GuiFluidGauge (mekanism.client.gui.element.gauge.GuiFluidGauge)1 GuiProgress (mekanism.client.gui.element.progress.GuiProgress)1 EnergyDisplay (mekanism.common.util.text.EnergyDisplay)1 GuiTurbineTab (mekanism.generators.client.gui.element.GuiTurbineTab)1 TurbineMultiblockData (mekanism.generators.common.content.turbine.TurbineMultiblockData)1