Search in sources :

Example 1 with GuiNewChat

use of net.minecraft.client.gui.GuiNewChat in project ImmersiveEngineering by BluSunrize.

the class ChatUtils method sendClientNoSpamMessages.

//Credit goes to WayOfFlowingTime
@SideOnly(Side.CLIENT)
public static void sendClientNoSpamMessages(ITextComponent[] messages) {
    GuiNewChat chat = Minecraft.getMinecraft().ingameGUI.getChatGUI();
    for (int i = DELETION_ID + messages.length - 1; i <= lastAdded; i++) chat.deleteChatLine(i);
    for (int i = 0; i < messages.length; i++) chat.printChatMessageWithOptionalDeletion(messages[i], DELETION_ID + i);
    lastAdded = DELETION_ID + messages.length - 1;
}
Also used : GuiNewChat(net.minecraft.client.gui.GuiNewChat) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with GuiNewChat

use of net.minecraft.client.gui.GuiNewChat in project Bookshelf by Darkhax-Minecraft.

the class PlayerUtils method sendSpamlessMessage.

/**
     * Sends a spamless message to the chat. A spamless message is one that only shows up in
     * the chat once. If another version of the message were to be added to chat, the earlier
     * one would be removed.
     *
     * @param messageID A unique message ID used to separate your message from the others. It
     *        is highly recommended to use a random number to prevent conflicts with other mods
     *        doing similar things. Each message type should have it's own ID.
     * @param message The message to send to chat, this message will replace earlier messages
     *        in the gui that use the same ID.
     */
@SideOnly(Side.CLIENT)
public static void sendSpamlessMessage(int messageID, ITextComponent message) {
    final GuiNewChat chat = Minecraft.getMinecraft().ingameGUI.getChatGUI();
    chat.printChatMessageWithOptionalDeletion(message, messageID);
}
Also used : GuiNewChat(net.minecraft.client.gui.GuiNewChat) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

GuiNewChat (net.minecraft.client.gui.GuiNewChat)2 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)2