Search in sources :

Example 1 with GuiModuleScreen

use of mekanism.client.gui.element.custom.GuiModuleScreen 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)

Aggregations

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 TranslationButton (mekanism.client.gui.element.button.TranslationButton)1 GuiModuleScreen (mekanism.client.gui.element.custom.GuiModuleScreen)1 GuiModuleScrollList (mekanism.client.gui.element.scroll.GuiModuleScrollList)1 GuiSlot (mekanism.client.gui.element.slot.GuiSlot)1 SlotType (mekanism.client.gui.element.slot.SlotType)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 MekanismItems (mekanism.common.registries.MekanismItems)1 PlayerInventory (net.minecraft.entity.player.PlayerInventory)1 Slot (net.minecraft.inventory.container.Slot)1 ItemStack (net.minecraft.item.ItemStack)1 ITextComponent (net.minecraft.util.text.ITextComponent)1