Search in sources :

Example 51 with GuiTextField

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

the class GuiAnvil method initGui.

/**
 * Adds the buttons (and other controls) to the screen in question.
 */
@Override
public void initGui() {
    super.initGui();
    Keyboard.enableRepeatEvents(true);
    int i = (width - xSize) / 2;
    int j = (height - ySize) / 2;
    this.itemNameField = new GuiTextField(0, fontRenderer, i + 62, j + 24, 103, 12);
    itemNameField.setTextColor(-1);
    itemNameField.setDisabledTextColour(-1);
    itemNameField.setEnableBackgroundDrawing(false);
    itemNameField.setMaxStringLength(40);
    inventorySlots.removeListener(this);
    inventorySlots.addListener(this);
}
Also used : GuiTextField(net.minecraft.client.gui.GuiTextField)

Example 52 with GuiTextField

use of net.minecraft.client.gui.GuiTextField in project Armourers-Workshop by RiskyKen.

the class GuiTabArmourerDisplaySettings method initGui.

@Override
public void initGui(int xPos, int yPos, int width, int height) {
    super.initGui(xPos, yPos, width, height);
    String guiName = tileEntity.getInventoryName();
    buttonList.clear();
    checkShowGuides = new GuiCheckBox(7, 10, 95, GuiHelper.getLocalizedControlName(guiName, "showGuide"), tileEntity.isShowGuides());
    checkShowOverlay = new GuiCheckBox(9, 10, 110, GuiHelper.getLocalizedControlName(guiName, "showOverlay"), tileEntity.isShowOverlay());
    checkShowHelper = new GuiCheckBox(6, 10, 110, GuiHelper.getLocalizedControlName(guiName, "showHelper"), tileEntity.isShowHelper());
    buttonList.add(new GuiButtonExt(8, width - 36 - 5, 70, 30, 16, GuiHelper.getLocalizedControlName(guiName, "set")));
    textUserSkin = new GuiTextField(fontRenderer, x + 10, y + 70, 120, 16);
    textUserSkin.setMaxStringLength(300);
    textUserSkin.setText(tileEntity.getTexture().getTextureString());
    textureTypeList = new GuiDropDownList(0, 10, 30, 50, "", this);
    textureTypeList.addListItem(GuiHelper.getLocalizedControlName(tileEntity.getInventoryName(), "dropdown.user"), TextureType.USER.toString(), true);
    textureTypeList.addListItem(GuiHelper.getLocalizedControlName(tileEntity.getInventoryName(), "dropdown.url"), TextureType.URL.toString(), true);
    textureTypeList.setListSelectedIndex(tileEntity.getTexture().getTextureType().ordinal());
    buttonList.add(checkShowGuides);
    buttonList.add(checkShowOverlay);
    buttonList.add(checkShowHelper);
    buttonList.add(textureTypeList);
}
Also used : GuiDropDownList(riskyken.armourersWorkshop.client.gui.controls.GuiDropDownList) GuiButtonExt(cpw.mods.fml.client.config.GuiButtonExt) GuiCheckBox(riskyken.armourersWorkshop.client.gui.controls.GuiCheckBox) GuiTextField(net.minecraft.client.gui.GuiTextField)

Example 53 with GuiTextField

use of net.minecraft.client.gui.GuiTextField in project Armourers-Workshop by RiskyKen.

the class GuiTabArmourerMain method initGui.

@Override
public void initGui(int xPos, int yPos, int width, int height) {
    super.initGui(xPos, yPos, width, height);
    String guiName = tileEntity.getInventoryName();
    buttonList.clear();
    SkinTypeRegistry str = SkinTypeRegistry.INSTANCE;
    GuiDropDownList dropDownList = new GuiDropDownList(0, 10, 20, 50, "", this);
    ArrayList<ISkinType> skinList = str.getRegisteredSkinTypes();
    int skinCount = 0;
    for (int i = 0; i < skinList.size(); i++) {
        ISkinType skinType = skinList.get(i);
        if (!skinType.isHidden()) {
            String skinLocalizedName = str.getLocalizedSkinTypeName(skinType);
            String skinRegistryName = skinType.getRegistryName();
            dropDownList.addListItem(skinLocalizedName, skinRegistryName, skinType.enabled());
            if (skinType == tileEntity.getSkinType()) {
                dropDownList.setListSelectedIndex(skinCount);
            }
            skinCount++;
        }
    }
    buttonList.add(dropDownList);
    buttonList.add(new GuiButtonExt(13, 86, 16, 50, 12, GuiHelper.getLocalizedControlName(guiName, "save")));
    buttonList.add(new GuiButtonExt(14, 86, 16 + 13, 50, 12, GuiHelper.getLocalizedControlName(guiName, "load")));
    textItemName = new GuiTextField(fontRenderer, x + 64, y + 58, 103, 16);
    textItemName.setMaxStringLength(40);
    textItemName.setText(tileEntity.getSkinProps().getPropertyString(Skin.KEY_CUSTOM_NAME, ""));
}
Also used : GuiDropDownList(riskyken.armourersWorkshop.client.gui.controls.GuiDropDownList) ISkinType(riskyken.armourersWorkshop.api.common.skin.type.ISkinType) GuiButtonExt(cpw.mods.fml.client.config.GuiButtonExt) SkinTypeRegistry(riskyken.armourersWorkshop.common.skin.type.SkinTypeRegistry) GuiTextField(net.minecraft.client.gui.GuiTextField)

Example 54 with GuiTextField

use of net.minecraft.client.gui.GuiTextField in project Armourers-Workshop by RiskyKen.

the class GuiMannequinTabTexture method initGui.

@Override
public void initGui(int xPos, int yPos, int width, int height) {
    super.initGui(xPos, yPos, width, height);
    textureTypeList = new GuiDropDownList(0, width / 2 - 110, 25, 50, "", this);
    textureTypeList.addListItem(GuiHelper.getLocalizedControlName(tileEntity.getInventoryName(), "dropdown.user"), TextureType.USER.toString(), true);
    textureTypeList.addListItem(GuiHelper.getLocalizedControlName(tileEntity.getInventoryName(), "dropdown.url"), TextureType.URL.toString(), true);
    textureTypeList.setListSelectedIndex(tileEntity.getTextureType().ordinal());
    nameTextbox = new GuiTextField(fontRenderer, width / 2 - 110 + 55, 25, 165, 14);
    nameTextbox.setMaxStringLength(300);
    if (tileEntity.getTextureType() == TextureType.USER) {
        if (tileEntity.getGameProfile() != null) {
            nameTextbox.setText(tileEntity.getGameProfile().getName());
        }
    } else {
        if (tileEntity.getImageUrl() != null) {
            nameTextbox.setText(tileEntity.getImageUrl());
        }
    }
    setNameButton = new GuiButtonExt(0, width / 2 + 60, 45, 50, 14, GuiHelper.getLocalizedControlName(tileEntity.getInventoryName(), "set"));
    setNameButton.width = fontRenderer.getStringWidth(setNameButton.displayString + "  ");
    setNameButton.xPosition = width / 2 + TAB_WIDTH / 2 - setNameButton.width - 10;
    buttonList.add(textureTypeList);
    buttonList.add(setNameButton);
}
Also used : GuiDropDownList(riskyken.armourersWorkshop.client.gui.controls.GuiDropDownList) GuiButtonExt(cpw.mods.fml.client.config.GuiButtonExt) GuiTextField(net.minecraft.client.gui.GuiTextField)

Example 55 with GuiTextField

use of net.minecraft.client.gui.GuiTextField in project BiomesOPlenty by Glitchfiend.

the class GuiBOPPageTable method keyTyped.

@Override
public void keyTyped(char typedChar, int keyCode) {
    if (this.focusedGui instanceof GuiTextField) {
        GuiTextField guitextfield = (GuiTextField) this.focusedGui;
        int j;
        // Check if aren't we are pasting text
        if (!GuiScreen.isKeyComboCtrlV(keyCode)) {
            if (// Tab is pressed
            keyCode == 15) {
                guitextfield.setFocused(false);
                int focusedGuiIndex = this.allTextFieldGuis.indexOf(this.focusedGui);
                if (GuiScreen.isShiftKeyDown()) {
                    if (// Jump back to the end of the list when at the start
                    focusedGuiIndex == 0) {
                        focusedGuiIndex = this.allTextFieldGuis.size() - 1;
                    } else {
                        // Cycle backwards through the text fields
                        --focusedGuiIndex;
                    }
                } else if (// Jump back to the start of the list when at the end
                focusedGuiIndex == this.allTextFieldGuis.size() - 1) {
                    focusedGuiIndex = 0;
                } else {
                    // Cycle forwards through the text fields
                    ++focusedGuiIndex;
                }
                this.focusedGui = this.allTextFieldGuis.get(focusedGuiIndex);
                guitextfield = (GuiTextField) this.focusedGui;
                guitextfield.setFocused(true);
                int k1 = guitextfield.y + this.slotHeight;
                j = guitextfield.y;
                if (k1 > this.bottom) {
                    this.amountScrolled += (float) (k1 - this.bottom);
                } else if (j < this.top) {
                    this.amountScrolled = (float) j;
                }
            } else {
                guitextfield.textboxKeyTyped(typedChar, keyCode);
            }
        } else {
            String s = GuiScreen.getClipboardString();
            String[] astring = s.split(";");
            j = this.allTextFieldGuis.indexOf(this.focusedGui);
            int k = j;
            String[] astring1 = astring;
            int l = astring.length;
            for (int i1 = 0; i1 < l; ++i1) {
                String s1 = astring1[i1];
                this.allTextFieldGuis.get(k).setText(s1);
                if (k == this.allTextFieldGuis.size() - 1) {
                    k = 0;
                } else {
                    ++k;
                }
                if (k == j) {
                    break;
                }
            }
        }
    }
}
Also used : GuiTextField(net.minecraft.client.gui.GuiTextField)

Aggregations

GuiTextField (net.minecraft.client.gui.GuiTextField)130 GuiButton (net.minecraft.client.gui.GuiButton)49 GuiButtonExt (net.minecraftforge.fml.client.config.GuiButtonExt)12 GuiCheckBox (net.minecraftforge.fml.client.config.GuiCheckBox)12 HoverChecker (net.minecraftforge.fml.client.config.HoverChecker)11 ItemStack (net.minecraft.item.ItemStack)9 List (java.util.List)8 GuiButtonThemed (betterquesting.api.client.gui.controls.GuiButtonThemed)5 Collectors (java.util.stream.Collectors)4 CaveConfigGui (cavern.client.config.CaveConfigGui)3 Config (cavern.config.Config)3 ArrayListExtended (cavern.util.ArrayListExtended)3 BlockMeta (cavern.util.BlockMeta)3 CaveFilters (cavern.util.CaveFilters)3 GuiButtonExt (cpw.mods.fml.client.config.GuiButtonExt)3 Map (java.util.Map)3 GuiDropDownList (riskyken.armourersWorkshop.client.gui.controls.GuiDropDownList)3 GuiButtonVariableDims (am2.guis.controls.GuiButtonVariableDims)2 GuiBigTextField (betterquesting.api.client.gui.controls.GuiBigTextField)2 CaveBiome (cavern.config.manager.CaveBiome)2