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


Java ChatAllowedCharacters類代碼示例

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


ChatAllowedCharacters類屬於net.minecraft.util包,在下文中一共展示了ChatAllowedCharacters類的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: func_146314_g

import net.minecraft.util.ChatAllowedCharacters; //導入依賴的package包/類
private void func_146314_g()
{
    this.field_146336_i = this.field_146333_g.getText().trim();

    for (char c0 : ChatAllowedCharacters.allowedCharactersArray)
    {
        this.field_146336_i = this.field_146336_i.replace(c0, '_');
    }

    if (StringUtils.isEmpty(this.field_146336_i))
    {
        this.field_146336_i = "World";
    }

    this.field_146336_i = func_146317_a(this.mc.getSaveLoader(), this.field_146336_i);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:17,代碼來源:GuiCreateWorld.java

示例3: calcSaveDirName

import net.minecraft.util.ChatAllowedCharacters; //導入依賴的package包/類
/**
 * Determine a save-directory name from the world name
 */
private void calcSaveDirName()
{
    this.saveDirName = this.worldNameField.getText().trim();

    for (char c0 : ChatAllowedCharacters.ILLEGAL_FILE_CHARACTERS)
    {
        this.saveDirName = this.saveDirName.replace(c0, '_');
    }

    if (StringUtils.isEmpty(this.saveDirName))
    {
        this.saveDirName = "World";
    }

    this.saveDirName = getUncollidingSaveDirName(this.mc.getSaveLoader(), this.saveDirName);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:20,代碼來源:GuiCreateWorld.java

示例4: isValidCharacterForName

import net.minecraft.util.ChatAllowedCharacters; //導入依賴的package包/類
private static boolean isValidCharacterForName(char p_190301_0_, int p_190301_1_)
{
    boolean flag = true;

    for (int i : LEGAL_KEY_CODES)
    {
        if (i == p_190301_1_)
        {
            return true;
        }
    }

    for (char c0 : ChatAllowedCharacters.ILLEGAL_STRUCTURE_CHARACTERS)
    {
        if (c0 == p_190301_0_)
        {
            flag = false;
            break;
        }
    }

    return flag;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:24,代碼來源:GuiEditStructure.java

示例5: 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

示例6: func_146314_g

import net.minecraft.util.ChatAllowedCharacters; //導入依賴的package包/類
private void func_146314_g()
{
	this.field_146336_i = this.dimensionNameTextField.getText().trim();
	char[] achar = ChatAllowedCharacters.ILLEGAL_FILE_CHARACTERS;
	int i = achar.length;

	for (int j = 0; j < i; ++j)
	{
		char c0 = achar[j];
		this.field_146336_i = this.field_146336_i.replace(c0, '_');
	}

	if (StringUtils.isEmpty(this.field_146336_i))
	{
		this.field_146336_i = "World";
	}

	this.field_146336_i = func_146317_a(this.mc.getSaveLoader(), this.field_146336_i);
}
 
開發者ID:lumien231,項目名稱:Simple-Dimensions,代碼行數:20,代碼來源:GuiCreateDimension.java

示例7: 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

示例8: 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

示例9: 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

示例10: func_146191_b

import net.minecraft.util.ChatAllowedCharacters; //導入依賴的package包/類
public void func_146191_b(String p_146191_1_) {
    String var2 = "";
    String var3 = ChatAllowedCharacters.filterAllowedCharacters(p_146191_1_);
    int var4 = field_146224_r < field_146223_s ? field_146224_r : field_146223_s;
    int var5 = field_146224_r < field_146223_s ? field_146223_s : field_146224_r;
    int var6 = field_146217_k - field_146216_j.length() - (var4 - field_146223_s);
    if (field_146216_j.length() > 0) var2 = var2 + field_146216_j.substring(0, var4);

    int var8;

    if (var6 < var3.length()) {
        var2 = var2 + var3.substring(0, var6);
        var8 = var6;
    } else {
        var2 = var2 + var3;
        var8 = var3.length();
    }

    if (field_146216_j.length() > 0 && var5 < field_146216_j.length()) var2 = var2 + field_146216_j.substring(var5);

    field_146216_j = var2;
    func_146182_d(var4 - field_146223_s + var8);
}
 
開發者ID:null-dev,項目名稱:EvenWurse,代碼行數:24,代碼來源:GuiPasswordField.java

示例11: func_146314_g

import net.minecraft.util.ChatAllowedCharacters; //導入依賴的package包/類
private void func_146314_g()
{
    this.field_146336_i = this.field_146333_g.getText().trim();
    char[] var1 = ChatAllowedCharacters.allowedCharacters;
    int var2 = var1.length;

    for (int var3 = 0; var3 < var2; ++var3)
    {
        char var4 = var1[var3];
        this.field_146336_i = this.field_146336_i.replace(var4, '_');
    }

    if (MathHelper.stringNullOrLengthZero(this.field_146336_i))
    {
        this.field_146336_i = "World";
    }

    this.field_146336_i = func_146317_a(this.mc.getSaveLoader(), this.field_146336_i);
}
 
開發者ID:MinecraftModdedClients,項目名稱:Resilience-Client-Source,代碼行數:20,代碼來源:GuiCreateWorld.java

示例12: 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

示例13: writeText

import net.minecraft.util.ChatAllowedCharacters; //導入依賴的package包/類
public void writeText(String additionalText) {
	String newLine = "";
	String filteredText = ChatAllowedCharacters.filerAllowedCharacters(additionalText);
	int freeCharCount = this.maxStringLength - text[cursorLine].length();

	if (text[cursorLine].length() > 0)
		newLine = newLine + text[cursorLine].substring(0, cursorPosition);

	if (freeCharCount < filteredText.length())
		newLine = newLine + filteredText.substring(0, freeCharCount);
	else
		newLine = newLine + filteredText;

	if (text[cursorLine].length() > 0 && cursorPosition < text[cursorLine].length())
		newLine = newLine + text[cursorLine].substring(cursorPosition);

	text[cursorLine] = newLine;
	setCursorPosition(cursorPosition + filteredText.length(), cursorLine);
}
 
開發者ID:xbony2,項目名稱:Nuclear-Control,代碼行數:20,代碼來源:GuiTextArea.java

示例14: func_190301_b

import net.minecraft.util.ChatAllowedCharacters; //導入依賴的package包/類
private static boolean func_190301_b(char p_190301_0_, int p_190301_1_)
{
    boolean flag = true;

    for (int i : field_190302_a)
    {
        if (i == p_190301_1_)
        {
            return true;
        }
    }

    for (char c0 : ChatAllowedCharacters.field_189861_b)
    {
        if (c0 == p_190301_0_)
        {
            flag = false;
            break;
        }
    }

    return flag;
}
 
開發者ID:BlazeAxtrius,項目名稱:ExpandedRailsMod,代碼行數:24,代碼來源:GuiEditStructure.java

示例15: sendChatToPlayer

import net.minecraft.util.ChatAllowedCharacters; //導入依賴的package包/類
public static void sendChatToPlayer(String[] to, String message) {
    // remove illegal characters
    message = ChatAllowedCharacters.filerAllowedCharacters(message);

    // allow color, bold, italic, and underline formatting
    for (EnumChatFormatting formatting : EnumChatFormatting.values()) {
        message = message.replace(PREFIX + formatting.getFormattingCode(), formatting.toString());
    }

    final ChatComponentText msg = new ChatComponentText(message);
    for (String user : to) {
        final EntityPlayer player = MinecraftServer.getServer().getConfigurationManager().func_152612_a(user);
        if (player != null) {
            player.addChatComponentMessage(msg);
        }
    }
}
 
開發者ID:theoriginalbit,項目名稱:MoarPeripherals,代碼行數:18,代碼來源:ChatUtil.java


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