Search in sources :

Example 1 with MekanismImageButton

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

the class GuiQIOItemFrequencySelect method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiFrequencySelector<>(this, 17));
    addButton(new MekanismImageButton(this, 6, 6, 14, getButtonLocation("back"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiButtonPress(ClickedItemButton.BACK_BUTTON, menu.getHand()))));
}
Also used : PacketGuiButtonPress(mekanism.common.network.to_server.PacketGuiButtonPress) MekanismImageButton(mekanism.client.gui.element.button.MekanismImageButton)

Example 2 with MekanismImageButton

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

the class GuiRobitMain method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiSecurityTab(this, robit, 120));
    addButton(GuiSideHolder.create(this, 176, 6, 106, false, false, SpecialColors.TAB_ROBIT_MENU));
    addButton(new GuiInnerScreen(this, 27, 16, 122, 56));
    addButton(new GuiHorizontalPowerBar(this, robit.getEnergyContainer(), 27, 74, 120));
    addButton(new MekanismImageButton(this, 6, 16, 18, getButtonLocation("home"), () -> {
        Mekanism.packetHandler.sendToServer(new PacketRobit(RobitPacketType.GO_HOME, robit));
        getMinecraft().setScreen(null);
    }, getOnHover(MekanismLang.ROBIT_TELEPORT)));
    renameButton = addButton(new MekanismImageButton(this, 6, 35, 18, getButtonLocation("rename"), () -> openWindow(new GuiRobitRename(this, 27, 16, robit), () -> renameButton), getOnHover(MekanismLang.ROBIT_RENAME)));
    skinButton = addButton(new MekanismImageButton(this, 6, 54, 18, getButtonLocation("skin"), () -> openWindow(new GuiRobitSkinSelect(this, 4, -12, robit), () -> skinButton), getOnHover(MekanismLang.ROBIT_SKIN_SELECT)));
    addButton(new MekanismImageButton(this, 152, 35, 18, getButtonLocation("drop"), () -> Mekanism.packetHandler.sendToServer(new PacketRobit(RobitPacketType.DROP_PICKUP, robit)), getOnHover(MekanismLang.ROBIT_TOGGLE_PICKUP)));
    addButton(new MekanismImageButton(this, 152, 54, 18, getButtonLocation("follow"), () -> Mekanism.packetHandler.sendToServer(new PacketRobit(RobitPacketType.FOLLOW, robit)), getOnHover(MekanismLang.ROBIT_TOGGLE_FOLLOW)));
    addButton(new MekanismImageButton(this, 179, 10, 18, getButtonLocation("main"), () -> {
    // Clicking main button doesn't do anything while already on the main GUI
    }, getOnHover(MekanismLang.ROBIT)));
    addButton(new MekanismImageButton(this, 179, 30, 18, getButtonLocation("crafting"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiButtonPress(ClickedEntityButton.ROBIT_CRAFTING, robit)), getOnHover(MekanismLang.ROBIT_CRAFTING)));
    addButton(new MekanismImageButton(this, 179, 50, 18, getButtonLocation("inventory"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiButtonPress(ClickedEntityButton.ROBIT_INVENTORY, robit)), getOnHover(MekanismLang.ROBIT_INVENTORY)));
    addButton(new MekanismImageButton(this, 179, 70, 18, getButtonLocation("smelting"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiButtonPress(ClickedEntityButton.ROBIT_SMELTING, robit)), getOnHover(MekanismLang.ROBIT_SMELTING)));
    addButton(new MekanismImageButton(this, 179, 90, 18, getButtonLocation("repair"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiButtonPress(ClickedEntityButton.ROBIT_REPAIR, robit)), getOnHover(MekanismLang.ROBIT_REPAIR)));
}
Also used : GuiInnerScreen(mekanism.client.gui.element.GuiInnerScreen) GuiRobitSkinSelect(mekanism.client.gui.element.window.GuiRobitSkinSelect) PacketGuiButtonPress(mekanism.common.network.to_server.PacketGuiButtonPress) GuiSecurityTab(mekanism.client.gui.element.tab.GuiSecurityTab) GuiHorizontalPowerBar(mekanism.client.gui.element.bar.GuiHorizontalPowerBar) PacketRobit(mekanism.common.network.to_server.PacketRobit) GuiRobitRename(mekanism.client.gui.element.window.GuiRobitRename) MekanismImageButton(mekanism.client.gui.element.button.MekanismImageButton)

Example 3 with MekanismImageButton

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

the class GuiLogisticalSorter method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiSlot(SlotType.NORMAL, this, 12, 136).setRenderAboveSlots());
    addButton(new TranslationButton(this, 56, 136, 96, 20, MekanismLang.BUTTON_NEW_FILTER, () -> addWindow(new GuiSorterFilerSelect(this, tile))));
    addButton(new MekanismImageButton(this, 12, 58, 14, getButtonLocation("single"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.SINGLE_ITEM_BUTTON, tile)), getOnHover(MekanismLang.SORTER_SINGLE_ITEM_DESCRIPTION)));
    addButton(new MekanismImageButton(this, 12, 84, 14, getButtonLocation("round_robin"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.ROUND_ROBIN_BUTTON, tile)), getOnHover(MekanismLang.SORTER_ROUND_ROBIN_DESCRIPTION)));
    addButton(new MekanismImageButton(this, 12, 110, 14, getButtonLocation("auto_eject"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.AUTO_EJECT_BUTTON, tile)), getOnHover(MekanismLang.SORTER_AUTO_EJECT_DESCRIPTION)));
    addButton(new ColorButton(this, 13, 137, 16, 16, () -> tile.color, () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.CHANGE_COLOR, tile, hasShiftDown() ? -1 : TransporterUtils.getColorIndex(TransporterUtils.increment(tile.color)))), () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.CHANGE_COLOR, tile, TransporterUtils.getColorIndex(TransporterUtils.decrement(tile.color))))));
}
Also used : ColorButton(mekanism.client.gui.element.button.ColorButton) TranslationButton(mekanism.client.gui.element.button.TranslationButton) GuiSlot(mekanism.client.gui.element.slot.GuiSlot) MekanismImageButton(mekanism.client.gui.element.button.MekanismImageButton) PacketGuiInteract(mekanism.common.network.to_server.PacketGuiInteract) GuiSorterFilerSelect(mekanism.client.gui.element.window.filter.transporter.GuiSorterFilerSelect)

Example 4 with MekanismImageButton

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

the class GuiFormulaicAssemblicator method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiVerticalPowerBar(this, tile.getEnergyContainer(), 159, 15));
    // Overwrite the output slots with a "combined" slot
    addButton(new GuiSlot(SlotType.OUTPUT_LARGE, this, 115, 16));
    addButton(new GuiProgress(() -> tile.getOperatingTicks() / (double) tile.getTicksRequired(), ProgressType.TALL_RIGHT, this, 86, 43).jeiCrafting());
    addButton(new GuiEnergyTab(this, tile.getEnergyContainer()));
    encodeFormulaButton = addButton(new MekanismImageButton(this, 7, 45, 14, getButtonLocation("encode_formula"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.ENCODE_FORMULA, tile)), getOnHover(MekanismLang.ENCODE_FORMULA)));
    stockControlButton = addButton(new MekanismImageButton(this, 26, 75, 16, getButtonLocation("stock_control"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.STOCK_CONTROL_BUTTON, tile)), getOnHover(() -> MekanismLang.STOCK_CONTROL.translate(OnOff.of(tile.getStockControl())))));
    fillEmptyButton = addButton(new MekanismImageButton(this, 44, 75, 16, getButtonLocation("fill_empty"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.MOVE_ITEMS, tile)), getOnHover(MekanismLang.FILL_EMPTY)));
    craftSingleButton = addButton(new MekanismImageButton(this, 71, 75, 16, getButtonLocation("craft_single"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.CRAFT_SINGLE, tile)), getOnHover(MekanismLang.CRAFT_SINGLE)));
    craftAvailableButton = addButton(new MekanismImageButton(this, 89, 75, 16, getButtonLocation("craft_available"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.CRAFT_ALL, tile)), getOnHover(MekanismLang.CRAFT_AVAILABLE)));
    autoModeButton = addButton(new MekanismImageButton(this, 107, 75, 16, getButtonLocation("auto_toggle"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.NEXT_MODE, tile)), getOnHover(() -> MekanismLang.AUTO_MODE.translate(OnOff.of(tile.getAutoMode())))));
    updateEnabledButtons();
}
Also used : GuiProgress(mekanism.client.gui.element.progress.GuiProgress) GuiSlot(mekanism.client.gui.element.slot.GuiSlot) MekanismImageButton(mekanism.client.gui.element.button.MekanismImageButton) GuiVerticalPowerBar(mekanism.client.gui.element.bar.GuiVerticalPowerBar) PacketGuiInteract(mekanism.common.network.to_server.PacketGuiInteract) GuiEnergyTab(mekanism.client.gui.element.tab.GuiEnergyTab)

Example 5 with MekanismImageButton

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

the class GuiQIOItemStackFilter method init.

@Override
protected void init() {
    super.init();
    addChild(new MekanismImageButton(gui(), relativeX + 148, relativeY + 18, 11, 14, getButtonLocation("fuzzy"), () -> filter.fuzzyMode = !filter.fuzzyMode, getOnHover(MekanismLang.FUZZY_MODE)));
}
Also used : MekanismImageButton(mekanism.client.gui.element.button.MekanismImageButton)

Aggregations

MekanismImageButton (mekanism.client.gui.element.button.MekanismImageButton)15 GuiSlot (mekanism.client.gui.element.slot.GuiSlot)6 PacketGuiButtonPress (mekanism.common.network.to_server.PacketGuiButtonPress)6 PacketGuiInteract (mekanism.common.network.to_server.PacketGuiInteract)4 TranslationButton (mekanism.client.gui.element.button.TranslationButton)3 SlotType (mekanism.client.gui.element.slot.SlotType)3 GuiTextField (mekanism.client.gui.element.text.GuiTextField)3 MekanismLang (mekanism.common.MekanismLang)3 MekanismUtils (mekanism.common.util.MekanismUtils)3 ResourceType (mekanism.common.util.MekanismUtils.ResourceType)3 MatrixStack (com.mojang.blaze3d.matrix.MatrixStack)2 UnaryOperator (java.util.function.UnaryOperator)2 IGuiWrapper (mekanism.client.gui.IGuiWrapper)2 GuiElement (mekanism.client.gui.element.GuiElement)2 GuiInnerScreen (mekanism.client.gui.element.GuiInnerScreen)2 ColorButton (mekanism.client.gui.element.button.ColorButton)2 GuiFilterHelper (mekanism.client.gui.element.window.filter.GuiFilterHelper)2 IGhostBlockItemConsumer (mekanism.client.jei.interfaces.IJEIGhostTarget.IGhostBlockItemConsumer)2 MinerFilter (mekanism.common.content.miner.MinerFilter)2 TileEntityDigitalMiner (mekanism.common.tile.machine.TileEntityDigitalMiner)2