Search in sources :

Example 1 with ToggleButton

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

the class GuiRotaryCondensentrator method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiDownArrow(this, 159, 44));
    addButton(new GuiHorizontalPowerBar(this, tile.getEnergyContainer(), 115, 75));
    addButton(new GuiEnergyTab(this, tile.getEnergyContainer(), tile::getEnergyUsed));
    addButton(new GuiFluidGauge(() -> tile.fluidTank, () -> tile.getFluidTanks(null), GaugeType.STANDARD, this, 133, 13));
    addButton(new GuiGasGauge(() -> tile.gasTank, () -> tile.getGasTanks(null), GaugeType.STANDARD, this, 25, 13));
    addButton(new GuiProgress(new IBooleanProgressInfoHandler() {

        @Override
        public boolean fillProgressBar() {
            return tile.getActive();
        }

        @Override
        public boolean isActive() {
            return !tile.mode;
        }
    }, ProgressType.LARGE_RIGHT, this, 64, 39).jeiCategories(condensentrating));
    addButton(new GuiProgress(new IBooleanProgressInfoHandler() {

        @Override
        public boolean fillProgressBar() {
            return tile.getActive();
        }

        @Override
        public boolean isActive() {
            return tile.mode;
        }
    }, ProgressType.LARGE_LEFT, this, 64, 39).jeiCategories(decondensentrating));
    addButton(new ToggleButton(this, 4, 4, () -> tile.mode, () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.NEXT_MODE, tile)), getOnHover(MekanismLang.CONDENSENTRATOR_TOGGLE)));
}
Also used : GuiFluidGauge(mekanism.client.gui.element.gauge.GuiFluidGauge) GuiDownArrow(mekanism.client.gui.element.GuiDownArrow) ToggleButton(mekanism.client.gui.element.button.ToggleButton) GuiHorizontalPowerBar(mekanism.client.gui.element.bar.GuiHorizontalPowerBar) GuiProgress(mekanism.client.gui.element.progress.GuiProgress) GuiGasGauge(mekanism.client.gui.element.gauge.GuiGasGauge) PacketGuiInteract(mekanism.common.network.to_server.PacketGuiInteract) GuiEnergyTab(mekanism.client.gui.element.tab.GuiEnergyTab) IBooleanProgressInfoHandler(mekanism.client.gui.element.progress.IProgressInfoHandler.IBooleanProgressInfoHandler)

Example 2 with ToggleButton

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

the class GuiFusionReactorLogicAdapter method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiElementHolder(this, 16, 31, 130, 90));
    addButton(new ToggleButton(this, 16, 19, 11, tile::isActiveCooled, () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.NEXT_MODE, tile)), getOnHover(GeneratorsLang.REACTOR_LOGIC_TOGGLE_COOLING)));
    scrollBar = addButton(new GuiScrollBar(this, 146, 31, 90, () -> tile.getModes().length, () -> DISPLAY_COUNT));
    for (int i = 0; i < DISPLAY_COUNT; i++) {
        int typeShift = 22 * i;
        addButton(new ReactorLogicButton<>(this, 17, 32 + typeShift, i, tile, scrollBar::getCurrentSelection, tile::getModes, type -> {
            if (type == null) {
                return;
            }
            MekanismGenerators.packetHandler.sendToServer(new PacketGeneratorsGuiInteract(GeneratorsGuiInteraction.LOGIC_TYPE, tile, type.ordinal()));
        }));
    }
}
Also used : Mekanism(mekanism.common.Mekanism) EnumColor(mekanism.api.text.EnumColor) PlayerInventory(net.minecraft.entity.player.PlayerInventory) GuiElementHolder(mekanism.client.gui.element.GuiElementHolder) PacketGuiInteract(mekanism.common.network.to_server.PacketGuiInteract) OnOff(mekanism.common.util.text.BooleanStateDisplay.OnOff) MekanismGenerators(mekanism.generators.common.MekanismGenerators) ToggleButton(mekanism.client.gui.element.button.ToggleButton) ReactorLogicButton(mekanism.generators.client.gui.element.button.ReactorLogicButton) EmptyTileContainer(mekanism.common.inventory.container.tile.EmptyTileContainer) ITextComponent(net.minecraft.util.text.ITextComponent) GeneratorsLang(mekanism.generators.common.GeneratorsLang) GuiInteraction(mekanism.common.network.to_server.PacketGuiInteract.GuiInteraction) MekanismLang(mekanism.common.MekanismLang) GuiScrollBar(mekanism.client.gui.element.scroll.GuiScrollBar) Nonnull(javax.annotation.Nonnull) GuiMekanismTile(mekanism.client.gui.GuiMekanismTile) MatrixStack(com.mojang.blaze3d.matrix.MatrixStack) PacketGeneratorsGuiInteract(mekanism.generators.common.network.to_server.PacketGeneratorsGuiInteract) TileEntityFusionReactorLogicAdapter(mekanism.generators.common.tile.fusion.TileEntityFusionReactorLogicAdapter) GeneratorsGuiInteraction(mekanism.generators.common.network.to_server.PacketGeneratorsGuiInteract.GeneratorsGuiInteraction) ToggleButton(mekanism.client.gui.element.button.ToggleButton) GuiElementHolder(mekanism.client.gui.element.GuiElementHolder) GuiScrollBar(mekanism.client.gui.element.scroll.GuiScrollBar) PacketGuiInteract(mekanism.common.network.to_server.PacketGuiInteract) PacketGeneratorsGuiInteract(mekanism.generators.common.network.to_server.PacketGeneratorsGuiInteract)

Aggregations

ToggleButton (mekanism.client.gui.element.button.ToggleButton)2 PacketGuiInteract (mekanism.common.network.to_server.PacketGuiInteract)2 MatrixStack (com.mojang.blaze3d.matrix.MatrixStack)1 Nonnull (javax.annotation.Nonnull)1 EnumColor (mekanism.api.text.EnumColor)1 GuiMekanismTile (mekanism.client.gui.GuiMekanismTile)1 GuiDownArrow (mekanism.client.gui.element.GuiDownArrow)1 GuiElementHolder (mekanism.client.gui.element.GuiElementHolder)1 GuiHorizontalPowerBar (mekanism.client.gui.element.bar.GuiHorizontalPowerBar)1 GuiFluidGauge (mekanism.client.gui.element.gauge.GuiFluidGauge)1 GuiGasGauge (mekanism.client.gui.element.gauge.GuiGasGauge)1 GuiProgress (mekanism.client.gui.element.progress.GuiProgress)1 IBooleanProgressInfoHandler (mekanism.client.gui.element.progress.IProgressInfoHandler.IBooleanProgressInfoHandler)1 GuiScrollBar (mekanism.client.gui.element.scroll.GuiScrollBar)1 GuiEnergyTab (mekanism.client.gui.element.tab.GuiEnergyTab)1 Mekanism (mekanism.common.Mekanism)1 MekanismLang (mekanism.common.MekanismLang)1 EmptyTileContainer (mekanism.common.inventory.container.tile.EmptyTileContainer)1 GuiInteraction (mekanism.common.network.to_server.PacketGuiInteract.GuiInteraction)1 OnOff (mekanism.common.util.text.BooleanStateDisplay.OnOff)1