當前位置: 首頁>>代碼示例>>Java>>正文


Java ChatAllowedCharacters.isAllowedCharacter方法代碼示例

本文整理匯總了Java中net.minecraft.util.ChatAllowedCharacters.isAllowedCharacter方法的典型用法代碼示例。如果您正苦於以下問題:Java ChatAllowedCharacters.isAllowedCharacter方法的具體用法?Java ChatAllowedCharacters.isAllowedCharacter怎麽用?Java ChatAllowedCharacters.isAllowedCharacter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.util.ChatAllowedCharacters的用法示例。


在下文中一共展示了ChatAllowedCharacters.isAllowedCharacter方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: keyTyped

import net.minecraft.util.ChatAllowedCharacters; //導入方法依賴的package包/類
protected void keyTyped(char typedChar, int keyCode) throws IOException
{
    if (keyCode == 14 && !this.text.isEmpty())
    {
        this.text = this.text.substring(0, this.text.length() - 1);
    }

    if (ChatAllowedCharacters.isAllowedCharacter(typedChar) && this.fontRendererObj.getStringWidth(this.text + typedChar) <= 90)
    {
        this.text = this.text + typedChar;
    }


    if (keyCode == 1 || keyCode== Keyboard.KEY_RETURN)
    {
        this.actionPerformed(this.doneBtn);
    }
}
 
開發者ID:Drazuam,項目名稱:RunicArcana,代碼行數:19,代碼來源:GuiPaperScrap.java

示例2: isValid

import net.minecraft.util.ChatAllowedCharacters; //導入方法依賴的package包/類
public boolean isValid(String string)
{
    if (string.length() > 0 && ChatAllowedCharacters.isAllowedCharacter(string.charAt(string.length() - 1)))
    {
        try
        {
            Integer.parseInt(string);
            return true;
        }
        catch (Exception e)
        {
            return false;
        }
    }
    else
    {
        return false;
    }
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:20,代碼來源:GuiLaunchController.java

示例3: writeChar

import net.minecraft.util.ChatAllowedCharacters; //導入方法依賴的package包/類
@Override
public T writeChar(char c) {
    if (!ChatAllowedCharacters.isAllowedCharacter(c)) {
        return getThis();
    }

    deleteSelectedText();

    if (text.length() >= maxLength) {
        return getThis();
    }

    text = text.substring(0, cursorPos) + c + text.substring(cursorPos);
    selectionPos = ++cursorPos;

    return getThis();
}
 
開發者ID:ReplayMod,項目名稱:jGui,代碼行數:18,代碼來源:AbstractGuiTextField.java

示例4: keyTyped

import net.minecraft.util.ChatAllowedCharacters; //導入方法依賴的package包/類
@Override
protected void keyTyped(char c, int i)
{
    if (i == 28)
    {
        mc.displayGuiScreen(null);
    }

    if (i == 14 && nameText.length() > 0)
    {
        nameText = nameText.substring(0, nameText.length() - 1);
    }

    if (ChatAllowedCharacters.isAllowedCharacter(c) && nameText.length() < 12)
    {
        nameText += c;
    }
}
 
開發者ID:allaryin,項目名稱:FairyFactions,代碼行數:19,代碼來源:GuiName.java

示例5: keyTypedInngt

import net.minecraft.util.ChatAllowedCharacters; //導入方法依賴的package包/類
private void keyTypedInngt(char p_keyTypedInngt_1_, int p_keyTypedInngt_2_) {
    switch(p_keyTypedInngt_1_) {
        case '\u0016':
            this.func_146459_b(GuiScreen.getClipboardString());
            return;
        default:
            switch(p_keyTypedInngt_2_) {
                case 14:
                    String var3 = this.func_146456_p();
                    if (var3.length() > 0) {
                        this.func_146457_a(var3.substring(0, var3.length() - 1));
                    }

                    return;
                case 28:
                case 156:
                    this.func_146459_b("\n");
                    return;
                default:
                    if (ChatAllowedCharacters.isAllowedCharacter(p_keyTypedInngt_1_)) {
                        this.func_146459_b(Character.toString(p_keyTypedInngt_1_));
                    }
            }
    }
}
 
開發者ID:NSDN,項目名稱:NyaSamaRailway,代碼行數:26,代碼來源:GuiNGTablet.java

示例6: keyTyped

import net.minecraft.util.ChatAllowedCharacters; //導入方法依賴的package包/類
public void keyTyped(char character, int key) {
    if (isTextEditing && editable != null) {
        ///Reset is just in case
        //setEditable(editable);
        if (key == 203) {
            cursorLeft(1);
        } else if (key == 205) {
            cursorRight(1);
        } else if (character == 22) {
            add(GuiScreen.getClipboardString());
        } else if (key == 14) {
            delete(-1);
        } else if (key == 211) {
            delete(0);
        } else if (key == 28 || key == 156) {
            add("\n");
        } else if (ChatAllowedCharacters.isAllowedCharacter(character)) {
            add(Character.toString(character));
        }
        
        //Update the cache
        cachedPosition.put(editable, position);
    }
}
 
開發者ID:joshiejack,項目名稱:Progression,代碼行數:25,代碼來源:TextEditor.java

示例7: keyTyped

import net.minecraft.util.ChatAllowedCharacters; //導入方法依賴的package包/類
/**
 * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e).
 */
@Override
protected void keyTyped(char keyChar, int keyID) {
    if (keyID == Keyboard.KEY_UP) {
        editLine = editLine - 1 >= 0 ? editLine - 1 : entitySign.signText.length - 1;
    }

    if (keyID == Keyboard.KEY_DOWN || keyID == Keyboard.KEY_RETURN) {
        editLine = editLine + 1 < entitySign.signText.length ? editLine + 1 : 0;
    }

    if (keyID == Keyboard.KEY_BACK && entitySign.signText[editLine].length() > 0) {
        entitySign.signText[editLine] = entitySign.signText[editLine].substring(0,
                entitySign.signText[editLine].length() - 1);
    }

    if (ChatAllowedCharacters.isAllowedCharacter(keyChar) && entitySign.signText[editLine].length() < entitySign.maxcharPerLine) {
        entitySign.signText[editLine] = entitySign.signText[editLine] + keyChar;
    }
}
 
開發者ID:soultek101,項目名稱:projectzulu1.7.10-pre-1.3a,代碼行數:23,代碼來源:GuiTombstone.java

示例8: keyTypedInBook

import net.minecraft.util.ChatAllowedCharacters; //導入方法依賴的package包/類
/**
 * Processes keystrokes when editing the text of a book
 */
private void keyTypedInBook(char typedChar, int keyCode)
{
    if (GuiScreen.isKeyComboCtrlV(keyCode))
    {
        this.pageInsertIntoCurrent(GuiScreen.getClipboardString());
    }
    else
    {
        switch (keyCode)
        {
            case 14:
                String s = this.pageGetCurrent();

                if (s.length() > 0)
                {
                    this.pageSetCurrent(s.substring(0, s.length() - 1));
                }

                return;

            case 28:
            case 156:
                this.pageInsertIntoCurrent("\n");
                return;

            default:
                if (ChatAllowedCharacters.isAllowedCharacter(typedChar))
                {
                    this.pageInsertIntoCurrent(Character.toString(typedChar));
                }
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:37,代碼來源:GuiScreenBook.java

示例9: keyTypedInBook

import net.minecraft.util.ChatAllowedCharacters; //導入方法依賴的package包/類
/**
 * Processes keystrokes when editing the text of a book
 */
private void keyTypedInBook(char typedChar, int keyCode)
{
    if (GuiScreen.isKeyComboCtrlV(keyCode))
    {
        this.pageInsertIntoCurrent(GuiScreen.getClipboardString());
    }
    else
    {
        switch (keyCode)
        {
            case 14:
                String s = this.pageGetCurrent();

                if (!s.isEmpty())
                {
                    this.pageSetCurrent(s.substring(0, s.length() - 1));
                }

                return;
            case 28:
            case 156:
                this.pageInsertIntoCurrent("\n");
                return;
            default:

                if (ChatAllowedCharacters.isAllowedCharacter(typedChar))
                {
                    this.pageInsertIntoCurrent(Character.toString(typedChar));
                }
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:36,代碼來源:GuiScreenBook.java

示例10: keyTypedInTitle

import net.minecraft.util.ChatAllowedCharacters; //導入方法依賴的package包/類
/**
 * Processes keystrokes when editing the title of a book
 */
private void keyTypedInTitle(char p_146460_1_, int p_146460_2_) throws IOException
{
    switch (p_146460_2_)
    {
        case 14:
            if (!this.bookTitle.isEmpty())
            {
                this.bookTitle = this.bookTitle.substring(0, this.bookTitle.length() - 1);
                this.updateButtons();
            }

            return;

        case 28:
        case 156:
            if (!this.bookTitle.isEmpty())
            {
                this.sendBookToServer(true);
                this.mc.displayGuiScreen((GuiScreen)null);
            }

            return;

        default:
            if (this.bookTitle.length() < 16 && ChatAllowedCharacters.isAllowedCharacter(p_146460_1_))
            {
                this.bookTitle = this.bookTitle + Character.toString(p_146460_1_);
                this.updateButtons();
                this.bookIsModified = true;
            }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:36,代碼來源:GuiScreenBook.java

示例11: keyTyped

import net.minecraft.util.ChatAllowedCharacters; //導入方法依賴的package包/類
/**
 * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of
 * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code)
 */
protected void keyTyped(char typedChar, int keyCode) throws IOException
{
    if (keyCode == 200)
    {
        this.editLine = this.editLine - 1 & 3;
    }

    if (keyCode == 208 || keyCode == 28 || keyCode == 156)
    {
        this.editLine = this.editLine + 1 & 3;
    }

    String s = this.tileSign.signText[this.editLine].getUnformattedText();

    if (keyCode == 14 && s.length() > 0)
    {
        s = s.substring(0, s.length() - 1);
    }

    if (ChatAllowedCharacters.isAllowedCharacter(typedChar) && this.fontRendererObj.getStringWidth(s + typedChar) <= 90)
    {
        s = s + typedChar;
    }

    this.tileSign.signText[this.editLine] = new ChatComponentText(s);

    if (keyCode == 1)
    {
        this.actionPerformed(this.doneBtn);
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:36,代碼來源:GuiEditSign.java

示例12: keyTyped

import net.minecraft.util.ChatAllowedCharacters; //導入方法依賴的package包/類
/**
 * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of
 * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code)
 */
protected void keyTyped(char typedChar, int keyCode) throws IOException
{
    if (keyCode == 200)
    {
        this.editLine = this.editLine - 1 & 3;
    }

    if (keyCode == 208 || keyCode == 28 || keyCode == 156)
    {
        this.editLine = this.editLine + 1 & 3;
    }

    String s = this.tileSign.signText[this.editLine].getUnformattedText();

    if (keyCode == 14 && !s.isEmpty())
    {
        s = s.substring(0, s.length() - 1);
    }

    if (ChatAllowedCharacters.isAllowedCharacter(typedChar) && this.fontRendererObj.getStringWidth(s + typedChar) <= 90)
    {
        s = s + typedChar;
    }

    this.tileSign.signText[this.editLine] = new TextComponentString(s);

    if (keyCode == 1)
    {
        this.actionPerformed(this.doneBtn);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:36,代碼來源:GuiEditSign.java

示例13: keyTypedInBook

import net.minecraft.util.ChatAllowedCharacters; //導入方法依賴的package包/類
/**
 * Processes keystrokes when editing the text of a book
 */
private void keyTypedInBook(char typedChar, int keyCode)
{
    if (GuiScreen.isKeyComboCtrlV(keyCode))
    {
        this.pageInsertIntoCurrent(GuiScreen.getClipboardString());
    }
    else
    {
        switch (keyCode)
        {
            case 14:
                String s = this.pageGetCurrent();

                if (!s.isEmpty())
                {
                    this.pageSetCurrent(s.substring(0, s.length() - 1));
                }

                return;

            case 28:
            case 156:
                this.pageInsertIntoCurrent("\n");
                return;

            default:
                if (ChatAllowedCharacters.isAllowedCharacter(typedChar))
                {
                    this.pageInsertIntoCurrent(Character.toString(typedChar));
                }
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:37,代碼來源:GuiScreenBook.java

示例14: toRandom

import net.minecraft.util.ChatAllowedCharacters; //導入方法依賴的package包/類
/**
 * Make dis
 */
private String toRandom(final XFont font, final String text)
{
	String newText = "";
	final String allowedCharacters =
		"\u00c0\u00c1\u00c2\u00c8\u00ca\u00cb\u00cd\u00d3\u00d4\u00d5\u00da\u00df\u00e3\u00f5\u011f\u0130\u0131\u0152\u0153\u015e\u015f\u0174\u0175\u017e\u0207\u0000\u0000\u0000\u0000\u0000\u0000\u0000 !\"#$%&\'()*+,-./0123456789:;<=>[email protected][\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0000\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256b\u256a\u2518\u250c\u2588\u2584\u258c\u2590\u2580\u03b1\u03b2\u0393\u03c0\u03a3\u03c3\u03bc\u03c4\u03a6\u0398\u03a9\u03b4\u221e\u2205\u2208\u2229\u2261\u00b1\u2265\u2264\u2320\u2321\u00f7\u2248\u00b0\u2219\u00b7\u221a\u207f\u00b2\u25a0\u0000";
	for(final char c : text.toCharArray())
		if(ChatAllowedCharacters.isAllowedCharacter(c))
		{
			final int index =
				fontRandom.nextInt(allowedCharacters.length());
			newText += allowedCharacters.toCharArray()[index];
		}
	return newText;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:18,代碼來源:XFontRenderer.java

示例15: isValid

import net.minecraft.util.ChatAllowedCharacters; //導入方法依賴的package包/類
public boolean isValid(String string)
{
    if (this.numericOnly)
    {
        if (string.length() > 0 && ChatAllowedCharacters.isAllowedCharacter(string.charAt(string.length() - 1)))
        {
            try
            {
                Integer.parseInt(string);
                return true;
            }
            catch (Exception e)
            {
                return false;
            }
        }
        else
        {
            return false;
        }
    }
    else
    {
        if (string.length() <= 0)
        {
            return false;
        }

        return ChatAllowedCharacters.isAllowedCharacter(string.charAt(string.length() - 1));
    }
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:32,代碼來源:GuiElementTextBox.java


注:本文中的net.minecraft.util.ChatAllowedCharacters.isAllowedCharacter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。