Search in sources :

Example 1 with IMixinGuiNewChat

use of cc.hyperium.mixins.client.gui.IMixinGuiNewChat in project Hyperium by HyperiumClient.

the class HyperiumGuiNewChat method setChatLine.

public void setChatLine(IChatComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, int scrollPos, boolean isScrolled, List<ChatLine> chatLineList, List<ChatLine> chatLines, Minecraft mc) {
    if (chatLineId != 0) {
        parent.deleteChatLine(chatLineId);
    }
    int i = MathHelper.floor_float((float) parent.getChatWidth() / parent.getChatScale());
    List<IChatComponent> list = GuiUtilRenderComponents.splitText(chatComponent, i, mc.fontRendererObj, false, false);
    boolean flag = parent.getChatOpen();
    list.forEach(ichatcomponent -> {
        if (flag && scrollPos > 0) {
            ((IMixinGuiNewChat) parent).setIsScrolled(isScrolled);
            parent.scroll(1);
        }
        chatLineList.add(0, new ChatLine(updateCounter, ichatcomponent, chatLineId));
    });
    while (chatLineList.size() > 500) {
        chatLineList.remove(chatLineList.size() - 1);
    }
    if (!displayOnly) {
        chatLines.add(0, new ChatLine(updateCounter, chatComponent, chatLineId));
        while (chatLines.size() > 500) {
            chatLines.remove(chatLines.size() - 1);
        }
    }
}
Also used : IChatComponent(net.minecraft.util.IChatComponent) IMixinGuiNewChat(cc.hyperium.mixins.client.gui.IMixinGuiNewChat) ChatLine(net.minecraft.client.gui.ChatLine)

Aggregations

IMixinGuiNewChat (cc.hyperium.mixins.client.gui.IMixinGuiNewChat)1 ChatLine (net.minecraft.client.gui.ChatLine)1 IChatComponent (net.minecraft.util.IChatComponent)1