本文整理匯總了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());
}