Search in sources :

Example 11 with GuiVerticalPowerBar

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

the class GuiFormulaicAssemblicator method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiVerticalPowerBar(this, tile.getEnergyContainer(), 159, 15));
    // Overwrite the output slots with a "combined" slot
    addButton(new GuiSlot(SlotType.OUTPUT_LARGE, this, 115, 16));
    addButton(new GuiProgress(() -> tile.getOperatingTicks() / (double) tile.getTicksRequired(), ProgressType.TALL_RIGHT, this, 86, 43).jeiCrafting());
    addButton(new GuiEnergyTab(this, tile.getEnergyContainer()));
    encodeFormulaButton = addButton(new MekanismImageButton(this, 7, 45, 14, getButtonLocation("encode_formula"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.ENCODE_FORMULA, tile)), getOnHover(MekanismLang.ENCODE_FORMULA)));
    stockControlButton = addButton(new MekanismImageButton(this, 26, 75, 16, getButtonLocation("stock_control"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.STOCK_CONTROL_BUTTON, tile)), getOnHover(() -> MekanismLang.STOCK_CONTROL.translate(OnOff.of(tile.getStockControl())))));
    fillEmptyButton = addButton(new MekanismImageButton(this, 44, 75, 16, getButtonLocation("fill_empty"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.MOVE_ITEMS, tile)), getOnHover(MekanismLang.FILL_EMPTY)));
    craftSingleButton = addButton(new MekanismImageButton(this, 71, 75, 16, getButtonLocation("craft_single"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.CRAFT_SINGLE, tile)), getOnHover(MekanismLang.CRAFT_SINGLE)));
    craftAvailableButton = addButton(new MekanismImageButton(this, 89, 75, 16, getButtonLocation("craft_available"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.CRAFT_ALL, tile)), getOnHover(MekanismLang.CRAFT_AVAILABLE)));
    autoModeButton = addButton(new MekanismImageButton(this, 107, 75, 16, getButtonLocation("auto_toggle"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.NEXT_MODE, tile)), getOnHover(() -> MekanismLang.AUTO_MODE.translate(OnOff.of(tile.getAutoMode())))));
    updateEnabledButtons();
}
Also used : GuiProgress(mekanism.client.gui.element.progress.GuiProgress) GuiSlot(mekanism.client.gui.element.slot.GuiSlot) MekanismImageButton(mekanism.client.gui.element.button.MekanismImageButton) GuiVerticalPowerBar(mekanism.client.gui.element.bar.GuiVerticalPowerBar) PacketGuiInteract(mekanism.common.network.to_server.PacketGuiInteract) GuiEnergyTab(mekanism.client.gui.element.tab.GuiEnergyTab)

Example 12 with GuiVerticalPowerBar

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

the class GuiMetallurgicInfuser method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiVerticalPowerBar(this, tile.getEnergyContainer(), 164, 15));
    addButton(new GuiEnergyTab(this, tile.getEnergyContainer(), tile::getActive));
    addButton(new GuiProgress(tile::getScaledProgress, ProgressType.RIGHT, this, 72, 47).jeiCategory(tile));
    addButton(new GuiChemicalBar<>(this, GuiChemicalBar.getProvider(tile.infusionTank, tile.getInfusionTanks(null)), 7, 15, 4, 52, false));
    addButton(new GuiDumpButton<>(this, tile, 16, 59));
}
Also used : GuiProgress(mekanism.client.gui.element.progress.GuiProgress) GuiVerticalPowerBar(mekanism.client.gui.element.bar.GuiVerticalPowerBar) GuiEnergyTab(mekanism.client.gui.element.tab.GuiEnergyTab)

Example 13 with GuiVerticalPowerBar

use of mekanism.client.gui.element.bar.GuiVerticalPowerBar 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 14 with GuiVerticalPowerBar

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

the class GuiSolarGenerator method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiInnerScreen(this, 48, 23, 80, 40, () -> Arrays.asList(EnergyDisplay.of(tile.getEnergyContainer()).getTextComponent(), GeneratorsLang.PRODUCING_AMOUNT.translate(EnergyDisplay.of(tile.getLastProductionAmount())), GeneratorsLang.OUTPUT_RATE_SHORT.translate(EnergyDisplay.of(tile.getMaxOutput())))));
    addButton(new GuiEnergyTab(this, () -> Arrays.asList(GeneratorsLang.PRODUCING_AMOUNT.translate(EnergyDisplay.of(tile.getLastProductionAmount())), MekanismLang.MAX_OUTPUT.translate(EnergyDisplay.of(tile.getMaxOutput())))));
    addButton(new GuiVerticalPowerBar(this, tile.getEnergyContainer(), 164, 15));
    addButton(new GuiStateTexture(this, 18, 35, tile::canSeeSun, MekanismGenerators.rl(ResourceType.GUI.getPrefix() + "sees_sun.png"), MekanismGenerators.rl(ResourceType.GUI.getPrefix() + "no_sun.png")));
}
Also used : GuiInnerScreen(mekanism.client.gui.element.GuiInnerScreen) GuiStateTexture(mekanism.generators.client.gui.element.GuiStateTexture) GuiVerticalPowerBar(mekanism.client.gui.element.bar.GuiVerticalPowerBar) GuiEnergyTab(mekanism.client.gui.element.tab.GuiEnergyTab)

Example 15 with GuiVerticalPowerBar

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

the class GuiWindGenerator method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiInnerScreen(this, 48, 21, 80, 44, () -> {
        List<ITextComponent> list = new ArrayList<>();
        list.add(EnergyDisplay.of(tile.getEnergyContainer()).getTextComponent());
        list.add(GeneratorsLang.POWER.translate(MekanismUtils.convertToDisplay(MekanismGeneratorsConfig.generators.windGenerationMin.get().multiply(tile.getCurrentMultiplier())).toString(2)));
        list.add(GeneratorsLang.OUTPUT_RATE_SHORT.translate(EnergyDisplay.of(tile.getMaxOutput())));
        if (!tile.getActive()) {
            ILangEntry reason = tile.isBlacklistDimension() ? GeneratorsLang.NO_WIND : GeneratorsLang.SKY_BLOCKED;
            list.add(reason.translateColored(EnumColor.DARK_RED));
        }
        return list;
    }));
    addButton(new GuiEnergyTab(this, () -> Arrays.asList(GeneratorsLang.PRODUCING_AMOUNT.translate(tile.getActive() ? EnergyDisplay.of(MekanismGeneratorsConfig.generators.windGenerationMin.get().multiply(tile.getCurrentMultiplier())) : EnergyDisplay.ZERO), MekanismLang.MAX_OUTPUT.translate(EnergyDisplay.of(tile.getMaxOutput())))));
    addButton(new GuiVerticalPowerBar(this, tile.getEnergyContainer(), 164, 15));
    addButton(new GuiStateTexture(this, 18, 35, tile::getActive, MekanismGenerators.rl(ResourceType.GUI.getPrefix() + "wind_on.png"), MekanismGenerators.rl(ResourceType.GUI.getPrefix() + "wind_off.png")));
}
Also used : GuiInnerScreen(mekanism.client.gui.element.GuiInnerScreen) GuiStateTexture(mekanism.generators.client.gui.element.GuiStateTexture) ArrayList(java.util.ArrayList) List(java.util.List) GuiVerticalPowerBar(mekanism.client.gui.element.bar.GuiVerticalPowerBar) GuiEnergyTab(mekanism.client.gui.element.tab.GuiEnergyTab) ILangEntry(mekanism.api.text.ILangEntry)

Aggregations

GuiVerticalPowerBar (mekanism.client.gui.element.bar.GuiVerticalPowerBar)25 GuiEnergyTab (mekanism.client.gui.element.tab.GuiEnergyTab)23 GuiProgress (mekanism.client.gui.element.progress.GuiProgress)12 GuiInnerScreen (mekanism.client.gui.element.GuiInnerScreen)10 ArrayList (java.util.ArrayList)5 List (java.util.List)5 GuiFluidGauge (mekanism.client.gui.element.gauge.GuiFluidGauge)5 GuiGasGauge (mekanism.client.gui.element.gauge.GuiGasGauge)4 GuiSlot (mekanism.client.gui.element.slot.GuiSlot)4 GuiUpArrow (mekanism.client.gui.element.GuiUpArrow)3 TranslationButton (mekanism.client.gui.element.button.TranslationButton)3 ILangEntry (mekanism.api.text.ILangEntry)2 GuiDownArrow (mekanism.client.gui.element.GuiDownArrow)2 IBarInfoHandler (mekanism.client.gui.element.bar.GuiBar.IBarInfoHandler)2 GuiGasMode (mekanism.client.gui.element.button.GuiGasMode)2 GuiTeleporterStatus (mekanism.client.gui.element.custom.GuiTeleporterStatus)2 GuiHeatTab (mekanism.client.gui.element.tab.GuiHeatTab)2 PacketGuiInteract (mekanism.common.network.to_server.PacketGuiInteract)2 GuiStateTexture (mekanism.generators.client.gui.element.GuiStateTexture)2 ITextComponent (net.minecraft.util.text.ITextComponent)2