本文整理汇总了Java中net.minecraft.client.gui.ChatLine类的典型用法代码示例。如果您正苦于以下问题:Java ChatLine类的具体用法?Java ChatLine怎么用?Java ChatLine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ChatLine类属于net.minecraft.client.gui包,在下文中一共展示了ChatLine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyChatLines
import net.minecraft.client.gui.ChatLine; //导入依赖的package包/类
public void applyChatLines(final @Nonnull List<ChatLine> lines) {
if (!lines.equals(this.linescache)) {
this.pendentryids.clear();
int updateCounterCreated = -1;
int chatLineID = -1;
{
final Set<EntryId> addedentries = Sets.newHashSet();
for (final ChatLine line : lines) {
updateCounterCreated = line.getUpdatedCounter();
chatLineID = line.getChatLineID();
final IChatComponent cc = line.func_151461_a();
final List<ClickEvent> clinks = getLinksFromChat(cc);
for (final ClickEvent clink : clinks) {
final EntryId entryid = new EntryIdBuilder().setURI(clink.getValue()).build();
if (!addedentries.contains(entryid))
this.pendentryids.add(entryid);
addedentries.add(entryid);
}
}
}
this.updateCounterCreated = updateCounterCreated;
this.chatLineID = chatLineID;
}
this.linescache = lines;
}
示例2: clearChat
import net.minecraft.client.gui.ChatLine; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Command({"clear", "cc"})
public void clearChat() {
GuiNewChat chat = Minecraft.getMinecraft().ingameGUI.getChatGUI();
List<ChatLine> tempList = new ArrayList<>();
for (ChatLine c : (ArrayList<ChatLine>) mc.ingameGUI.persistantChatGUI.field_146253_i) {
if (c.getChatComponent().getFormattedText().contains(Client.NAME)) {
tempList.add(c);
}
for (Method m : getMap().keySet()) {
Command command = m.getAnnotation(Command.class);
if (c.getChatComponent().getFormattedText().contains(command.value()[0]) && (c.getChatComponent().getFormattedText().contains("]") || c.getChatComponent().getFormattedText().contains("]") || c.getChatComponent().getFormattedText().contains(","))) {
tempList.add(c);
}
}
}
mc.ingameGUI.persistantChatGUI.field_146253_i.removeAll(tempList);
}
示例3: func_73766_a
import net.minecraft.client.gui.ChatLine; //导入依赖的package包/类
public ChatClickData func_73766_a(int p_73766_1_, int p_73766_2_) {
if(!this.func_73760_d()) {
return null;
} else {
ScaledResolution var3 = new ScaledResolution(this.field_73772_a.field_71474_y, this.field_73772_a.field_71443_c, this.field_73772_a.field_71440_d);
int var4 = var3.func_78325_e();
float var5 = this.func_96131_h();
int var6 = p_73766_1_ / var4 - 3;
int var7 = p_73766_2_ / var4 - 25;
var6 = MathHelper.func_76141_d((float)var6 / var5);
var7 = MathHelper.func_76141_d((float)var7 / var5);
if(var6 >= 0 && var7 >= 0) {
int var8 = Math.min(this.func_96127_i(), this.field_96134_d.size());
if(var6 <= MathHelper.func_76141_d((float)this.func_96126_f() / this.func_96131_h()) && var7 < this.field_73772_a.field_71466_p.field_78288_b * var8 + var8) {
int var9 = var7 / (this.field_73772_a.field_71466_p.field_78288_b + 1) + this.field_73768_d;
return new ChatClickData(this.field_73772_a.field_71466_p, (ChatLine)this.field_96134_d.get(var9), var6, var7 - (var9 - this.field_73768_d) * this.field_73772_a.field_71466_p.field_78288_b + var9);
} else {
return null;
}
} else {
return null;
}
}
}
示例4: hookDrawStringWithShadow
import net.minecraft.client.gui.ChatLine; //导入依赖的package包/类
@CoreInvoke
public static int hookDrawStringWithShadow(final @Nonnull FontRenderer font, final @Nonnull String str, final int x, final int y, final int color, final @Nonnull GuiNewChat chat, final @Nonnull ChatLine chatline, final int j2, final int opacity) {
if (chatline instanceof PicChatLine) {
final PicChatLine cline = (PicChatLine) chatline;
OpenGL.glPushMatrix();
OpenGL.glTranslatef(0f, j2, 0f);
OpenGL.glColor4i(255, 255, 255, opacity);
cline.draw(chat, font.FONT_HEIGHT);
OpenGL.glPopMatrix();
WRenderer.startTexture();
} else
// this.mc.fontRenderer.drawStringWithShadow(s, b0, j2-8, 16777215+(i2<<24));
font.drawStringWithShadow(str, x, y, color);
return 0;
}
示例5: onReceivedMessage
import net.minecraft.client.gui.ChatLine; //导入依赖的package包/类
@Override
public void onReceivedMessage(ChatInputEvent event) {
final List<ChatLine> chatLines = event.getChatLines();
new Thread(() -> {
try {
Thread.sleep(50);
if (chatLines.size() > 1) {
for (int i = chatLines.size() - 1; i >= 1; i--) {
for (int i2 = i - 1; i2 >= 0; i2--) {
// Fixes concurrent modification
if (chatLines.size() <= i) continue;
if (chatLines.get(i).getChatComponent().getUnformattedText()
.startsWith(chatLines.get(i2).getChatComponent().getUnformattedText())) {
if (chatLines.get(i).getChatComponent().getUnformattedText().endsWith("]") &&
chatLines.get(i).getChatComponent().getUnformattedText().contains(" [x")) {
int numberIndex1 = chatLines.get(i).getChatComponent().getUnformattedText()
.lastIndexOf(" [x") + 3;
int numberIndex2 =
chatLines.get(i).getChatComponent().getUnformattedText().length() - 1;
int number = Integer.valueOf(
chatLines.get(i).getChatComponent().getUnformattedText()
.substring(numberIndex1, numberIndex2));
chatLines.get(i2).getChatComponent().appendText(" [x" + (number + 1) + "]");
} else {
chatLines.get(i2).getChatComponent().appendText(" [x2]");
}
chatLines.remove(i);
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}, "AntiSpam").start();
}
示例6: handleAll
import net.minecraft.client.gui.ChatLine; //导入依赖的package包/类
public static void handleAll(ClientChatReceivedEvent event) {
// Removal of messages that appear in split chat.
for (Object chatLine : Main.secondChat.getMessages()) {
// The chat message in the second chat.
String oldMessage = ((ChatLine)chatLine).func_151461_a().getUnformattedText();
if (oldMessage.equals(event.message.getUnformattedText())) {
event.setCanceled(true);
}
}
}
示例7: refreshChat
import net.minecraft.client.gui.ChatLine; //导入依赖的package包/类
public void refreshChat()
{
this.field_146253_i.clear();
this.resetScroll();
for (int i = this.chatLines.size() - 1; i >= 0; --i)
{
ChatLine chatline = (ChatLine)this.chatLines.get(i);
this.func_146237_a(chatline.func_151461_a(), chatline.getChatLineID(), chatline.getUpdatedCounter(), true);
}
}
示例8: func_96129_a
import net.minecraft.client.gui.ChatLine; //导入依赖的package包/类
private void func_96129_a(String p_96129_1_, int p_96129_2_, int p_96129_3_, boolean p_96129_4_) {
boolean var5 = this.func_73760_d();
boolean var6 = true;
if(p_96129_2_ != 0) {
this.func_73759_c(p_96129_2_);
}
Iterator var7 = this.field_73772_a.field_71466_p.func_78271_c(p_96129_1_, MathHelper.func_76141_d((float)this.func_96126_f() / this.func_96131_h())).iterator();
while(var7.hasNext()) {
String var8 = (String)var7.next();
if(var5 && this.field_73768_d > 0) {
this.field_73769_e = true;
this.func_73758_b(1);
}
if(!var6) {
var8 = " " + var8;
}
var6 = false;
this.field_96134_d.add(0, new ChatLine(p_96129_3_, var8, p_96129_2_));
}
while(this.field_96134_d.size() > 100) {
this.field_96134_d.remove(this.field_96134_d.size() - 1);
}
if(!p_96129_4_) {
this.field_73771_c.add(0, new ChatLine(p_96129_3_, p_96129_1_.trim(), p_96129_2_));
while(this.field_73771_c.size() > 100) {
this.field_73771_c.remove(this.field_73771_c.size() - 1);
}
}
}
示例9: func_96132_b
import net.minecraft.client.gui.ChatLine; //导入依赖的package包/类
public void func_96132_b() {
this.field_96134_d.clear();
this.func_73764_c();
for(int var1 = this.field_73771_c.size() - 1; var1 >= 0; --var1) {
ChatLine var2 = (ChatLine)this.field_73771_c.get(var1);
this.func_96129_a(var2.func_74538_a(), var2.func_74539_c(), var2.func_74540_b(), true);
}
}
示例10: ChatClickData
import net.minecraft.client.gui.ChatLine; //导入依赖的package包/类
public ChatClickData(FontRenderer p_i1037_1_, ChatLine p_i1037_2_, int p_i1037_3_, int p_i1037_4_) {
this.field_78314_b = p_i1037_1_;
this.field_78315_c = p_i1037_2_;
this.field_78312_d = p_i1037_3_;
this.field_78313_e = p_i1037_4_;
this.field_78310_f = p_i1037_1_.func_78269_a(p_i1037_2_.func_74538_a(), p_i1037_3_);
this.field_78311_g = this.func_78307_h();
}
示例11: onReceivedMessage
import net.minecraft.client.gui.ChatLine; //导入依赖的package包/类
@Override
public void onReceivedMessage(ChatInputEvent event)
{
// check if chat history is empty
if(event.getChatLines().isEmpty())
return;
String newLine = event.getComponent().getUnformattedText();
int spamCounter = 1;
// count and remove duplicates of the new line
for(Iterator<ChatLine> itr = event.getChatLines().iterator(); itr
.hasNext();)
{
// find old lines that start with the new one
String line = itr.next().getChatComponent().getUnformattedText();
if(!line.startsWith(newLine))
continue;
// if the old line equals the new one, add 1 to the counter
if(line.length() == newLine.length())
spamCounter++;
else
{
// if the old line equals the new one plus added text, check if
// that text is a spam counter
// first check if it matches " [x.*]"
String addedText = line.substring(newLine.length());
if(!addedText.startsWith(" [x") || !addedText.endsWith("]"))
continue;
// then check if the counter value is a valid number
String oldSpamCounter =
addedText.substring(3, addedText.length() - 1);
if(!MiscUtils.isInteger(oldSpamCounter))
continue;
// if the old counter is valid, add its value to the new counter
spamCounter += Integer.parseInt(oldSpamCounter);
}
// remove the old line
itr.remove();
}
// if the new line exists more than once, add a spam counter to it
if(spamCounter > 1)
event.getComponent().appendText(" [x" + spamCounter + "]");
}
示例12: ChatInputEvent
import net.minecraft.client.gui.ChatLine; //导入依赖的package包/类
public ChatInputEvent(ITextComponent component, List<ChatLine> chatLines)
{
this.component = component;
this.chatLines = chatLines;
}
示例13: getChatLines
import net.minecraft.client.gui.ChatLine; //导入依赖的package包/类
public List<ChatLine> getChatLines()
{
return chatLines;
}
示例14: pingUpdateHandle
import net.minecraft.client.gui.ChatLine; //导入依赖的package包/类
/**
Called at each new client tick
note: used to be pingUpdateHandle()
*/
static void clientTick(EntityPlayerSP player) {
// notify mods
if (!initialized) return;
try {
// check state
if (getPlayer() == null) return;
if (getWorld() == null) return;
if (getRenderer() == null) return;
// keyboard state update
Keys.newTick();
// check world change
if (PC != getPlayerController()) {
PC = getPlayerController();
allowCheats = true;
allowFlying = true;
allowNoclip = !isMultiplayer();
chatWelcomed = !isMultiplayer();
worldChange();
}
List<ChatLine> chat = getChatLines();
if (!chatWelcomed && chat != null) { for (int line = 0; line < chat.size(); ++line) {
String msg = ZWrapper.getChatText(chat, line);
if (msg == null) continue;
if (msg == chatLast) break;
if (msg.contains("joined the game")) { chatWelcomed = true; continue; }
if (msg.contains("\u00a7f \u00a7f \u00a71 \u00a70 \u00a72 \u00a74"))
allowFlying = false;
if (msg.contains("\u00a7f \u00a7f \u00a72 \u00a70 \u00a74 \u00a78"))
allowCheats = false;
if (msg.contains("\u00a7f \u00a7f \u00a74 \u00a70 \u00a79 \u00a76"))
allowNoclip = allowFlying;
if (msg.matches(".*(\\W|^)no-z-fly(\\W|$).*"))
allowFlying = false;
if (msg.matches(".*(\\W|^)no-z-cheat(\\W|$).*"))
allowCheats = false;
if (msg.matches(".*(\\W|^)z-cheat(\\W|$).*"))
allowNoclip = allowFlying;
}
if (chat.size()>0) chatLast = getChatText(chat, 0);
}
// update logging
if (!isInMenu() && wasKeyPressedThisTick(keyClearDisplayedError)) {
setMessage("error", null);
}
// notify mods
for (ZMod mod : zombesMods)
try {
mod.notifyClientTick(player);
} catch (Exception e) {
err("in mod \""+mod.getName()+"\": update failed",e);
}
} catch(Exception error) { err("error: update-handle failed", error); }
}
示例15: PicChatID
import net.minecraft.client.gui.ChatLine; //导入依赖的package包/类
public PicChatID(final int id, final @Nonnull List<ChatLine> lines) {
this.id = id;
this.lines = lines;
}