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


Java ChatAllowedCharacters.filerAllowedCharacters方法代碼示例

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


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

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

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

示例3: writeText

import net.minecraft.util.ChatAllowedCharacters; //導入方法依賴的package包/類
/**
 * replaces selected text, or inserts text at the position on the cursor
 */
public void writeText(String p_146191_1_)
{
    String s1 = "";
    String s2 = ChatAllowedCharacters.filerAllowedCharacters(p_146191_1_);
    int i = this.cursorPosition < this.selectionEnd ? this.cursorPosition : this.selectionEnd;
    int j = this.cursorPosition < this.selectionEnd ? this.selectionEnd : this.cursorPosition;
    int k = this.maxStringLength - this.text.length() - (i - this.selectionEnd);

    if (this.text.length() > 0)
    {
        s1 = s1 + this.text.substring(0, i);
    }

    int l;

    if (k < s2.length())
    {
        s1 = s1 + s2.substring(0, k);
        l = k;
    }
    else
    {
        s1 = s1 + s2;
        l = s2.length();
    }

    if (this.text.length() > 0 && j < this.text.length())
    {
        s1 = s1 + this.text.substring(j);
    }

    this.text = s1;
    this.moveCursorBy(i - this.selectionEnd + l);
}
 
開發者ID:Pishka,項目名稱:MineDonate,代碼行數:38,代碼來源:GuiGradientTextField.java

示例4: func_146191_b

import net.minecraft.util.ChatAllowedCharacters; //導入方法依賴的package包/類
public void func_146191_b(String p_146191_1_)
{
    String var2 = "";
    String var3 = ChatAllowedCharacters.filerAllowedCharacters(p_146191_1_);
    int var4 = this.field_146224_r < this.field_146223_s ? this.field_146224_r : this.field_146223_s;
    int var5 = this.field_146224_r < this.field_146223_s ? this.field_146223_s : this.field_146224_r;
    int var6 = this.field_146217_k - this.field_146216_j.length() - (var4 - this.field_146223_s);
    boolean var7 = false;

    if (this.field_146216_j.length() > 0)
    {
        var2 = var2 + this.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 (this.field_146216_j.length() > 0 && var5 < this.field_146216_j.length())
    {
        var2 = var2 + this.field_146216_j.substring(var5);
    }

    this.field_146216_j = var2;
    this.func_146182_d(var4 - this.field_146223_s + var8);
}
 
開發者ID:MinecraftModdedClients,項目名稱:Resilience-Client-Source,代碼行數:36,代碼來源:GuiPasswordBox.java

示例5: writeText

import net.minecraft.util.ChatAllowedCharacters; //導入方法依賴的package包/類
/**
 * replaces selected text, or inserts text at the position on the cursor
 */
public void writeText(String p_146191_1_)
{
    String s1 = "";
    String s2 = ChatAllowedCharacters.filerAllowedCharacters(p_146191_1_);
    int i = this.cursorPosition < this.selectionEnd ? this.cursorPosition : this.selectionEnd;
    int j = this.cursorPosition < this.selectionEnd ? this.selectionEnd : this.cursorPosition;
    int k = this.maxStringLength - this.text.length() - (i - this.selectionEnd);
    boolean flag = false;

    if (this.text.length() > 0)
    {
        s1 = s1 + this.text.substring(0, i);
    }

    int l;

    if (k < s2.length())
    {
        s1 = s1 + s2.substring(0, k);
        l = k;
    }
    else
    {
        s1 = s1 + s2;
        l = s2.length();
    }

    if (this.text.length() > 0 && j < this.text.length())
    {
        s1 = s1 + this.text.substring(j);
    }

    this.text = s1;
    this.moveCursorBy(i - this.selectionEnd + l);
}
 
開發者ID:CreativeMD,項目名稱:CraftingManager,代碼行數:39,代碼來源:GuiInput.java

示例6: writeText

import net.minecraft.util.ChatAllowedCharacters; //導入方法依賴的package包/類
/**
 * replaces selected text, or inserts text at the position on the cursor
 */
public void writeText(String par1Str) {
    String s1 = "";
    String s2 = ChatAllowedCharacters.filerAllowedCharacters(par1Str);
    int i = this.cursorPosition < this.selectionEnd ? this.cursorPosition : this.selectionEnd;
    int j = this.cursorPosition < this.selectionEnd ? this.selectionEnd : this.cursorPosition;
    int k = this.maxStringLength - this.text.length() - (i - this.selectionEnd);
    //        boolean flag = false;

    if (this.text.length() > 0) {
        s1 = s1 + this.text.substring(0, i);
    }

    int l;

    if (k < s2.length()) {
        s1 = s1 + s2.substring(0, k);
        l = k;
    } else {
        s1 = s1 + s2;
        l = s2.length();
    }

    if (this.text.length() > 0 && j < this.text.length()) {
        s1 = s1 + this.text.substring(j);
    }

    this.text = s1;
    this.moveCursorBy(i - this.selectionEnd + l);
}
 
開發者ID:CodingBadgers,項目名稱:bUpload,代碼行數:33,代碼來源:GuiPasswordField.java

示例7: setLabel

import net.minecraft.util.ChatAllowedCharacters; //導入方法依賴的package包/類
@LuaFunction
@MultiReturn
public Object[] setLabel(String str) {
    str = ChatAllowedCharacters.filerAllowedCharacters(str.trim());
    if (str.length() > MAX_LABEL_LENGTH) {
        return new Object[]{false, String.format(ERROR_LABEL, MAX_LABEL_LENGTH)};
    }
    label = str;
    return new Object[]{true};
}
 
開發者ID:theoriginalbit,項目名稱:MoarPeripherals,代碼行數:11,代碼來源:TileChatBox.java

示例8: setLabel

import net.minecraft.util.ChatAllowedCharacters; //導入方法依賴的package包/類
@LuaFunction
@MultiReturn
public Object[] setLabel(String str) {
    str = ChatAllowedCharacters.filerAllowedCharacters(str.trim());
    if (str.length() > MAX_LABEL_LENGTH) {
        return new Object[]{false, ""};
    }
    label = str;
    return new Object[]{true};
}
 
開發者ID:theoriginalbit,項目名稱:MoarPeripherals,代碼行數:11,代碼來源:TileChatBoxAdmin.java

示例9: keyTyped

import net.minecraft.util.ChatAllowedCharacters; //導入方法依賴的package包/類
@Override
protected void keyTyped(char ch, int keyCode) {
    if (ch == '\026') {
        String clipboard = getClipboardString();
        if (clipboard != null) {
            int newLineIndex1 = clipboard.indexOf("\r");
            int newLineIndex2 = clipboard.indexOf("\n");
            if ((newLineIndex1 >= 0) && (newLineIndex2 >= 0)) {
                clipboard = clipboard.substring(0, Math.max(newLineIndex1, newLineIndex2));
            } else if (newLineIndex1 >= 0) {
                clipboard = clipboard.substring(0, newLineIndex1);
            } else if (newLineIndex2 >= 0) {
                clipboard = clipboard.substring(0, newLineIndex2);
            }

            clipboard = ChatAllowedCharacters.filerAllowedCharacters(clipboard);

            if (!clipboard.isEmpty()) {
                if (clipboard.length() > 128) {
                    clipboard = clipboard.substring(0, 128);
                }

                tile.queueEventToTarget(ComputerCraft.EVENT.PASTE, clipboard);
            }
        }
        return;
    }
    // Escape was pressed
    if (keyCode == 1) {
        super.keyTyped(ch, keyCode);
    } else if (terminateTimer < 10 && shutdownTimer < 10 && rebootTimer < 10) {
        // A different key was pressed, queue it to the computer
        tile.queueEventToTarget(ComputerCraft.EVENT.KEY, keyCode);
        if (ChatAllowedCharacters.isAllowedCharacter(ch) && ch < '\256') {
            tile.queueEventToTarget(ComputerCraft.EVENT.CHAR, Character.toString(ch));
        }
    }
}
 
開發者ID:theoriginalbit,項目名稱:MoarPeripherals,代碼行數:39,代碼來源:GuiKeyboard.java

示例10: insertText

import net.minecraft.util.ChatAllowedCharacters; //導入方法依賴的package包/類
public void insertText(String p_insertText_1_)
{
    String s1 = "";
    String s2 = ChatAllowedCharacters.filerAllowedCharacters(p_insertText_1_);
    int i = this.cursorPos < this.highlightPos ? this.cursorPos : this.highlightPos;
    int j = this.cursorPos < this.highlightPos ? this.highlightPos : this.cursorPos;
    int k = this.maxLength - this.value.length() - (i - this.highlightPos);
    boolean flag = false;

    if (this.value.length() > 0)
    {
        s1 = s1 + this.value.substring(0, i);
    }

    int l;

    if (k < s2.length())
    {
        s1 = s1 + s2.substring(0, k);
        l = k;
    }
    else
    {
        s1 = s1 + s2;
        l = s2.length();
    }

    if (this.value.length() > 0 && j < this.value.length())
    {
        s1 = s1 + this.value.substring(j);
    }

    this.value = s1;
    this.moveCursor(i - this.highlightPos + l);
}
 
開發者ID:xtrafrancyz,項目名稱:Cauldron,代碼行數:36,代碼來源:RealmsEditBox.java

示例11: writeText

import net.minecraft.util.ChatAllowedCharacters; //導入方法依賴的package包/類
public void writeText(String p_146191_1_)
{
    String s1 = "";
    String s2 = ChatAllowedCharacters.filerAllowedCharacters(p_146191_1_);
    int i = this.cursorPosition < this.selectionEnd ? this.cursorPosition : this.selectionEnd;
    int j = this.cursorPosition < this.selectionEnd ? this.selectionEnd : this.cursorPosition;
    int k = this.maxStringLength - this.text.length() - (i - this.selectionEnd);
    boolean flag = false;

    if (this.text.length() > 0)
    {
        s1 = s1 + this.text.substring(0, i);
    }

    int l;

    if (k < s2.length())
    {
        s1 = s1 + s2.substring(0, k);
        l = k;
    }
    else
    {
        s1 = s1 + s2;
        l = s2.length();
    }

    if (this.text.length() > 0 && j < this.text.length())
    {
        s1 = s1 + this.text.substring(j);
    }

    this.text = s1;
    this.moveCursorBy(i - this.selectionEnd + l);
}
 
開發者ID:xtrafrancyz,項目名稱:Cauldron,代碼行數:36,代碼來源:GuiTextField.java

示例12: writeText

import net.minecraft.util.ChatAllowedCharacters; //導入方法依賴的package包/類
/**
 * replaces selected text, or inserts text at the position on the cursor
 */
public void writeText(String par1Str)
{
    String s1 = "";
    String s2 = ChatAllowedCharacters.filerAllowedCharacters(par1Str);
    int i = this.cursorPosition < this.selectionEnd ? this.cursorPosition : this.selectionEnd;
    int j = this.cursorPosition < this.selectionEnd ? this.selectionEnd : this.cursorPosition;
    int k = this.maxStringLength - this.text.length() - (i - this.selectionEnd);
    boolean flag = false;

    if (this.text.length() > 0)
    {
        s1 = s1 + this.text.substring(0, i);
    }

    int l;

    if (k < s2.length())
    {
        s1 = s1 + s2.substring(0, k);
        l = k;
    }
    else
    {
        s1 = s1 + s2;
        l = s2.length();
    }

    if (this.text.length() > 0 && j < this.text.length())
    {
        s1 = s1 + this.text.substring(j);
    }

    this.text = s1;
    this.moveCursorBy(i - this.selectionEnd + l);
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:39,代碼來源:GuiTextField.java

示例13: writeText

import net.minecraft.util.ChatAllowedCharacters; //導入方法依賴的package包/類
/**
 * replaces selected text, or inserts text at the position on the cursor
 */
public void writeText(String par1Str)
{
    String var2 = "";
    String var3 = ChatAllowedCharacters.filerAllowedCharacters(par1Str);
    int var4 = this.cursorPosition < this.selectionEnd ? this.cursorPosition : this.selectionEnd;
    int var5 = this.cursorPosition < this.selectionEnd ? this.selectionEnd : this.cursorPosition;
    int var6 = this.maxStringLength - this.text.length() - (var4 - this.selectionEnd);
    boolean var7 = false;

    if (this.text.length() > 0)
    {
        var2 = var2 + this.text.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 (this.text.length() > 0 && var5 < this.text.length())
    {
        var2 = var2 + this.text.substring(var5);
    }

    this.text = var2;
    this.moveCursorBy(var4 - this.selectionEnd + var8);
}
 
開發者ID:uzzaco2002,項目名稱:secri,代碼行數:39,代碼來源:GuiTextFieldTransparent.java


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