Search in sources :

Example 36 with GuiButton

use of net.minecraft.client.gui.GuiButton in project Pearcel-Mod by MiningMark48.

the class GuiCatItems method initGui.

@Override
public void initGui() {
    super.initGui();
    buttonList.clear();
    int offsetFromScreenLeft = (width - textureWidth) / 2;
    buttonList.add(buttonNextPage = new ComponentNextPageButton(1, offsetFromScreenLeft + 120, 158, true));
    buttonList.add(buttonPreviousPage = new ComponentNextPageButton(1, offsetFromScreenLeft + 38, 158, false));
    buttonHome = new GuiButton(2, (width / 2) - 20, textureHeight, 40, 20, Translate.toLocal("gui.manual.button.home"));
    buttonList.add(buttonHome);
    for (GuiButton e : buttonList) {
        e.visible = false;
    }
}
Also used : GuiButton(net.minecraft.client.gui.GuiButton)

Example 37 with GuiButton

use of net.minecraft.client.gui.GuiButton in project Pearcel-Mod by MiningMark48.

the class GuiCatTools method initGui.

@Override
public void initGui() {
    super.initGui();
    buttonList.clear();
    int offsetFromScreenLeft = (width - textureWidth) / 2;
    buttonList.add(buttonNextPage = new ComponentNextPageButton(1, offsetFromScreenLeft + 120, 158, true));
    buttonList.add(buttonPreviousPage = new ComponentNextPageButton(1, offsetFromScreenLeft + 38, 158, false));
    buttonHome = new GuiButton(2, (width / 2) - 20, textureHeight, 40, 20, Translate.toLocal("gui.manual.button.home"));
    buttonList.add(buttonHome);
    for (GuiButton e : buttonList) {
        e.visible = false;
    }
}
Also used : GuiButton(net.minecraft.client.gui.GuiButton)

Example 38 with GuiButton

use of net.minecraft.client.gui.GuiButton in project ArsMagica2 by Mithion.

the class AuraCustomizationMenu method mouseClicked.

@Override
protected void mouseClicked(int x, int y, int button) {
    GuiButton clickedBtn = getControlByXY(x, y);
    if (clickedBtn != null && button == 1) {
        if (clickedBtn.id == 10) {
            int index = AMCore.config.getAuraIndex();
            index--;
            if (index < 0)
                index = AMParticle.particleTypes.length - 1;
            while (AMParticle.particleTypes[index].startsWith("lightning_bolt") && AMCore.proxy.playerTracker.getAAL(Minecraft.getMinecraft().thePlayer) < 3) {
                index--;
                if (index < 0)
                    index = AMParticle.particleTypes.length - 1;
            }
            AMCore.config.setAuraIndex(index);
            btnParticleType.displayString = AMParticle.particleTypes[index];
        } else if (clickedBtn.id == 11) {
            int index = AMCore.config.getAuraBehaviour();
            index--;
            if (index < 0)
                index = ParticleController.AuraControllerOptions.length - 1;
            AMCore.config.setAuraBehaviour(index);
            btnParticleBehaviour.displayString = ParticleController.AuraControllerOptions[index];
        }
    }
    super.mouseClicked(x, y, button);
}
Also used : GuiButton(net.minecraft.client.gui.GuiButton)

Example 39 with GuiButton

use of net.minecraft.client.gui.GuiButton in project OpenModularTurrets by OpenModularTurretsTeam.

the class ConfigureGui method initGui.

@SuppressWarnings("unchecked")
@Override
public void initGui() {
    super.initGui();
    this.buttonList.clear();
    FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj;
    String mobsButton = safeLocalize(OMTNames.Localizations.GUI.ATTACK_MOBS) + ": " + (getColoredBooleanLocalizationYesNo(base.isAttacksMobs()));
    String neutralsButton = safeLocalize(OMTNames.Localizations.GUI.ATTACK_NEUTRALS) + ": " + (getColoredBooleanLocalizationYesNo(base.isAttacksNeutrals()));
    String playersButton = safeLocalize(OMTNames.Localizations.GUI.ATTACK_PLAYERS) + ": " + (getColoredBooleanLocalizationYesNo(base.isAttacksPlayers()));
    int x = (width - xSize) / 2;
    int y = (height - ySize) / 2;
    textFieldAddTrustedPlayer = new GuiTextField(0, fontRenderer, 11, 99, 100, 18);
    textFieldAddTrustedPlayer.setMaxStringLength(50);
    textFieldAddTrustedPlayer.setFocused(true);
    this.buttonList.add(new GuiButton(1, x + 10, y + 20, 155, 20, mobsButton));
    this.buttonList.add(new GuiButton(2, x + 10, y + 40, 155, 20, neutralsButton));
    this.buttonList.add(new GuiButton(3, x + 10, y + 60, 155, 20, playersButton));
    this.buttonList.add(new GuiButton(4, x + 114, y + 98, 51, 20, "+"));
    this.buttonList.add(new GuiButton(5, x + 35, y + 135, 30, 20, "-"));
    this.buttonList.add(new GuiButton(6, x + 10, y + 135, 20, 20, "<<"));
    this.buttonList.add(new GuiButton(7, x + 145, y + 135, 20, 20, ">>"));
    if (this.base.getTrustedPlayers().size() > 0) {
        this.buttonList.add(new GuiButton(8, x + 70, y + 135, 23, 20, this.base.getTrustedPlayers().get(base.trustedPlayerIndex).canOpenGUI ? "§2Y" : "§cN"));
        this.buttonList.add(new GuiButton(9, x + 93, y + 135, 23, 20, this.base.getTrustedPlayers().get(base.trustedPlayerIndex).canChangeTargeting ? "§2Y" : "§cN"));
        this.buttonList.add(new GuiButton(10, x + 116, y + 135, 23, 20, this.base.getTrustedPlayers().get(base.trustedPlayerIndex).admin ? "§2Y" : "§cN"));
    } else {
        this.buttonList.add(new GuiButton(8, x + 70, y + 135, 23, 20, "?"));
        this.buttonList.add(new GuiButton(9, x + 93, y + 135, 23, 20, "?"));
        this.buttonList.add(new GuiButton(10, x + 116, y + 135, 23, 20, "?"));
    }
}
Also used : GuiButton(net.minecraft.client.gui.GuiButton) FontRenderer(net.minecraft.client.gui.FontRenderer) TextComponentString(net.minecraft.util.text.TextComponentString) GuiTextField(net.minecraft.client.gui.GuiTextField)

Example 40 with GuiButton

use of net.minecraft.client.gui.GuiButton in project ImmersiveEngineering by BluSunrize.

the class GuiModWorkbench method mouseReleased.

@Override
protected void mouseReleased(int mouseX, int mouseY, int state) {
    super.mouseReleased(mouseX, mouseY, state);
    Slot s = inventorySlots.getSlot(0);
    if (s != null && s.getHasStack() && s.getStack().getItem() instanceof IConfigurableTool) {
        ItemStack stack = s.getStack();
        IConfigurableTool tool = ((IConfigurableTool) stack.getItem());
        NBTTagCompound message = new NBTTagCompound();
        ToolConfigBoolean[] boolArray = tool.getBooleanOptions(stack);
        int iBool = 0;
        ToolConfigFloat[] floatArray = tool.getFloatOptions(stack);
        int iFloat = 0;
        for (GuiButton button : this.buttonList) {
            if (button instanceof GuiButtonCheckbox && boolArray != null)
                message.setBoolean("b_" + boolArray[iBool++].name, ((GuiButtonCheckbox) button).state);
            if (button instanceof GuiSliderIE && floatArray != null)
                message.setFloat("f_" + floatArray[iFloat++].name, (float) ((GuiSliderIE) button).sliderValue);
        }
        if (//Only send packets when values have changed
        lastMessage == null || !lastMessage.equals(message))
            ImmersiveEngineering.packetHandler.sendToServer(new MessageTileSync(this.workbench, message));
        lastMessage = message;
    }
}
Also used : ToolConfigBoolean(blusunrize.immersiveengineering.api.tool.IConfigurableTool.ToolConfig.ToolConfigBoolean) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) GuiButton(net.minecraft.client.gui.GuiButton) GuiSliderIE(blusunrize.immersiveengineering.client.gui.elements.GuiSliderIE) IESlot(blusunrize.immersiveengineering.common.gui.IESlot) Slot(net.minecraft.inventory.Slot) IConfigurableTool(blusunrize.immersiveengineering.api.tool.IConfigurableTool) ToolConfigFloat(blusunrize.immersiveengineering.api.tool.IConfigurableTool.ToolConfig.ToolConfigFloat) GuiButtonCheckbox(blusunrize.immersiveengineering.client.gui.elements.GuiButtonCheckbox) ItemStack(net.minecraft.item.ItemStack) MessageTileSync(blusunrize.immersiveengineering.common.util.network.MessageTileSync)

Aggregations

GuiButton (net.minecraft.client.gui.GuiButton)132 GuiTextField (net.minecraft.client.gui.GuiTextField)17 SmallGuiButton (logisticspipes.utils.gui.SmallGuiButton)12 ArrayList (java.util.ArrayList)10 ItemStack (net.minecraft.item.ItemStack)9 Point (java.awt.Point)7 GuiElementInfoRegionMP (stevekung.mods.moreplanets.util.client.gui.GuiElementInfoRegionMP)7 ItemDisplay (logisticspipes.utils.gui.ItemDisplay)6 GuiCheckBox (logisticspipes.utils.gui.GuiCheckBox)5 Bounds (ivorius.reccomplex.gui.table.Bounds)4 Rectangle (java.awt.Rectangle)4 SearchBar (logisticspipes.utils.gui.SearchBar)4 ItemIdentifierStack (logisticspipes.utils.item.ItemIdentifierStack)3 GuiButtonVariableDims (am2.guis.controls.GuiButtonVariableDims)2 GuiSlideControl (am2.guis.controls.GuiSlideControl)2 IOException (java.io.IOException)2 BitSet (java.util.BitSet)2 GuiDiskPopup (logisticspipes.gui.popup.GuiDiskPopup)2 RequestMonitorPopup (logisticspipes.gui.popup.RequestMonitorPopup)2 ClearCraftingGridPacket (logisticspipes.network.packets.block.ClearCraftingGridPacket)2