Search in sources :

Example 1 with GuiModuleScrollList

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

the class GuiModuleTweaker method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    moduleScreen = addButton(new GuiModuleScreen(this, 138, 20, () -> menu.slots.get(selected).getSlotIndex()));
    scrollList = addButton(new GuiModuleScrollList(this, 30, 20, 108, 116, () -> getStack(selected), this::onModuleSelected));
    addButton(new GuiElementHolder(this, 30, 136, 108, 18));
    optionsButton = addButton(new TranslationButton(this, 31, 137, 106, 16, MekanismLang.BUTTON_OPTIONS, this::openOptions));
    optionsButton.active = false;
    int size = menu.slots.size();
    for (int i = 0; i < size; i++) {
        Slot slot = menu.slots.get(i);
        final int index = i;
        // initialize selected item
        if (selected == -1 && isValidItem(index)) {
            select(index);
        }
        addButton(new GuiSlot(SlotType.NORMAL, this, slot.x - 1, slot.y - 1).click((e, x, y) -> select(index)).overlayColor(isValidItem(index) ? null : () -> 0xCC333333).with(() -> index == selected ? SlotOverlay.SELECT : null));
    }
}
Also used : GuiModuleScreen(mekanism.client.gui.element.custom.GuiModuleScreen) TranslationButton(mekanism.client.gui.element.button.TranslationButton) GuiModuleScreen(mekanism.client.gui.element.custom.GuiModuleScreen) ModuleTweakerContainer(mekanism.common.inventory.container.ModuleTweakerContainer) PlayerInventory(net.minecraft.entity.player.PlayerInventory) SlotOverlay(mekanism.common.inventory.container.slot.SlotOverlay) GuiElementHolder(mekanism.client.gui.element.GuiElementHolder) GuiModuleScrollList(mekanism.client.gui.element.scroll.GuiModuleScrollList) SlotType(mekanism.client.gui.element.slot.SlotType) GLFW(org.lwjgl.glfw.GLFW) ITextComponent(net.minecraft.util.text.ITextComponent) ItemStack(net.minecraft.item.ItemStack) IntList(it.unimi.dsi.fastutil.ints.IntList) Slot(net.minecraft.inventory.container.Slot) MekanismLang(mekanism.common.MekanismLang) Module(mekanism.common.content.gear.Module) GuiMekaSuitHelmetOptions(mekanism.client.gui.element.window.GuiMekaSuitHelmetOptions) MekanismItems(mekanism.common.registries.MekanismItems) Nonnull(javax.annotation.Nonnull) MatrixStack(com.mojang.blaze3d.matrix.MatrixStack) IntArrayList(it.unimi.dsi.fastutil.ints.IntArrayList) GuiSlot(mekanism.client.gui.element.slot.GuiSlot) TranslationButton(mekanism.client.gui.element.button.TranslationButton) GuiElementHolder(mekanism.client.gui.element.GuiElementHolder) Slot(net.minecraft.inventory.container.Slot) GuiSlot(mekanism.client.gui.element.slot.GuiSlot) GuiSlot(mekanism.client.gui.element.slot.GuiSlot) GuiModuleScrollList(mekanism.client.gui.element.scroll.GuiModuleScrollList)

Example 2 with GuiModuleScrollList

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

the class GuiModificationStation method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiVerticalPowerBar(this, tile.getEnergyContainer(), 154, 40));
    addButton(new GuiEnergyTab(this, tile.getEnergyContainer()));
    addButton(new GuiProgress(tile::getScaledProgress, ProgressType.LARGE_RIGHT, this, 65, 123));
    removeButton = addButton(new TranslationButton(this, 34, 96, 108, 17, MekanismLang.BUTTON_REMOVE, () -> Mekanism.packetHandler.sendToServer(new PacketRemoveModule(tile.getBlockPos(), selectedModule.getData()))));
    removeButton.active = false;
    addButton(new GuiModuleScrollList(this, 34, 20, 108, 74, () -> tile.containerSlot.getStack().copy(), this::onModuleSelected));
}
Also used : TranslationButton(mekanism.client.gui.element.button.TranslationButton) GuiProgress(mekanism.client.gui.element.progress.GuiProgress) GuiVerticalPowerBar(mekanism.client.gui.element.bar.GuiVerticalPowerBar) GuiEnergyTab(mekanism.client.gui.element.tab.GuiEnergyTab) PacketRemoveModule(mekanism.common.network.to_server.PacketRemoveModule) GuiModuleScrollList(mekanism.client.gui.element.scroll.GuiModuleScrollList)

Aggregations

TranslationButton (mekanism.client.gui.element.button.TranslationButton)2 GuiModuleScrollList (mekanism.client.gui.element.scroll.GuiModuleScrollList)2 MatrixStack (com.mojang.blaze3d.matrix.MatrixStack)1 IntArrayList (it.unimi.dsi.fastutil.ints.IntArrayList)1 IntList (it.unimi.dsi.fastutil.ints.IntList)1 Nonnull (javax.annotation.Nonnull)1 GuiElementHolder (mekanism.client.gui.element.GuiElementHolder)1 GuiVerticalPowerBar (mekanism.client.gui.element.bar.GuiVerticalPowerBar)1 GuiModuleScreen (mekanism.client.gui.element.custom.GuiModuleScreen)1 GuiProgress (mekanism.client.gui.element.progress.GuiProgress)1 GuiSlot (mekanism.client.gui.element.slot.GuiSlot)1 SlotType (mekanism.client.gui.element.slot.SlotType)1 GuiEnergyTab (mekanism.client.gui.element.tab.GuiEnergyTab)1 GuiMekaSuitHelmetOptions (mekanism.client.gui.element.window.GuiMekaSuitHelmetOptions)1 MekanismLang (mekanism.common.MekanismLang)1 Module (mekanism.common.content.gear.Module)1 ModuleTweakerContainer (mekanism.common.inventory.container.ModuleTweakerContainer)1 SlotOverlay (mekanism.common.inventory.container.slot.SlotOverlay)1 PacketRemoveModule (mekanism.common.network.to_server.PacketRemoveModule)1 MekanismItems (mekanism.common.registries.MekanismItems)1