--- ../src-base/minecraft/net/minecraft/client/Minecraft.java
+++ ../src-work/minecraft/net/minecraft/client/Minecraft.java
@@ -411,7 +411,7 @@
         this.field_110451_am = new SimpleReloadableResourceManager(this.field_110452_an);
         this.field_135017_as = new LanguageManager(this.field_110452_an, this.field_71474_y.field_74363_ab);
         this.field_110451_am.func_110542_a(this.field_135017_as);
-        this.func_110436_a();
+        net.minecraftforge.fml.client.FMLClientHandler.instance().beginMinecraftLoading(this, this.field_110449_ao, this.field_110451_am);
         this.field_71446_o = new TextureManager(this.field_110451_am);
         this.field_110451_am.func_110542_a(this.field_71446_o);
         this.func_180510_a(this.field_71446_o);
@@ -483,12 +483,13 @@
         this.field_71458_u = new GuiAchievement(this);
         GlStateManager.func_179083_b(0, 0, this.field_71443_c, this.field_71440_d);
         this.field_71452_i = new EffectRenderer(this.field_71441_e, this.field_71446_o);
+        net.minecraftforge.fml.client.FMLClientHandler.instance().finishMinecraftLoading();
         this.func_71361_d("Post startup");
         this.field_71456_v = new GuiIngame(this);
 
         if (this.field_71475_ae != null)
         {
-            this.func_147108_a(new GuiConnecting(new GuiMainMenu(), this, this.field_71475_ae, this.field_71477_af));
+            net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServerAtStartup(this.field_71475_ae, this.field_71477_af);
         }
         else
         {
@@ -504,6 +505,7 @@
             this.func_71352_k();
         }
 
+        net.minecraftforge.fml.client.FMLClientHandler.instance().onInitializationComplete();
         try
         {
             Display.setVSyncEnabled(this.field_71474_y.field_74352_v);
@@ -682,21 +684,23 @@
         File file2 = new File(file1, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt");
         Bootstrap.func_179870_a(p_71377_1_.func_71502_e());
 
+        int retVal;
         if (p_71377_1_.func_71497_f() != null)
         {
             Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + p_71377_1_.func_71497_f());
-            System.exit(-1);
+            retVal = -1;
         }
         else if (p_71377_1_.func_147149_a(file2))
         {
             Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath());
-            System.exit(-1);
+            retVal = -1;
         }
         else
         {
             Bootstrap.func_179870_a("#@?@# Game crashed! Crash report could not be saved. #@?@#");
-            System.exit(-2);
+            retVal = -2;
         }
+        net.minecraftforge.fml.common.FMLCommonHandler.instance().handleExit(retVal);
     }
 
     public boolean func_152349_b()
@@ -1035,9 +1039,11 @@
 
         if (!this.field_71454_w)
         {
+            net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickStart(this.field_71428_T.field_74281_c);
             this.field_71424_I.func_76318_c("gameRenderer");
             this.field_71460_t.func_78480_b(this.field_71428_T.field_74281_c);
             this.field_71424_I.func_76319_b();
+            net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickEnd(this.field_71428_T.field_74281_c);
         }
 
         this.field_71424_I.func_76319_b();
@@ -1592,6 +1598,8 @@
             --this.field_71467_ac;
         }
 
+        net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreClientTick();
+
         this.field_71424_I.func_76320_a("gui");
 
         if (!this.field_71445_n)
@@ -1745,6 +1753,7 @@
                         this.field_71462_r.func_146274_d();
                     }
                 }
+                net.minecraftforge.fml.common.FMLCommonHandler.instance().fireMouseInput();
             }
 
             if (this.field_71429_W > 0)
@@ -1921,6 +1930,7 @@
                         }
                     }
                 }
+                net.minecraftforge.fml.common.FMLCommonHandler.instance().fireKeyInput();
             }
 
             for (i = 0; i < 9; ++i)
@@ -2121,12 +2131,15 @@
             this.field_71453_ak.func_74428_b();
         }
 
+        net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostClientTick();
+
         this.field_71424_I.func_76319_b();
         this.field_71423_H = func_71386_F();
     }
 
     public void func_71371_a(String p_71371_1_, String p_71371_2_, WorldSettings p_71371_3_)
     {
+        net.minecraftforge.fml.client.FMLClientHandler.instance().startIntegratedServer(p_71371_1_, p_71371_2_, p_71371_3_);
         this.func_71403_a((WorldClient)null);
         System.gc();
         ISaveHandler isavehandler = this.field_71469_aa.func_75804_a(p_71371_1_, false);
@@ -2162,6 +2175,12 @@
 
         while (!this.field_71437_Z.func_71200_ad())
         {
+            if (!net.minecraftforge.fml.common.StartupQuery.check())
+            {
+                func_71403_a(null);
+                func_147108_a(null);
+                return;
+            }
             String s2 = this.field_71437_Z.func_71195_b_();
 
             if (s2 != null)
@@ -2187,7 +2206,7 @@
         SocketAddress socketaddress = this.field_71437_Z.func_147137_ag().func_151270_a();
         NetworkManager networkmanager = NetworkManager.func_150722_a(socketaddress);
         networkmanager.func_150719_a(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null));
-        networkmanager.func_179290_a(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN));
+        networkmanager.func_179290_a(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN, true));
         networkmanager.func_179290_a(new C00PacketLoginStart(this.func_110432_I().func_148256_e()));
         this.field_71453_ak = networkmanager;
     }
@@ -2238,6 +2257,7 @@
 
             this.func_71351_a((ServerData)null);
             this.field_71455_al = false;
+            net.minecraftforge.fml.client.FMLClientHandler.instance().handleClientWorldClosing(this.field_71441_e);
         }
 
         this.field_147127_av.func_147690_c();
