当前位置: 首页>>代码示例>>Java>>正文


Java GuiTextField.textboxKeyTyped方法代码示例

本文整理汇总了Java中net.minecraft.client.gui.GuiTextField.textboxKeyTyped方法的典型用法代码示例。如果您正苦于以下问题:Java GuiTextField.textboxKeyTyped方法的具体用法?Java GuiTextField.textboxKeyTyped怎么用?Java GuiTextField.textboxKeyTyped使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.client.gui.GuiTextField的用法示例。


在下文中一共展示了GuiTextField.textboxKeyTyped方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: keyTyped

import net.minecraft.client.gui.GuiTextField; //导入方法依赖的package包/类
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
 
	boolean textFocused = false;
	
	for (Gui control : this.controls) {
		if (control instanceof GuiTextField) {
			GuiTextField textField = (GuiTextField) control;
			if (textField.isFocused()) {
				textFocused = true;
				textField.textboxKeyTyped(typedChar, keyCode);
				break;
			}
		}
	}

	if (!textFocused || keyCode != Keyboard.KEY_E)
		super.keyTyped(typedChar, keyCode);
}
 
开发者ID:astronautlabs,项目名称:rezolve,代码行数:20,代码来源:GuiContainerBase.java

示例2: keyTyped

import net.minecraft.client.gui.GuiTextField; //导入方法依赖的package包/类
@Override
protected void keyTyped(char eventChar, int eventKey) {
	super.keyTyped(eventChar, eventKey);
	boolean cont = false;
	for (GuiTextField text : textFields.values()) {
		text.textboxKeyTyped(eventChar, eventKey);
		cont = !text.isFocused() || cont;
	}
	if (Config.listenOnMacroScreen)
		if (cont)
			if (Keyboard.getEventKeyState()) {
				String currentText = textFields.get("macros").getText();
				currentText = (currentText != null && currentText.length() >= 1 ? currentText+"," : "")+Keyboard.getKeyName(Keyboard.getEventKey());
				textFields.get("macros").setText(eliminateRepeats(currentText));
			}
}
 
开发者ID:austinv11,项目名称:MacroMaker,代码行数:17,代码来源:GuiMacro.java

示例3: keyTyped

import net.minecraft.client.gui.GuiTextField; //导入方法依赖的package包/类
@Override
protected void keyTyped(final char character, final int code) throws IOException {
    if (code == Keyboard.KEY_ESCAPE) {
        this.mc.displayGuiScreen(this.parentScreen);
        return;
    }

    for (final GuiButton button : this.buttonList) {
        if (button instanceof GuiNumericField) {
            final GuiNumericField numericField = (GuiNumericField) button;
            numericField.keyTyped(character, code);

            if (numericField.isFocused()) {
                actionPerformed(numericField);
            }
        }
    }

    for (final GuiTextField textField : this.textFields) {
        textField.textboxKeyTyped(character, code);
    }

    super.keyTyped(character, code);
}
 
开发者ID:Lunatrius,项目名称:LunatriusCore,代码行数:25,代码来源:GuiScreenBase.java

示例4: keyTyped

import net.minecraft.client.gui.GuiTextField; //导入方法依赖的package包/类
protected void keyTyped(char par1, int par2)
{
    for(GuiTextField field : secondPartFields)
    {
        if(field.isFocused())
            field.textboxKeyTyped(par1, par2);
    }
}
 
开发者ID:jglrxavpok,项目名称:CustomAI,代码行数:9,代码来源:GuiCustomAI.java

示例5: keyTyped

import net.minecraft.client.gui.GuiTextField; //导入方法依赖的package包/类
@Override
protected void keyTyped(char eventChar, int eventKey) {
	super.keyTyped(eventChar, eventKey);
	for (GuiTextField text : textFields.values())
		if (text.textboxKeyTyped(eventChar, eventKey))
			PeripheralsPlusPlus.NETWORK.sendToServer(new TextFieldInputEventPacket(UUID.fromString(Minecraft.getMinecraft().thePlayer.getCurrentArmor(3).getTagCompound().getString("identifier")), eventChar+"", text.getText(), "textboxEntry", Minecraft.getMinecraft().thePlayer.getDisplayName()));
	PeripheralsPlusPlus.NETWORK.sendToServer(new InputEventPacket(UUID.fromString(Minecraft.getMinecraft().thePlayer.getCurrentArmor(3).getTagCompound().getString("identifier")), Keyboard.getEventKey(), Keyboard.getEventKeyState(), "keyInput", Minecraft.getMinecraft().thePlayer.getDisplayName()));
}
 
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:9,代码来源:GuiHelmet.java

示例6: keyTyped

import net.minecraft.client.gui.GuiTextField; //导入方法依赖的package包/类
@Override
public void keyTyped(char character, int keyId) {
	for (GuiTextField field : this.textfieldList) {
		field.textboxKeyTyped(character, keyId);
	}

	if (keyId == Keyboard.KEY_ESCAPE) {
		this.mc.thePlayer.closeScreen();
	}
}
 
开发者ID:NovaViper,项目名称:ZeroQuest,代码行数:11,代码来源:GuiZertumInfo.java

示例7: keyTyped

import net.minecraft.client.gui.GuiTextField; //导入方法依赖的package包/类
@Override
protected void keyTyped(char typedChar, int key) {

    if (selectedTextField != -1) {
        int index = 0;
        for (GuiTextField textField : guiTextFields) {
            if (textField.isFocused())
                textField.textboxKeyTyped(typedChar, key);
            entitySign.signText[index++] = new TextComponentString(textField.getText());
        }
    }

    update();

    if (selectedTextField != -1) {
        if (key == 200) {
            guiTextFields[selectedTextField].setFocused(false);
            selectedTextField = selectedTextField - 1 < 0 ? 3 : selectedTextField - 1;
            guiTextFields[selectedTextField].setFocused(true);
        }

        if (key == 208 || key == 28 || key == 156) {
            guiTextFields[selectedTextField].setFocused(false);
            selectedTextField = selectedTextField + 1 > 3 ? 0 : selectedTextField + 1;
            guiTextFields[selectedTextField].setFocused(true);
        }
    }

    if (key == 1) {
        this.entitySign.markDirty();
        mc.thePlayer.closeScreen();
    }
}
 
开发者ID:GoryMoon,项目名称:MoarSigns,代码行数:34,代码来源:GuiMoarSign.java

示例8: keyTyped

import net.minecraft.client.gui.GuiTextField; //导入方法依赖的package包/类
private void keyTyped(GuiTextField field, char c, int code) {
	if (field instanceof GuiTextFieldCP && ((GuiTextFieldCP)field).isIdList) {
		if (c == ',' || (c >= '0' && c <= '9') || code == Keyboard.KEY_BACK) {
			field.textboxKeyTyped(c, code);
		}
	}
	else {
		field.textboxKeyTyped(c, code);
	}
}
 
开发者ID:uyjulian,项目名称:ControlPack,代码行数:11,代码来源:GuiControlPackOptions.java

示例9: correctIfInvalid

import net.minecraft.client.gui.GuiTextField; //导入方法依赖的package包/类
private boolean correctIfInvalid(GuiTextField guiTextField, String retainable, char keyChar, int keyID) {
    if (guiTextField.textboxKeyTyped(keyChar, keyID)) {
        String originalString = guiTextField.getText();
        String numericString = CharMatcher.anyOf(retainable).retainFrom(guiTextField.getText())
                .replaceAll("^0*", "");
        if (!originalString.equals(numericString)) {
            guiTextField.setText(numericString);
        }
        if (guiTextField.getText().length() == 0) {
            guiTextField.setText("0");
        }
        return true;
    }
    return false;
}
 
开发者ID:soultek101,项目名称:projectzulu1.7.10-pre-1.3a,代码行数:16,代码来源:SpawnerFields.java

示例10: keyTyped

import net.minecraft.client.gui.GuiTextField; //导入方法依赖的package包/类
@Override
protected void keyTyped(char eventChar, int eventKey) {
	super.keyTyped(eventChar, eventKey);
	for (GuiTextField text : textFields.values())
		text.textboxKeyTyped(eventChar, eventKey);
}
 
开发者ID:austinv11,项目名称:MacroMaker,代码行数:7,代码来源:GuiWaypoint.java

示例11: keyTyped

import net.minecraft.client.gui.GuiTextField; //导入方法依赖的package包/类
@Override
protected void keyTyped(char par1, int par2)
{
    if (par2 == 1 || par2 == this.mc.gameSettings.keyBindInventory.getKeyCode()) {
        this.mc.thePlayer.closeScreen();
    }
    if ((par1 < 48 || par1 > 57) && par1 != 8 && par1 != 0)
        return;

    GuiTextField textField = null;
    if (item1txt.isFocused())
    {
        textField = item1txt;
    }
    if (item2txt.isFocused())
    {
        textField = item2txt;
    }
    if (item3txt.isFocused())
    {
        textField = item3txt;
    }
    if(item4txt.isFocused())
    {
        textField = item4txt;
    }

    int cost = 0;
    if(textField.getText().length() > 0)
    {
        cost = Integer.parseInt(textField.getText());
    }

    if(cost > 999)
    {
        cost = 999;
        textField.setText(Integer.toString(cost));
    }
    else
    {
        textField.textboxKeyTyped(par1, par2);
        if(textField.getText() == "")
            textField.setText("0");
        String txt = textField.getText();
        if(txt.length() > 1)
        {
            if(txt.startsWith("0"))
            {
                textField.setText(txt.substring(1));
            }
        }
    }
    if(item1txt.getText().length() > 0)
        teRegister.slot1cost = Integer.parseInt(item1txt.getText());
    if(item2txt.getText().length() > 0)
        teRegister.slot2cost = Integer.parseInt(item2txt.getText());
    if(item3txt.getText().length() > 0)
        teRegister.slot3cost = Integer.parseInt(item3txt.getText());
    if(item4txt.getText().length() > 0)
        teRegister.slot4cost = Integer.parseInt(item4txt.getText());
    sendServerPacket();
}
 
开发者ID:shinaka,项目名称:Carthage,代码行数:63,代码来源:GuiRegister.java

示例12: keyTyped

import net.minecraft.client.gui.GuiTextField; //导入方法依赖的package包/类
private void keyTyped(GuiTextField field, char c, int code) {
	if (c == ',' || c == '_' || c == '-' || c == ' ' || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || code == Keyboard.KEY_BACK) {
		field.textboxKeyTyped(c, code);
	}
}
 
开发者ID:uyjulian,项目名称:ControlPack,代码行数:6,代码来源:GuiWaypoints.java


注:本文中的net.minecraft.client.gui.GuiTextField.textboxKeyTyped方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。