当前位置: 首页>>代码示例>>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;未经允许,请勿转载。