-From 521e4ab58c81424c71ce297f4d4d102fc95de894 Mon Sep 17 00:00:00 2001
+From 6d0d8b83b14af2e859825a15d211e041c20f5a07 Mon Sep 17 00:00:00 2001
 From: Alexander01998 <contact.wurstimperium@gmail.com>
-Date: Fri, 13 Mar 2015 23:53:49 +0100
+Date: Sat, 14 Mar 2015 10:34:44 +0100
 Subject: [PATCH] Wurst
 
 ---

             this.selectServer(var4);
         }
diff --git a/src/net/minecraft/client/gui/GuiNewChat.java b/src/net/minecraft/client/gui/GuiNewChat.java
index 1614678..945dbf2 100644
--- a/src/net/minecraft/client/gui/GuiNewChat.java
+++ b/src/net/minecraft/client/gui/GuiNewChat.java
@@ -1,17 +1,24 @@
 package net.minecraft.client.gui;
 
 import com.google.common.collect.Lists;
+
 import java.util.Iterator;
 import java.util.List;
+
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.renderer.GlStateManager;
 import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.util.ChatComponentText;
 import net.minecraft.util.IChatComponent;
 import net.minecraft.util.MathHelper;
+
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 
+import tk.wurst_client.Client;
+import tk.wurst_client.module.Module;
+import tk.wurst_client.module.modules.AntiSpam;
+
 public class GuiNewChat extends Gui
 {
     private static final Logger logger = LogManager.getLogger();
@@ -90,7 +97,7 @@ public class GuiNewChat extends Gui
                                 drawRect(var15, var16 - 9, var15 + var8 + 4, var16, var14 / 2 << 24);
                                 String var17 = var10.getChatComponent().getFormattedText();
                                 GlStateManager.enableBlend();
-                                this.mc.fontRendererObj.func_175063_a(var17, (float)var15, (float)(var16 - 8), 16777215 + (var14 << 24));
+                                this.mc.fontRendererObj.drawStringWithShadow(var17, (float)var15, (float)(var16 - 8), 16777215 + (var14 << 24));
                                 GlStateManager.disableAlpha();
                                 GlStateManager.disableBlend();
                             }
@@ -143,6 +150,11 @@ public class GuiNewChat extends Gui
     {
         this.setChatLine(p_146234_1_, p_146234_2_, this.mc.ingameGUI.getUpdateCounter(), false);
         logger.info("[CHAT] " + p_146234_1_.getUnformattedText());
+    	//TODO: Client
+        for(Module eventModule : Client.wurst.moduleManager.activeModules)
+    	{
+    		eventModule.onReceivedMessage(p_146234_1_.getUnformattedText());
+    	}
     }
 
     private void setChatLine(IChatComponent p_146237_1_, int p_146237_2_, int p_146237_3_, boolean p_146237_4_)
@@ -168,6 +180,34 @@ public class GuiNewChat extends Gui
             }
         }
 
+        //TODO: Client
+        if(this.field_146253_i.size() > 1 && Client.wurst.moduleManager.getModuleFromClass(AntiSpam.class).getToggled())
+        {

+        		}
+        	}
+        }
+        while (this.field_146253_i.size() > 100)
+        {
+            this.field_146253_i.remove(this.field_146253_i.size() - 1);
+        }
+
+        if (!p_146237_4_)
+        {
+            this.chatLines.add(0, new ChatLine(p_146237_3_, p_146237_1_, p_146237_2_));
+
+            while (this.chatLines.size() > 100)
+            {
+                this.chatLines.remove(this.chatLines.size() - 1);
+            }
+        }
+    }
+
+    public void refreshChat()
+    {
+        this.field_146253_i.clear();
+        this.resetScroll();
+
+        for (int var1 = this.chatLines.size() - 1; var1 >= 0; --var1)
+        {
+            ChatLine var2 = (ChatLine)this.chatLines.get(var1);
+            this.setChatLine(var2.getChatComponent(), var2.getChatLineID(), var2.getUpdatedCounter(), true);
+        }
+    }
+
+    /**
+     * Gets the list of messages previously sent through the chat GUI
+     */
+    public List getSentMessages()
+    {
+        return this.sentMessages;
+    }
+
+    /**
+     * Adds this string to the list of sent messages, for recall using the up/down arrow keys
+     */
+    public void addToSentMessages(String p_146239_1_)
+    {
+        if (this.sentMessages.isEmpty() || !((String)this.sentMessages.get(this.sentMessages.size() - 1)).equals(p_146239_1_))
+        {
+            this.sentMessages.add(p_146239_1_);
+        }
+    }
+
+    /**
+     * Resets the chat scroll (executed when the GUI is closed, among others)
+     */
+    public void resetScroll()
+    {
+        this.scrollPos = 0;
+        this.isScrolled = false;
+    }
+
+    /**
+     * Scrolls the chat by the given number of lines.
+     */
+    public void scroll(int p_146229_1_)
+    {
+        this.scrollPos += p_146229_1_;
+        int var2 = this.field_146253_i.size();
+
+        if (this.scrollPos > var2 - this.getLineCount())
+        {
+            this.scrollPos = var2 - this.getLineCount();
+        }
+
+        if (this.scrollPos <= 0)
+        {
+            this.scrollPos = 0;
+            this.isScrolled = false;
+        }
+    }
+
+    /**
+     * Gets the chat component under the mouse
+     */
+    public IChatComponent getChatComponent(int p_146236_1_, int p_146236_2_)
+    {
+        if (!this.getChatOpen())
+        {
+            return null;
+        }
+        else
+        {
+            ScaledResolution var3 = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight);
+            int var4 = var3.getScaleFactor();
+            float var5 = this.getChatScale();
+            int var6 = p_146236_1_ / var4 - 3;
+            int var7 = p_146236_2_ / var4 - 27;
+            var6 = MathHelper.floor_float((float)var6 / var5);
+            var7 = MathHelper.floor_float((float)var7 / var5);
+
+            if (var6 >= 0 && var7 >= 0)
+            {
+                int var8 = Math.min(this.getLineCount(), this.field_146253_i.size());
+
+                if (var6 <= MathHelper.floor_float((float)this.getChatWidth() / this.getChatScale()) && var7 < this.mc.fontRendererObj.FONT_HEIGHT * var8 + var8)
+                {
+                    int var9 = var7 / this.mc.fontRendererObj.FONT_HEIGHT + this.scrollPos;
+
+                    if (var9 >= 0 && var9 < this.field_146253_i.size())
+                    {
+                        ChatLine var10 = (ChatLine)this.field_146253_i.get(var9);
+                        int var11 = 0;
+                        Iterator var12 = var10.getChatComponent().iterator();
+
+                        while (var12.hasNext())
+                        {
+                            IChatComponent var13 = (IChatComponent)var12.next();
+
+                            if (var13 instanceof ChatComponentText)
+                            {
+                                var11 += this.mc.fontRendererObj.getStringWidth(GuiUtilRenderComponents.func_178909_a(((ChatComponentText)var13).getChatComponentText_TextValue(), false));
+
+                                if (var11 > var6)
+                                {
+                                    return var13;
+                                }
+                            }
+                        }
+                    }
+
+                    return null;
+                }
+                else
+                {
+                    return null;
+                }
+            }
+            else
+            {
+                return null;
+            }
+        }
+    }
+
+    /**
+     * Returns true if the chat GUI is open
+     */
+    public boolean getChatOpen()
+    {
+        return this.mc.currentScreen instanceof GuiChat;
+    }
+
+    /**
+     * finds and deletes a Chat line by ID
+     */
+    public void deleteChatLine(int p_146242_1_)
+    {
+        Iterator var2 = this.field_146253_i.iterator();
+        ChatLine var3;
+
+        while (var2.hasNext())
+        {
+            var3 = (ChatLine)var2.next();
+
+            if (var3.getChatLineID() == p_146242_1_)
+            {
+                var2.remove();
+            }
+        }
+
+        var2 = this.chatLines.iterator();
+
+        while (var2.hasNext())
+        {
+            var3 = (ChatLine)var2.next();
+
+            if (var3.getChatLineID() == p_146242_1_)
+            {
+                var2.remove();
+                break;
+            }
+        }
+    }
+
+    public int getChatWidth()
+    {
+        return calculateChatboxWidth(this.mc.gameSettings.chatWidth);
+    }
+
+    public int getChatHeight()
+    {
+        return calculateChatboxHeight(this.getChatOpen() ? this.mc.gameSettings.chatHeightFocused : this.mc.gameSettings.chatHeightUnfocused);
+    }
+
+    /**
+     * Returns the chatscale from mc.gameSettings.chatScale
+     */
+    public float getChatScale()
+    {
+        return this.mc.gameSettings.chatScale;
+    }
+
+    public static int calculateChatboxWidth(float p_146233_0_)
+    {
+        short var1 = 320;
+        byte var2 = 40;
+        return MathHelper.floor_float(p_146233_0_ * (float)(var1 - var2) + (float)var2);
+    }
+
+    public static int calculateChatboxHeight(float p_146243_0_)
+    {
+        short var1 = 180;
+        byte var2 = 20;
+        return MathHelper.floor_float(p_146243_0_ * (float)(var1 - var2) + (float)var2);
+    }
+
+    public int getLineCount()
+    {
+        return this.getChatHeight() / 9;
+    }
+}
diff --git a/src/net/minecraft/client/gui/GuiOptionButton.java b/src/net/minecraft/client/gui/GuiOptionButton.java
index 833c342..91e7357 100644
--- a/src/net/minecraft/client/gui/GuiOptionButton.java
