本文整理汇总了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);
}
示例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));
}
}
示例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);
}
示例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);
}
}
示例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()));
}
示例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();
}
}
示例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();
}
}
示例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);
}
}
示例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;
}
示例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);
}
示例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();
}
示例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);
}
}