Search in sources :

Example 6 with GuiScrollBar

use of mekanism.client.gui.element.scroll.GuiScrollBar in project Mekanism by mekanism.

the class GuiSeismicReader method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiInnerScreen(this, 7, 11, 63, 49));
    addButton(new GuiInnerScreen(this, 74, 11, 51, 159));
    scrollBar = addButton(new GuiScrollBar(this, 126, 25, 131, blockList::size, () -> 1));
    addButton(new GuiArrowSelection(this, 76, 81, () -> {
        int currentLayer = scrollBar.getCurrentSelection();
        if (currentLayer >= 0) {
            return blockList.get(blockList.size() - 1 - currentLayer).getBlock().getName();
        }
        return null;
    }));
    upButton = addButton(new MekanismImageButton(this, 126, 11, 14, MekanismUtils.getResource(ResourceType.GUI_BUTTON, "up.png"), () -> scrollBar.adjustScroll(1)));
    downButton = addButton(new MekanismImageButton(this, 126, 156, 14, MekanismUtils.getResource(ResourceType.GUI_BUTTON, "down.png"), () -> scrollBar.adjustScroll(-1)));
    updateEnabledButtons();
}
Also used : GuiInnerScreen(mekanism.client.gui.element.GuiInnerScreen) GuiScrollBar(mekanism.client.gui.element.scroll.GuiScrollBar) MekanismImageButton(mekanism.client.gui.element.button.MekanismImageButton) GuiArrowSelection(mekanism.client.gui.element.GuiArrowSelection)

Aggregations

GuiScrollBar (mekanism.client.gui.element.scroll.GuiScrollBar)6 MatrixStack (com.mojang.blaze3d.matrix.MatrixStack)5 Nonnull (javax.annotation.Nonnull)5 GuiElementHolder (mekanism.client.gui.element.GuiElementHolder)5 PlayerInventory (net.minecraft.entity.player.PlayerInventory)5 ITextComponent (net.minecraft.util.text.ITextComponent)5 MekanismLang (mekanism.common.MekanismLang)4 EnumColor (mekanism.api.text.EnumColor)3 GuiMekanismTile (mekanism.client.gui.GuiMekanismTile)3 GuiInnerScreen (mekanism.client.gui.element.GuiInnerScreen)3 Mekanism (mekanism.common.Mekanism)3 IFilter (mekanism.common.content.filter.IFilter)3 MekanismTileContainer (mekanism.common.inventory.container.tile.MekanismTileContainer)3 PacketGuiInteract (mekanism.common.network.to_server.PacketGuiInteract)3 GuiInteraction (mekanism.common.network.to_server.PacketGuiInteract.GuiInteraction)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 FilterButton (mekanism.client.gui.element.button.FilterButton)2 MovableFilterButton (mekanism.client.gui.element.button.MovableFilterButton)2 TranslationButton (mekanism.client.gui.element.button.TranslationButton)2