Search in sources :

Example 6 with GuiTextField

use of net.minecraft.client.gui.GuiTextField in project MinecraftForge by MinecraftForge.

the class GuiModList method initGui.

@Override
public void initGui() {
    int slotHeight = 35;
    for (ModContainer mod : mods) {
        listWidth = Math.max(listWidth, getFontRenderer().getStringWidth(mod.getName()) + 10);
        listWidth = Math.max(listWidth, getFontRenderer().getStringWidth(mod.getVersion()) + 5 + slotHeight);
    }
    listWidth = Math.min(listWidth, 150);
    this.modList = new GuiSlotModList(this, mods, listWidth, slotHeight);
    this.buttonList.add(new GuiButton(6, ((modList.right + this.width) / 2) - 100, this.height - 38, I18n.format("gui.done")));
    configModButton = new GuiButton(20, 10, this.height - 49, this.listWidth, 20, "Config");
    disableModButton = new GuiButton(21, 10, this.height - 27, this.listWidth, 20, "Disable");
    this.buttonList.add(configModButton);
    this.buttonList.add(disableModButton);
    search = new GuiTextField(0, getFontRenderer(), 12, modList.bottom + 17, modList.listWidth - 4, 14);
    search.setFocused(true);
    search.setCanLoseFocus(true);
    int width = (modList.listWidth / numButtons);
    int x = 10, y = 10;
    GuiButton normalSort = new GuiButton(SortType.NORMAL.buttonID, x, y, width - buttonMargin, 20, I18n.format("fml.menu.mods.normal"));
    normalSort.enabled = false;
    buttonList.add(normalSort);
    x += width + buttonMargin;
    buttonList.add(new GuiButton(SortType.A_TO_Z.buttonID, x, y, width - buttonMargin, 20, "A-Z"));
    x += width + buttonMargin;
    buttonList.add(new GuiButton(SortType.Z_TO_A.buttonID, x, y, width - buttonMargin, 20, "Z-A"));
    updateCache();
}
Also used : ModContainer(net.minecraftforge.fml.common.ModContainer) GuiButton(net.minecraft.client.gui.GuiButton) GuiTextField(net.minecraft.client.gui.GuiTextField)

Example 7 with GuiTextField

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

the class GuiTurret method initGui.

@Override
public void initGui() {
    super.initGui();
    Keyboard.enableRepeatEvents(true);
    this.nameField = new GuiTextField(0, this.fontRendererObj, guiLeft + 11, guiTop + 88, 58, 12);
    this.nameField.setTextColor(-1);
    this.nameField.setDisabledTextColour(-1);
    this.nameField.setEnableBackgroundDrawing(false);
    this.nameField.setMaxStringLength(30);
    this.buttonList.clear();
    this.buttonList.add(new GuiReactiveList(this, 0, guiLeft + 10, guiTop + 10, 60, 72, tile.targetList.toArray(new String[tile.targetList.size()])).setPadding(0, 0, 2, 2).setFormatting(1, false));
    this.buttonList.add(new GuiButtonIE(1, guiLeft + 74, guiTop + 84, 24, 16, I18n.format(Lib.GUI_CONFIG + "turret.add"), "immersiveengineering:textures/gui/turret.png", 176, 65));
    this.buttonList.add(new GuiButtonCheckbox(2, guiLeft + 74, guiTop + 10, I18n.format(Lib.GUI_CONFIG + "turret.blacklist"), !tile.whitelist));
    this.buttonList.add(new GuiButtonCheckbox(3, guiLeft + 74, guiTop + 26, I18n.format(Lib.GUI_CONFIG + "turret.animals"), tile.attackAnimals));
    this.buttonList.add(new GuiButtonCheckbox(4, guiLeft + 74, guiTop + 42, I18n.format(Lib.GUI_CONFIG + "turret.players"), tile.attackPlayers));
    this.buttonList.add(new GuiButtonCheckbox(5, guiLeft + 74, guiTop + 58, I18n.format(Lib.GUI_CONFIG + "turret.neutrals"), tile.attackNeutrals));
    if (tile instanceof TileEntityTurretChem)
        this.buttonList.add(new GuiButtonState(6, guiLeft + 135, guiTop + 68, 14, 14, null, ((TileEntityTurretChem) tile).ignite, "immersiveengineering:textures/gui/turret.png", 176, 51, 0));
    else if (tile instanceof TileEntityTurretGun)
        this.buttonList.add(new GuiButtonState(6, guiLeft + 134, guiTop + 31, 16, 16, null, ((TileEntityTurretGun) tile).expelCasings, "immersiveengineering:textures/gui/turret.png", 176, 81, 0));
}
Also used : GuiReactiveList(blusunrize.immersiveengineering.client.gui.elements.GuiReactiveList) GuiButtonIE(blusunrize.immersiveengineering.client.gui.elements.GuiButtonIE) TileEntityTurretGun(blusunrize.immersiveengineering.common.blocks.metal.TileEntityTurretGun) GuiButtonState(blusunrize.immersiveengineering.client.gui.elements.GuiButtonState) GuiButtonCheckbox(blusunrize.immersiveengineering.client.gui.elements.GuiButtonCheckbox) GuiTextField(net.minecraft.client.gui.GuiTextField) TileEntityTurretChem(blusunrize.immersiveengineering.common.blocks.metal.TileEntityTurretChem)

Example 8 with GuiTextField

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

the class GuiInscriptionTable method initGui.

@Override
public void initGui() {
    super.initGui();
    searchFieldPosition = new AMVector2(39, 59);
    searchFieldDimensions = new AMVector2(141, 12);
    searchBar = new GuiTextField(Minecraft.getMinecraft().fontRenderer, searchFieldPosition.iX, searchFieldPosition.iY, searchFieldDimensions.iX, searchFieldDimensions.iY);
    nameFieldPosition = new AMVector2(39, 93);
    nameFieldDimensions = new AMVector2(141, 12);
    nameBar = new GuiTextField(Minecraft.getMinecraft().fontRenderer, nameFieldPosition.iX, nameFieldPosition.iY, nameFieldDimensions.iX, nameFieldDimensions.iY);
    int l = (width - xSize) / 2;
    int i1 = (height - ySize) / 2;
    createSpellButton = new GuiButtonVariableDims(0, l - 65, i1, StatCollector.translateToLocal("am2.gui.makeSpell"));
    createSpellButton.setDimensions(60, 20);
    resetSpellButton = new GuiButtonVariableDims(1, l + 120, i1 + 72, StatCollector.translateToLocal("am2.gui.resetSpell"));
    resetSpellButton.setDimensions(60, 20);
    resetSpellButton.visible = false;
    if (usingPlayer.capabilities.isCreativeMode) {
        this.buttonList.add(createSpellButton);
    }
    this.buttonList.add(resetSpellButton);
    nameBar.setText(((ContainerInscriptionTable) this.inventorySlots).getSpellName());
    if (nameBar.getText().equals("")) {
        nameBar.setText(defaultNameLabel);
    }
    searchBar.setText(defaultSearchLabel);
    result = ((ContainerInscriptionTable) this.inventorySlots).validateCurrentDefinition();
}
Also used : AMVector2(am2.api.math.AMVector2) GuiTextField(net.minecraft.client.gui.GuiTextField) GuiButtonVariableDims(am2.guis.controls.GuiButtonVariableDims)

Example 9 with GuiTextField

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

the class GuiKeystone method initGui.

@Override
public void initGui() {
    super.initGui();
    int l = (width - xSize) / 2;
    int i1 = (height - ySize) / 2;
    combinationName = new GuiTextField(fontRendererObj, 44, 86, 88, 16);
    int sliderMax = Math.max(0, ItemsCommonProxy.keystone.numCombinations(((ContainerKeystone) this.inventorySlots).getKeystoneStack()) - 9);
    scrollBar = new GuiSlideControl(4, l + xSize + 58, i1 + 14, 159, "", 0, 0, Math.max(sliderMax, 1));
    scrollBar.setVertical();
    scrollBar.setButtonOnly();
    scrollBar.setOverrideTexture(background);
    scrollBar.setButtonProperties(184, 193, 190, 193, 6, 15);
    scrollBar.setScale(1.0f);
    scrollBar.setNoDynamicDisplay(true);
    if (sliderMax == 0)
        scrollBar.enabled = false;
    prevCombination = new GuiStatedImageButton(3, l + 8, i1 + 86, background, 208, 192);
    nextCombination = new GuiStatedImageButton(2, l + 152, i1 + 86, background, 208, 208);
    addCombination = new GuiStatedImageButton(0, l + 26, i1 + 86, background, 208, 224);
    forgetCombination = new GuiStatedImageButton(1, l + 134, i1 + 86, background, 208, 240);
    prevCombination.addStateCoords(GuiStatedImageButton.States.MOUSEOVER, 224, 192);
    nextCombination.addStateCoords(GuiStatedImageButton.States.MOUSEOVER, 224, 208);
    addCombination.addStateCoords(GuiStatedImageButton.States.MOUSEOVER, 224, 224);
    forgetCombination.addStateCoords(GuiStatedImageButton.States.MOUSEOVER, 224, 240);
    prevCombination.addStateCoords(GuiStatedImageButton.States.CLICK, 240, 192);
    nextCombination.addStateCoords(GuiStatedImageButton.States.CLICK, 240, 208);
    addCombination.addStateCoords(GuiStatedImageButton.States.CLICK, 240, 224);
    forgetCombination.addStateCoords(GuiStatedImageButton.States.CLICK, 240, 240);
    prevCombination.setDimensions(16, 16);
    nextCombination.setDimensions(16, 16);
    addCombination.setDimensions(16, 16);
    forgetCombination.setDimensions(16, 16);
    this.buttonList.add(addCombination);
    this.buttonList.add(forgetCombination);
    this.buttonList.add(nextCombination);
    this.buttonList.add(prevCombination);
    this.buttonList.add(scrollBar);
}
Also used : GuiStatedImageButton(am2.guis.controls.GuiStatedImageButton) GuiTextField(net.minecraft.client.gui.GuiTextField) GuiSlideControl(am2.guis.controls.GuiSlideControl)

Example 10 with GuiTextField

use of net.minecraft.client.gui.GuiTextField 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)

Aggregations

GuiTextField (net.minecraft.client.gui.GuiTextField)38 GuiButton (net.minecraft.client.gui.GuiButton)16 GuiButtonVariableDims (am2.guis.controls.GuiButtonVariableDims)2 Point (java.awt.Point)2 List (java.util.List)2 ItemStack (net.minecraft.item.ItemStack)2 WidgetMode (uk.co.qmunity.lib.client.gui.widget.WidgetMode)2 AMVector2 (am2.api.math.AMVector2)1 ContainerSpellCustomization (am2.containers.ContainerSpellCustomization)1 GuiSlideControl (am2.guis.controls.GuiSlideControl)1 GuiSpellImageButton (am2.guis.controls.GuiSpellImageButton)1 GuiStatedImageButton (am2.guis.controls.GuiStatedImageButton)1 GuiButtonCheckbox (blusunrize.immersiveengineering.client.gui.elements.GuiButtonCheckbox)1 GuiButtonIE (blusunrize.immersiveengineering.client.gui.elements.GuiButtonIE)1 GuiButtonState (blusunrize.immersiveengineering.client.gui.elements.GuiButtonState)1 GuiReactiveList (blusunrize.immersiveengineering.client.gui.elements.GuiReactiveList)1 TileEntityTurretChem (blusunrize.immersiveengineering.common.blocks.metal.TileEntityTurretChem)1 TileEntityTurretGun (blusunrize.immersiveengineering.common.blocks.metal.TileEntityTurretGun)1 IItemFrequency (com.builtbroken.mc.api.items.hz.IItemFrequency)1 GuiValidityStateIndicator (ivorius.reccomplex.gui.GuiValidityStateIndicator)1