本文整理汇总了Java中net.minecraft.client.gui.GuiTextField.getText方法的典型用法代码示例。如果您正苦于以下问题:Java GuiTextField.getText方法的具体用法?Java GuiTextField.getText怎么用?Java GuiTextField.getText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.gui.GuiTextField
的用法示例。
在下文中一共展示了GuiTextField.getText方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onTick
import net.minecraft.client.gui.GuiTextField; //导入方法依赖的package包/类
@Override
public void onTick() {
if (this.repairGuiTask==null||!(this.repairGuiTask instanceof GuiRepair))
return;
final EntryId entryId = CurrentMode.instance.getEntryId();
if (!entryId.isNameable())
return;
try {
final GuiTextField textField = guiRepairTextField.get(this.repairGuiTask);
final ContainerRepair containerRepair = guiRepairContainer.get(this.repairGuiTask);
if (textField!=null&&containerRepair!=null) {
final String text = textField.getText();
if (!StringUtils.isEmpty(text)&&!StringUtils.equals(this.repairGuiTextFieldCache, text)) {
final String name = entryId.id();
Sign.setRepairName(name, textField, containerRepair);
this.repairGuiTextFieldCache = name;
}
}
return;
} catch (final Exception e) {
Log.notice(I18n.format("signpic.chat.error.place"));
}
Log.notice(I18n.format("signpic.chat.error.place"));
}
示例2: setCoords
import net.minecraft.client.gui.GuiTextField; //导入方法依赖的package包/类
private void setCoords(GuiTextField field, int index) {
if (field.getText() != null && !field.getText().trim().isEmpty()) {
int coord;
if (index == 0) {
coord = parseInt(tileEntity.getControlPanel().targetX, field.getText());
tileEntity.getControlPanel().targetX = coord;
}
else {
coord = parseInt(tileEntity.getControlPanel().targetZ, field.getText());
tileEntity.getControlPanel().targetZ = coord;
}
FissionWarfare.network.sendToServer(new ServerPacketHandler("set.coords%" + tileEntity.xCoord + "%" + tileEntity.yCoord + "%" + tileEntity.zCoord + "%" + index + "%" + coord));
}
}
示例3: action
import net.minecraft.client.gui.GuiTextField; //导入方法依赖的package包/类
@Override
public void action(GuiBase gui) {
GuiMoarSign guiM = (GuiMoarSign) gui;
String s = "moarsign";
for (GuiTextField textField : guiM.guiTextFields) {
s += "\u001D" + textField.getText();
}
if (GuiMoarSign.isShiftKeyDown()) {
s += "\u001E";
int[] sizes = guiM.rowSizes;
int[] locations = guiM.rowLocations;
boolean[] hidden = guiM.visibleRows;
boolean[] shadows = guiM.shadowRows;
for (int i = 0; i < 4; i++) {
s += (i > 0 ? "\u001F" : "") + sizes[i] + ":" + locations[i] + ":" + (hidden[i] ? 1 : 0) + ":" + (shadows[i] ? 1 : 0);
}
}
guiM.buttonErase.action(gui);
GuiScreen.setClipboardString(s + "\u001Dmoarsign");
}
示例4: action
import net.minecraft.client.gui.GuiTextField; //导入方法依赖的package包/类
@Override
public void action(GuiBase gui) {
GuiMoarSign guiM = (GuiMoarSign) gui;
String s = "moarsign";
for (GuiTextField textField : guiM.guiTextFields) {
s += "\u001D" + textField.getText();
}
if (GuiMoarSign.isShiftKeyDown()) {
s += "\u001E";
int[] sizes = guiM.rowSizes;
int[] locations = guiM.rowLocations;
boolean[] hidden = guiM.visibleRows;
boolean[] shadows = guiM.shadowRows;
for (int i = 0; i < 4; i++) {
s += (i > 0 ? "\u001F" : "") + sizes[i] + ":" + locations[i] + ":" + (hidden[i] ? 1 : 0) + ":" + (shadows[i] ? 1 : 0);
}
}
GuiScreen.setClipboardString(s + "\u001Dmoarsign");
}
示例5: makeField
import net.minecraft.client.gui.GuiTextField; //导入方法依赖的package包/类
GuiTextField makeField(int x, int y, int width, GuiTextField orig, int text_length) {
String text = orig == null ? "" : orig.getText();
int cornerX = (this.width - this.xSize) / 2;
int cornerY = (this.height - this.ySize) / 2;
GuiTextField ret = new GuiTextField(1337, this.fontRendererObj, cornerX + x, cornerY + y, width, 12);
ret.setTextColor(-1);
ret.setDisabledTextColour(-1);
ret.setEnableBackgroundDrawing(true);
ret.setMaxStringLength(text_length);
ret.setText(text);
return ret;
}
示例6: initGui
import net.minecraft.client.gui.GuiTextField; //导入方法依赖的package包/类
@Override
public void initGui() {
this.buttonList.add(new PokegearExit(1, this.width / 2 - 40, height / 2 - 60, 30, 30, ""));
streamTextBox = new GuiTextField(fontRendererObj, width / 2 - 100, height / 2 + 35, 200, 20);
streamTextBox.setMaxStringLength(1000);
streamTextBox.setText(" Insert URL Here");
url = streamTextBox.getText();
}
示例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: 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;
}
示例9: 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();
}