• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ChatLine类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.minecraft.client.gui.ChatLine的典型用法代码示例。如果您正苦于以下问题:Java ChatLine类的具体用法?Java ChatLine怎么用?Java ChatLine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ChatLine类属于net.minecraft.client.gui包,在下文中一共展示了ChatLine类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
 
开发者ID:Team-Fruit,项目名称:SignPicture,代码行数:26,代码来源:CustomChatRender.java


示例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);
}
 
开发者ID:hvze,项目名称:Providence,代码行数:20,代码来源:CommandManager.java


示例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;
      }
   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:25,代码来源:GuiNewChat.java


示例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;
}
 
开发者ID:Team-Fruit,项目名称:SignPicture,代码行数:16,代码来源:CustomChatRender.java


示例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();
}
 
开发者ID:null-dev,项目名称:EvenWurse,代码行数:38,代码来源:AntiSpamMod.java


示例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);
		}
	}
}
 
开发者ID:NomNuggetNom,项目名称:mcpvp-mod,代码行数:12,代码来源:ChatCTF.java


示例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);
    }
}
 
开发者ID:NomNuggetNom,项目名称:mcpvp-mod,代码行数:12,代码来源:GuiSecondChat.java


示例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);
      }
   }

}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:38,代码来源:GuiNewChat.java


示例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);
   }

}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:11,代码来源:GuiNewChat.java


示例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();
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:9,代码来源:ChatClickData.java


示例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 + "]");
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-MC-1.12,代码行数:51,代码来源:AntiSpamMod.java


示例12: ChatInputEvent

import net.minecraft.client.gui.ChatLine; //导入依赖的package包/类
public ChatInputEvent(ITextComponent component, List<ChatLine> chatLines)
{
	this.component = component;
	this.chatLines = chatLines;
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-MC-1.12,代码行数:6,代码来源:ChatInputEvent.java


示例13: getChatLines

import net.minecraft.client.gui.ChatLine; //导入依赖的package包/类
public List<ChatLine> getChatLines()
{
	return chatLines;
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-MC-1.12,代码行数:5,代码来源:ChatInputEvent.java


示例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); }
    
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:65,代码来源:ZModpack.java


示例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;
}
 
开发者ID:Team-Fruit,项目名称:SignPicture,代码行数:5,代码来源:CustomChatRender.java


示例16: PicChatHook

import net.minecraft.client.gui.ChatLine; //导入依赖的package包/类
@CoreInvoke
public PicChatHook(final @Nonnull List<ChatLine> chatLinesHook) {
	this.chatLinesHook = chatLinesHook;
}
 
开发者ID:Team-Fruit,项目名称:SignPicture,代码行数:5,代码来源:CustomChatRender.java


示例17: ChatInputEvent

import net.minecraft.client.gui.ChatLine; //导入依赖的package包/类
public ChatInputEvent(IChatComponent component, List<ChatLine> chatLines) {
    this.component = component;
    this.chatLines = chatLines;
}
 
开发者ID:null-dev,项目名称:EvenWurse,代码行数:5,代码来源:ChatInputEvent.java


示例18: getChatLines

import net.minecraft.client.gui.ChatLine; //导入依赖的package包/类
public List<ChatLine> getChatLines() {
    return chatLines;
}
 
开发者ID:null-dev,项目名称:EvenWurse,代码行数:4,代码来源:ChatInputEvent.java


示例19: func_146236_a

import net.minecraft.client.gui.ChatLine; //导入依赖的package包/类
public IChatComponent func_146236_a(int p_146236_1_, int p_146236_2_)
  {
      if (!this.getChatOpen())
      {
          return null;
      }
      
ScaledResolution scaledresolution = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight);
int k = scaledresolution.getScaleFactor();
float f = this.func_146244_h();
int l = p_146236_1_ / k - 3;
int i1 = p_146236_2_ / k - 27;
l = MathHelper.floor_float(l / f);
i1 = MathHelper.floor_float(i1 / f);

if (l >= 0 && i1 >= 0)
{
    int j1 = Math.min(this.func_146232_i(), this.field_146253_i.size());

    if (l <= MathHelper.floor_float(this.func_146228_f() / this.func_146244_h()) && i1 < this.mc.fontRenderer.FONT_HEIGHT * j1 + j1)
    {
        int k1 = i1 / this.mc.fontRenderer.FONT_HEIGHT + this.field_146250_j;

        if (k1 >= 0 && k1 < this.field_146253_i.size())
        {
            ChatLine chatline = (ChatLine)this.field_146253_i.get(k1);
            int l1 = 0;
            Iterator iterator = chatline.func_151461_a().iterator();

            while (iterator.hasNext())
            {
                IChatComponent ichatcomponent = (IChatComponent)iterator.next();

                if (ichatcomponent instanceof ChatComponentText)
                {
                    l1 += this.mc.fontRenderer.getStringWidth(this.func_146235_b(((ChatComponentText)ichatcomponent).getChatComponentText_TextValue()));

                    if (l1 > l)
                    {
                        return ichatcomponent;
                    }
                }
            }
        }

        return null;
    }
	return null;
}
return null;
  }
 
开发者ID:NomNuggetNom,项目名称:mcpvp-mod,代码行数:52,代码来源:GuiSecondChat.java


示例20: func_73762_a

import net.minecraft.client.gui.ChatLine; //导入依赖的package包/类
public void func_73762_a(int p_73762_1_) {
   if(this.field_73772_a.field_71474_y.field_74343_n != 2) {
      int var2 = this.func_96127_i();
      boolean var3 = false;
      int var4 = 0;
      int var5 = this.field_96134_d.size();
      float var6 = this.field_73772_a.field_71474_y.field_74357_r * 0.9F + 0.1F;
      if(var5 > 0) {
         if(this.func_73760_d()) {
            var3 = true;
         }

         float var7 = this.func_96131_h();
         int var8 = MathHelper.func_76123_f((float)this.func_96126_f() / var7);
         GL11.glPushMatrix();
         GL11.glTranslatef(2.0F, 20.0F, 0.0F);
         GL11.glScalef(var7, var7, 1.0F);

         int var9;
         int var11;
         int var14;
         for(var9 = 0; var9 + this.field_73768_d < this.field_96134_d.size() && var9 < var2; ++var9) {
            ChatLine var10 = (ChatLine)this.field_96134_d.get(var9 + this.field_73768_d);
            if(var10 != null) {
               var11 = p_73762_1_ - var10.func_74540_b();
               if(var11 < 200 || var3) {
                  double var12 = (double)var11 / 200.0D;
                  var12 = 1.0D - var12;
                  var12 *= 10.0D;
                  if(var12 < 0.0D) {
                     var12 = 0.0D;
                  }

                  if(var12 > 1.0D) {
                     var12 = 1.0D;
                  }

                  var12 *= var12;
                  var14 = (int)(255.0D * var12);
                  if(var3) {
                     var14 = 255;
                  }

                  var14 = (int)((float)var14 * var6);
                  ++var4;
                  if(var14 > 3) {
                     byte var15 = 0;
                     int var16 = -var9 * 9;
                     func_73734_a(var15, var16 - 9, var15 + var8 + 4, var16, var14 / 2 << 24);
                     GL11.glEnable(3042);
                     String var17 = var10.func_74538_a();
                     if(!this.field_73772_a.field_71474_y.field_74344_o) {
                        var17 = StringUtils.func_76338_a(var17);
                     }

                     this.field_73772_a.field_71466_p.func_78261_a(var17, var15, var16 - 8, 16777215 + (var14 << 24));
                  }
               }
            }
         }

         if(var3) {
            var9 = this.field_73772_a.field_71466_p.field_78288_b;
            GL11.glTranslatef(-3.0F, 0.0F, 0.0F);
            int var18 = var5 * var9 + var5;
            var11 = var4 * var9 + var4;
            int var20 = this.field_73768_d * var11 / var5;
            int var13 = var11 * var11 / var18;
            if(var18 != var11) {
               var14 = var20 > 0?170:96;
               int var19 = this.field_73769_e?13382451:3355562;
               func_73734_a(0, -var20, 2, -var20 - var13, var19 + (var14 << 24));
               func_73734_a(2, -var20, 1, -var20 - var13, 13421772 + (var14 << 24));
            }
         }

         GL11.glPopMatrix();
      }
   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:81,代码来源:GuiNewChat.java



注:本文中的net.minecraft.client.gui.ChatLine类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RequestFilter类代码示例发布时间:2022-05-22
下一篇:
Java Scroll类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap