Search in sources :

Example 1 with GuiResizeControls

use of mekanism.client.gui.element.custom.GuiResizeControls in project Mekanism by mekanism.

the class GuiQIOItemViewer method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    int slotsY = MekanismConfig.client.qioItemViewerSlotsY.get();
    getMinecraft().keyboardHandler.setSendRepeatsToGui(true);
    addButton(new GuiInnerScreen(this, 7, 15, imageWidth - 16, 12, () -> {
        List<ITextComponent> list = new ArrayList<>();
        FrequencyIdentity freq = getFrequency();
        if (freq == null) {
            list.add(MekanismLang.NO_FREQUENCY.translate());
        } else {
            list.add(MekanismLang.FREQUENCY.translate(freq.getKey()));
        }
        return list;
    }).tooltip(() -> {
        List<ITextComponent> list = new ArrayList<>();
        if (getFrequency() != null) {
            list.add(MekanismLang.QIO_ITEMS_DETAIL.translateColored(EnumColor.GRAY, EnumColor.INDIGO, TextUtils.format(menu.getTotalItems()), TextUtils.format(menu.getCountCapacity())));
            list.add(MekanismLang.QIO_TYPES_DETAIL.translateColored(EnumColor.GRAY, EnumColor.INDIGO, TextUtils.format(menu.getTotalTypes()), TextUtils.format(menu.getTypeCapacity())));
        }
        return list;
    }));
    searchField = addButton(new GuiTextField(this, 50, 15 + 12 + 3, imageWidth - 50 - 10, 10));
    searchField.setOffset(0, -1);
    searchField.setInputValidator(this::isValidSearchChar);
    searchField.setResponder(menu::updateSearch);
    searchField.setMaxStringLength(50);
    searchField.setBackground(BackgroundType.ELEMENT_HOLDER);
    searchField.setVisible(true);
    searchField.setTextColor(0xFFFFFF);
    searchField.setFocused(true);
    addButton(new GuiSlotScroll(this, 7, QIOItemViewerContainer.SLOTS_START_Y, MekanismConfig.client.qioItemViewerSlotsX.get(), slotsY, menu::getQIOItemList, menu));
    addButton(new GuiDropdown<>(this, imageWidth - 9 - 54, QIOItemViewerContainer.SLOTS_START_Y + slotsY * 18 + 1, 41, ListSortType.class, menu::getSortType, menu::setSortType));
    addButton(new GuiDigitalIconToggle<>(this, imageWidth - 9 - 12, QIOItemViewerContainer.SLOTS_START_Y + slotsY * 18 + 1, 12, 12, SortDirection.class, menu::getSortDirection, menu::setSortDirection));
    addButton(new GuiResizeControls(this, (getMinecraft().getWindow().getGuiScaledHeight() / 2) - 20 - topPos, this::resize));
    craftingWindowTab = addButton(new GuiCraftingWindowTab(this, () -> craftingWindowTab, menu));
}
Also used : ListSortType(mekanism.common.inventory.container.QIOItemViewerContainer.ListSortType) GuiSlotScroll(mekanism.client.gui.element.scroll.GuiSlotScroll) FrequencyIdentity(mekanism.common.lib.frequency.Frequency.FrequencyIdentity) ITextComponent(net.minecraft.util.text.ITextComponent) ArrayList(java.util.ArrayList) GuiTextField(mekanism.client.gui.element.text.GuiTextField) GuiResizeControls(mekanism.client.gui.element.custom.GuiResizeControls) GuiInnerScreen(mekanism.client.gui.element.GuiInnerScreen) SortDirection(mekanism.common.inventory.container.QIOItemViewerContainer.SortDirection) ArrayList(java.util.ArrayList) List(java.util.List) GuiCraftingWindowTab(mekanism.client.gui.element.tab.window.GuiCraftingWindowTab)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 GuiInnerScreen (mekanism.client.gui.element.GuiInnerScreen)1 GuiResizeControls (mekanism.client.gui.element.custom.GuiResizeControls)1 GuiSlotScroll (mekanism.client.gui.element.scroll.GuiSlotScroll)1 GuiCraftingWindowTab (mekanism.client.gui.element.tab.window.GuiCraftingWindowTab)1 GuiTextField (mekanism.client.gui.element.text.GuiTextField)1 ListSortType (mekanism.common.inventory.container.QIOItemViewerContainer.ListSortType)1 SortDirection (mekanism.common.inventory.container.QIOItemViewerContainer.SortDirection)1 FrequencyIdentity (mekanism.common.lib.frequency.Frequency.FrequencyIdentity)1 ITextComponent (net.minecraft.util.text.ITextComponent)1