 -import java.util.Queue;
 -import java.util.Set;
 -import java.util.UUID;
-+import java.util.*;
- import java.util.concurrent.Callable;
- import java.util.concurrent.Executors;
- import java.util.concurrent.FutureTask;
-+
- import javax.imageio.ImageIO;
-+
- import net.minecraft.block.Block;
- import net.minecraft.block.material.Material;
- import net.minecraft.block.state.IBlockState;
- import net.minecraft.client.audio.MusicTicker;
- import net.minecraft.client.audio.SoundHandler;
- import net.minecraft.client.entity.EntityPlayerSP;
++import java.util.*;
+ import java.util.concurrent.Callable;
+ import java.util.concurrent.Executors;
+ import java.util.concurrent.FutureTask;
++
+ import javax.imageio.ImageIO;
++
+ import net.minecraft.block.Block;
+ import net.minecraft.block.material.Material;
+ import net.minecraft.block.state.IBlockState;
+ import net.minecraft.client.audio.MusicTicker;
+ import net.minecraft.client.audio.SoundHandler;
+ import net.minecraft.client.entity.EntityPlayerSP;
 -import net.minecraft.client.gui.FontRenderer;
 -import net.minecraft.client.gui.GuiChat;
 -import net.minecraft.client.gui.GuiControls;

From 5209eb48c00838dcf54c1b52decb098a45e41c68 Mon Sep 17 00:00:00 2001
From: Alexander01998 <contact.wurstimperium@gmail.com>
Date: Wed, 4 May 2016 21:26:32 +0200
Subject: [PATCH] Wurst

---
 .gitignore                                         |   1 +
 src/net/minecraft/block/Block.java                 |  17 +-
 src/net/minecraft/block/BlockCactus.java           |  11 +-
 src/net/minecraft/block/BlockLiquid.java           |  14 +-

-import net.minecraft.util.ResourceLocation;
-import net.minecraft.util.ScreenShotHelper;
-import net.minecraft.util.Session;
+import net.minecraft.util.*;
 import net.minecraft.util.Timer;
-import net.minecraft.util.Util;
 import net.minecraft.util.datafix.DataFixer;
 import net.minecraft.util.datafix.DataFixesManager;
 import net.minecraft.util.math.BlockPos;
@@ -180,6 +110,7 @@ import net.minecraft.world.chunk.storage.AnvilSaveConverter;
 import net.minecraft.world.storage.ISaveFormat;
 import net.minecraft.world.storage.ISaveHandler;
 import net.minecraft.world.storage.WorldInfo;
+
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.Validate;
 import org.apache.logging.log4j.LogManager;
@@ -196,10 +127,32 @@ import org.lwjgl.opengl.OpenGLException;
 import org.lwjgl.opengl.PixelFormat;
 import org.lwjgl.util.glu.GLU;
 
+import tk.wurst_client.WurstClient;
+import tk.wurst_client.events.LeftClickEvent;
+import tk.wurst_client.gui.main.GuiWurstMainMenu;
+import tk.wurst_client.hooks.FrameHook;
+import tk.wurst_client.spam.SpamProcessor;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Queues;
+import com.google.common.collect.Sets;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.ListenableFutureTask;
+import com.mojang.authlib.GameProfile;
+import com.mojang.authlib.GameProfileRepository;
+import com.mojang.authlib.minecraft.MinecraftSessionService;
+import com.mojang.authlib.properties.PropertyMap;
+import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
+
 public class Minecraft implements IThreadListener, ISnooperInfo
 {
     private static final Logger logger = LogManager.getLogger();
-    private static final ResourceLocation locationMojangPng = new ResourceLocation("textures/gui/title/mojang.png");
+    
+    // TODO: Client
+    private static final ResourceLocation locationMojangPng = new ResourceLocation("wurst/wurst_loading.png");
+    
     public static final boolean isRunningOnMac = Util.getOSType() == Util.EnumOS.OSX;
 
     /** A 10MiB preallocation to ensure the heap is reasonably sized. */
@@ -232,7 +185,7 @@ public class Minecraft implements IThreadListener, ISnooperInfo
 
     /** True if the player is connected to a realms server */
     private boolean connectedToRealms = false;
-    private Timer timer = new Timer(20.0F);
+    public Timer timer = new Timer(20.0F);
 
     /** Instance of PlayerUsageSnooper. */
     private Snooper usageSnooper = new Snooper("client", this, MinecraftServer.getCurrentTimeMillis());
@@ -245,7 +198,7 @@ public class Minecraft implements IThreadListener, ISnooperInfo
     private Entity renderViewEntity;
     public Entity pointedEntity;
     public EffectRenderer effectRenderer;
-    private final Session session;
+    public Session session;
     private boolean isGamePaused;
 
     /** The font renderer used for displaying and measuring text */
@@ -301,7 +254,7 @@ public class Minecraft implements IThreadListener, ISnooperInfo
     /**
      * When you place a block, it's set to 6, decremented once per tick, when it's 0, you can place another block.
      */
-    private int rightClickDelayTimer;
+    public int rightClickDelayTimer;
     private String serverName;
     private int serverPort;
 
@@ -586,13 +539,16 @@ public class Minecraft implements IThreadListener, ISnooperInfo
         this.checkGLError("Post startup");
         this.ingameGUI = new GuiIngame(this);
 
+        //TODO: Client
+        WurstClient.INSTANCE.startClient();
+
         if (this.serverName != null)
         {
-            this.displayGuiScreen(new GuiConnecting(new GuiMainMenu(), this, this.serverName, this.serverPort));
+            this.displayGuiScreen(new GuiConnecting(new GuiWurstMainMenu(), this, this.serverName, this.serverPort));
         }
         else
         {
-            this.displayGuiScreen(new GuiMainMenu());
+            this.displayGuiScreen(new GuiWurstMainMenu());
         }
 
         this.renderEngine.deleteTexture(this.mojangLogo);
@@ -670,6 +626,9 @@ public class Minecraft implements IThreadListener, ISnooperInfo
         else
         {
             Display.setDisplayMode(new DisplayMode(this.displayWidth, this.displayHeight));
+            
+            // TODO: Client
+        	FrameHook.createFrame(mcDefaultResourcePack, logger);
         }
     }
 
@@ -997,14 +956,14 @@ public class Minecraft implements IThreadListener, ISnooperInfo
 
         if (guiScreenIn == null && this.theWorld == null)
         {
-            guiScreenIn = new GuiMainMenu();
+            guiScreenIn = new GuiWurstMainMenu();
         }
         else if (guiScreenIn == null && this.thePlayer.getHealth() <= 0.0F)
         {
             guiScreenIn = new GuiGameOver((ITextComponent)null);
         }
 
-        if (guiScreenIn instanceof GuiMainMenu || guiScreenIn instanceof GuiMultiplayer)
+        if (guiScreenIn instanceof GuiWurstMainMenu || guiScreenIn instanceof GuiMultiplayer)
         {
             this.gameSettings.showDebugInfo = false;
             this.ingameGUI.getChatGUI().clearChatMessages();
@@ -1507,7 +1466,7 @@ public class Minecraft implements IThreadListener, ISnooperInfo
             this.leftClickCounter = 0;
         }
 
-        if (this.leftClickCounter <= 0 && !this.thePlayer.func_184587_cr())
+        if (this.leftClickCounter <= 0 && !this.thePlayer.isUsingItem())
         {
             if (leftClick && this.objectMouseOver != null && this.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK)
             {
@@ -1530,6 +1489,9 @@ public class Minecraft implements IThreadListener, ISnooperInfo
     {
         if (this.leftClickCounter <= 0)
         {
+            //TODO: Client
+        	WurstClient.INSTANCE.events.fireEvent(LeftClickEvent.class, new LeftClickEvent());
+        	
             if (this.objectMouseOver == null)
             {
                 logger.error("Null returned as \'hitResult\', this shouldn\'t happen!");
@@ -1563,7 +1525,7 @@ public class Minecraft implements IThreadListener, ISnooperInfo
                             this.leftClickCounter = 10;
                         }
 
-                        this.thePlayer.func_184821_cY();
+                        this.thePlayer.resetSwordCooldown();
                 }
 
                 this.thePlayer.swingArm(EnumHand.MAIN_HAND);
@@ -1571,12 +1533,12 @@ public class Minecraft implements IThreadListener, ISnooperInfo
         }
     }
 
-    @SuppressWarnings("incomplete-switch")
 
     /**
      * Called when user clicked he's mouse right button (place)
      */
-    private void rightClickMouse()
+    @SuppressWarnings("incomplete-switch")
+	public void rightClickMouse()
     {
         if (!this.playerController.getIsHittingBlock())
         {
@@ -1641,7 +1603,7 @@ public class Minecraft implements IThreadListener, ISnooperInfo
 
                     ItemStack itemstack1 = this.thePlayer.getHeldItem(enumhand);
 
-                    if (itemstack1 != null && this.playerController.func_187101_a(this.thePlayer, this.theWorld, itemstack1, enumhand) == EnumActionResult.SUCCESS)
+                    if (itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1, enumhand) == EnumActionResult.SUCCESS)
                     {
                         this.entityRenderer.itemRenderer.func_187460_a(enumhand);
                         return;
@@ -1803,7 +1765,9 @@ public class Minecraft implements IThreadListener, ISnooperInfo
             this.leftClickCounter = 10000;
         }
 
-        if (this.currentScreen != null)
+		// TODO: Client
+		if(this.currentScreen != null
+			&& !WurstClient.INSTANCE.mods.menuWalkMod.shouldAllowWalking())
         {
             try
             {
@@ -1845,7 +1809,9 @@ public class Minecraft implements IThreadListener, ISnooperInfo
             }
         }
 
-        if (this.currentScreen == null || this.currentScreen.allowUserInput)
+		// TODO: Client
+		if(this.currentScreen == null || this.currentScreen.allowUserInput
+			|| WurstClient.INSTANCE.mods.menuWalkMod.shouldAllowWalking())
         {
             this.mcProfiler.endStartSection("mouse");
             this.func_184124_aB();
@@ -1939,7 +1905,9 @@ public class Minecraft implements IThreadListener, ISnooperInfo
 
             this.mcProfiler.endStartSection("animateTick");
 
-            if (!this.isGamePaused && this.theWorld != null)
+            // TODO: Client
+            if (!this.isGamePaused && this.theWorld != null
+				&& !WurstClient.INSTANCE.mods.freecamMod.isActive())
             {
                 this.theWorld.doVoidFogParticles(MathHelper.floor_double(this.thePlayer.posX), MathHelper.floor_double(this.thePlayer.posY), MathHelper.floor_double(this.thePlayer.posZ));
             }
@@ -2005,6 +1973,17 @@ public class Minecraft implements IThreadListener, ISnooperInfo
 
                 if (this.currentScreen == null)
                 {
+					// TODO: Client
+					if(Keyboard.getEventKey() != 0)
+					{
+						TreeSet<String> eventCommands =
+							WurstClient.INSTANCE.keybinds.get(Keyboard
+								.getKeyName(Keyboard.getEventKey()));
+						if(eventCommands != null)
+							eventCommands.forEach((cmd) -> thePlayer
+								.sendAutomaticChatMessage(cmd));
+					}
+        			
                     if (i == 1)
                     {
                         this.displayInGameMenu();
@@ -2242,7 +2221,7 @@ public class Minecraft implements IThreadListener, ISnooperInfo
             }
         }
 
-        if (this.thePlayer.func_184587_cr())
+        if (this.thePlayer.isUsingItem())
         {
             if (!this.gameSettings.keyBindUseItem.isKeyDown())
             {
@@ -2290,7 +2269,7 @@ public class Minecraft implements IThreadListener, ISnooperInfo
             }
         }
 
-        if (this.gameSettings.keyBindUseItem.isKeyDown() && this.rightClickDelayTimer == 0 && !this.thePlayer.func_184587_cr())
+        if (this.gameSettings.keyBindUseItem.isKeyDown() && this.rightClickDelayTimer == 0 && !this.thePlayer.isUsingItem())
         {
             this.rightClickMouse();
         }
@@ -2440,6 +2419,10 @@ public class Minecraft implements IThreadListener, ISnooperInfo
         networkmanager.sendPacket(new C00Handshake(107, socketaddress.toString(), 0, EnumConnectionState.LOGIN));
         networkmanager.sendPacket(new CPacketLoginStart(this.getSession().getProfile()));
         this.myNetworkManager = networkmanager;
+        
+        //TODO: Client
+        SpamProcessor.runScript("joinworld", "Runs whenever you join a singleplayer world.");
+		WurstClient.INSTANCE.analytics.trackPageView("/play/singleplayer", "Singleplayer");
     }
 
     /**
@@ -2644,6 +2627,9 @@ public class Minecraft implements IThreadListener, ISnooperInfo
             }
             else
             {
+				// TODO: Client
+				WurstClient.INSTANCE.friends.middleClick(objectMouseOver.entityHit);
+				
                 if (this.objectMouseOver.typeOfHit != RayTraceResult.Type.ENTITY || this.objectMouseOver.entityHit == null || !flag)
                 {
                     return;
@@ -3387,7 +3373,7 @@ public class Minecraft implements IThreadListener, ISnooperInfo
         return this.dataFixer;
     }
 
-    public float func_184121_ak()
+    public float getPartialTicks()
     {
         return this.timer.renderPartialTicks;
     }
diff --git a/src/net/minecraft/client/audio/PositionedSoundRecord.java b/src/net/minecraft/client/audio/PositionedSoundRecord.java
index 20aa9ae..7e34e84 100644
--- a/src/net/minecraft/client/audio/PositionedSoundRecord.java
+++ b/src/net/minecraft/client/audio/PositionedSoundRecord.java
@@ -12,7 +12,7 @@ public class PositionedSoundRecord extends PositionedSound
         this(p_i46527_1_, p_i46527_2_, p_i46527_3_, p_i46527_4_, (float)p_i46527_5_.getX() + 0.5F, (float)p_i46527_5_.getY() + 0.5F, (float)p_i46527_5_.getZ() + 0.5F);
     }
 
-    public static PositionedSoundRecord func_184371_a(SoundEvent p_184371_0_, float p_184371_1_)
+    public static PositionedSoundRecord createPositionedSoundRecord(SoundEvent p_184371_0_, float p_184371_1_)
     {
         return new PositionedSoundRecord(p_184371_0_, SoundCategory.MASTER, 0.25F, p_184371_1_, false, 0, ISound.AttenuationType.NONE, 0.0F, 0.0F, 0.0F);
     }
diff --git a/src/net/minecraft/client/entity/AbstractClientPlayer.java b/src/net/minecraft/client/entity/AbstractClientPlayer.java
index c30247b..f8b138e 100644
--- a/src/net/minecraft/client/entity/AbstractClientPlayer.java
+++ b/src/net/minecraft/client/entity/AbstractClientPlayer.java
@@ -146,9 +146,9 @@ public abstract class AbstractClientPlayer extends EntityPlayer
             f = 1.0F;
         }
 
-        if (this.func_184587_cr() && this.func_184607_cu() != null && this.func_184607_cu().getItem() == Items.bow)
+        if (this.isUsingItem() && this.func_184607_cu() != null && this.func_184607_cu().getItem() == Items.bow)
         {
-            int i = this.func_184612_cw();
+            int i = this.getItemInUseDuration();
             float f1 = (float)i / 20.0F;
 
             if (f1 > 1.0F)
diff --git a/src/net/minecraft/client/entity/EntityPlayerSP.java b/src/net/minecraft/client/entity/EntityPlayerSP.java
index 61b85c2..8015573 100644
--- a/src/net/minecraft/client/entity/EntityPlayerSP.java
+++ b/src/net/minecraft/client/entity/EntityPlayerSP.java
@@ -1,5 +1,6 @@
 package net.minecraft.client.entity;
 
+import net.minecraft.block.material.Material;
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.audio.MovingSoundMinecartRiding;
 import net.minecraft.client.audio.PositionedSoundRecord;
@@ -10,15 +11,7 @@ import net.minecraft.client.gui.GuiMerchant;
 import net.minecraft.client.gui.GuiRepair;
 import net.minecraft.client.gui.GuiScreen;
 import net.minecraft.client.gui.GuiScreenBook;
-import net.minecraft.client.gui.inventory.GuiBeacon;
-import net.minecraft.client.gui.inventory.GuiBrewingStand;
-import net.minecraft.client.gui.inventory.GuiChest;
