本文整理汇总了Java中net.minecraft.util.ChatAllowedCharacters.filterAllowedCharacters方法的典型用法代码示例。如果您正苦于以下问题:Java ChatAllowedCharacters.filterAllowedCharacters方法的具体用法?Java ChatAllowedCharacters.filterAllowedCharacters怎么用?Java ChatAllowedCharacters.filterAllowedCharacters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.util.ChatAllowedCharacters
的用法示例。
在下文中一共展示了ChatAllowedCharacters.filterAllowedCharacters方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: writeText
import net.minecraft.util.ChatAllowedCharacters; //导入方法依赖的package包/类
/**
* Adds the given text after the cursor, or replaces the currently selected
* text if there is a selection.
*/
public void writeText(String textToWrite)
{
String s = "";
String s1 = ChatAllowedCharacters.filterAllowedCharacters(textToWrite);
int i = cursorPosition < selectionEnd ? cursorPosition : selectionEnd;
int j = cursorPosition < selectionEnd ? selectionEnd : cursorPosition;
int k = maxStringLength - text.length() - (i - j);
if(!text.isEmpty())
s = s + text.substring(0, i);
int l;
if(k < s1.length())
{
s = s + s1.substring(0, k);
l = k;
}else
{
s = s + s1;
l = s1.length();
}
if(!text.isEmpty() && j < text.length())
s = s + text.substring(j);
if(validator.apply(s))
{
text = s;
moveCursorBy(i - selectionEnd + l);
func_190516_a(id, text);
}
}
示例3: writeText
import net.minecraft.util.ChatAllowedCharacters; //导入方法依赖的package包/类
/**
* Adds the given text after the cursor, or replaces the currently selected text if there is a selection.
*/
public void writeText(String textToWrite) {
String s = "";
String s1 = ChatAllowedCharacters.filterAllowedCharacters(textToWrite);
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 - j);
if (!this.text.isEmpty()) {
s = s + this.text.substring(0, i);
}
int l;
if (k < s1.length()) {
s = s + s1.substring(0, k);
l = k;
} else {
s = s + s1;
l = s1.length();
}
if (!this.text.isEmpty() && j < this.text.length()) {
s = s + this.text.substring(j);
}
if (this.validator.apply(s)) {
this.text = s;
this.moveCursorBy(i - this.selectionEnd + l);
this.setResponderEntryValue(this.id, this.text);
}
}
示例4: writeText
import net.minecraft.util.ChatAllowedCharacters; //导入方法依赖的package包/类
/**
* replaces selected text, or inserts text at the position on the cursor
*/
public void writeText(String text) {
String s = "";
String s1 = ChatAllowedCharacters.filterAllowedCharacters(text);
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 - j);
int l;
if (this.text.length() > 0) {
s = s + this.text.substring(0, i);
}
if (k < s1.length()) {
s = s + s1.substring(0, k);
l = k;
} else {
s = s + s1;
l = s1.length();
}
if (this.text.length() > 0 && j < this.text.length()) {
s = s + this.text.substring(j);
}
if (this.validator.test(s)) {
this.text = s;
this.moveCursorBy(i - this.selectionEnd + l);
if (this.guiResponder != null) {
this.guiResponder.func_175319_a(this.id, this.text);
}
}
}
示例5: writeText
import net.minecraft.util.ChatAllowedCharacters; //导入方法依赖的package包/类
/**
* Adds the given text after the cursor, or replaces the currently selected text if there is a selection.
*/
public void writeText(String textToWrite)
{
String s = "";
String s1 = ChatAllowedCharacters.filterAllowedCharacters(textToWrite);
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 - j);
if (!this.text.isEmpty())
{
s = s + this.text.substring(0, i);
}
int l;
if (k < s1.length())
{
s = s + s1.substring(0, k);
l = k;
}
else
{
s = s + s1;
l = s1.length();
}
if (!this.text.isEmpty() && j < this.text.length())
{
s = s + this.text.substring(j);
}
if (this.validator.apply(s))
{
this.text = s;
this.moveCursorBy(i - this.selectionEnd + l);
this.func_190516_a(this.id, this.text);
}
}
示例6: 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);
}
示例7: writeText
import net.minecraft.util.ChatAllowedCharacters; //导入方法依赖的package包/类
/**
* Adds the given text after the cursor, or replaces the currently selected text if there is a selection.
*/
public void writeText(String textToWrite) {
String s = "";
String s1 = ChatAllowedCharacters.filterAllowedCharacters(textToWrite);
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 - j);
if (!this.text.isEmpty()) {
s = s + this.text.substring(0, i);
}
int l;
if (k < s1.length()) {
s = s + s1.substring(0, k);
l = k;
}
else {
s = s + s1;
l = s1.length();
}
if (!this.text.isEmpty() && j < this.text.length()) {
s = s + this.text.substring(j);
}
if (this.validator.apply(s)) {
this.text = s;
this.moveCursorBy(i - this.selectionEnd + l);
this.setResponderEntryValue(this.id, this.text);
}
}
示例8: writeText
import net.minecraft.util.ChatAllowedCharacters; //导入方法依赖的package包/类
@Override
public void writeText(String text) {
String s1 = "";
String s2 = ChatAllowedCharacters.filterAllowedCharacters(text);
int i = cursorPosition < this.selectionEnd ? cursorPosition : this.selectionEnd;
int j = cursorPosition < this.selectionEnd ? this.selectionEnd : cursorPosition;
int k = this.maxRowLength - fontRendererInstance.getStringWidth(GuiMoarSign.getSignTextWithColor(new String[]{this.text})[0].getUnformattedText()) - (fontRendererInstance.getStringWidth(this.text.substring(0, i)) - fontRendererInstance.getStringWidth(this.text.substring(0, j)));
if (this.text.length() > 0) {
s1 = s1 + this.text.substring(0, i);
}
int l;
if (k < fontRendererInstance.getStringWidth(s2) && !isSpecial(s2)) {
String temp = fontRendererInstance.trimStringToWidth(s2, k);
s1 = s1 + temp;
l = temp.length();
} else {
s1 = s1 + s2;
l = s2.length();
}
if (l == 0 && isSpecial(s2)) {
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.getSelectionEnd() + l);
}
示例9: 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 s = "";
String s1 = ChatAllowedCharacters.filterAllowedCharacters(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 - j);
int l = 0;
if (this.text.length() > 0)
{
s = s + this.text.substring(0, i);
}
if (k < s1.length())
{
s = s + s1.substring(0, k);
l = k;
}
else
{
s = s + s1;
l = s1.length();
}
if (this.text.length() > 0 && j < this.text.length())
{
s = s + this.text.substring(j);
}
if (this.field_175209_y.apply(s))
{
this.text = s;
this.moveCursorBy(i - this.selectionEnd + l);
if (this.field_175210_x != null)
{
this.field_175210_x.func_175319_a(this.id, this.text);
}
}
}
示例10: writeText
import net.minecraft.util.ChatAllowedCharacters; //导入方法依赖的package包/类
/**
* Adds the given text after the cursor, or replaces the currently selected text if there is a selection.
*/
public void writeText(String textToWrite)
{
String s = "";
String s1 = ChatAllowedCharacters.filterAllowedCharacters(textToWrite);
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 - j);
if (!this.text.isEmpty())
{
s = s + this.text.substring(0, i);
}
int l;
if (k < s1.length())
{
s = s + s1.substring(0, k);
l = k;
}
else
{
s = s + s1;
l = s1.length();
}
if (!this.text.isEmpty() && j < this.text.length())
{
s = s + this.text.substring(j);
}
if (this.validator.apply(s))
{
this.text = s;
this.moveCursorBy(i - this.selectionEnd + l);
if (this.guiResponder != null)
{
this.guiResponder.setEntryValue(this.id, this.text);
}
}
}
示例11: writeText
import net.minecraft.util.ChatAllowedCharacters; //导入方法依赖的package包/类
public void writeText(String newText) {
String s1 = "";
String s2 = ChatAllowedCharacters.filterAllowedCharacters(newText);
int i = this.cursorPosition < this.selectionEnd ? this.cursorPosition : this.selectionEnd;
int j = this.cursorPosition < this.selectionEnd ? this.selectionEnd : this.cursorPosition;
int k = this.maxStringLength - model.getTextLength() - (i - j);
// boolean flag = false;
if (model.getTextLength() > 0)
{
s1 = s1 + model.getText().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 (model.getTextLength() > 0 && j < model.getTextLength())
{
s1 = s1 + model.getText().substring(j);
}
if (this.field_175209_y.apply(s1))
{
model.setText(s1);
this.moveCursorBy(i - this.selectionEnd + l);
// if (this.field_175210_x != null)
// {
// this.field_175210_x.func_175319_a(this.ID, this.text);
// }
}
if(textChangedListener != null)
textChangedListener.call(this, model.getText());
}