<commit_before>--- ../src-base/minecraft/net/minecraft/client/Minecraft.java
+++ ../src-work/minecraft/net/minecraft/client/Minecraft.java
@@ -9,6 +9,9 @@
 import com.google.common.util.concurrent.ListenableFutureTask;
 import com.mojang.authlib.minecraft.MinecraftSessionService;
 import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.common.FMLCommonHandler;
+import cpw.mods.fml.common.StartupQuery;
 import cpw.mods.fml.relauncher.Side;
 import cpw.mods.fml.relauncher.SideOnly;
 import io.netty.util.concurrent.GenericFutureListener;
@@ -169,6 +172,8 @@
 import org.lwjgl.opengl.PixelFormat;
 import org.lwjgl.util.glu.GLU;
 
+import com.google.common.collect.MapDifference;
+
 @SideOnly(Side.CLIENT)
 public class Minecraft implements IPlayerUsage
 {
@@ -344,21 +349,23 @@
         File file2 = new File(file1, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt");
         System.out.println(p_71377_1_.func_71502_e());
 
+        int retVal;
         if (p_71377_1_.func_71497_f() != null)
         {
             System.out.println("#@!@# 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))
         {
             System.out.println("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath());
-            System.exit(-1);
+            retVal = -1;
         }
         else
         {
             System.out.println("#@?@# Game crashed! Crash report could not be saved. #@?@#");
-            System.exit(-2);
+            retVal = -2;
         }
+        FMLCommonHandler.instance().handleExit(retVal);
     }
 
     public void func_71367_a(String p_71367_1_, int p_71367_2_)
@@ -471,7 +478,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();
+        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.field_152350_aA = new SkinManager(this.field_71446_o, new File(this.field_110446_Y, "skins"), this.field_152355_az);
@@ -532,12 +539,13 @@
         this.field_71446_o.func_130088_a(TextureMap.field_110576_c, new TextureMap(1, "textures/items"));
         GL11.glViewport(0, 0, this.field_71443_c, this.field_71440_d);
         this.field_71452_i = new EffectRenderer(this.field_71441_e, this.field_71446_o);
+        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));
+            FMLClientHandler.instance().connectToServerAtStartup(this.field_71475_ae, this.field_71477_af);
         }
         else
         {
@@ -553,6 +561,7 @@
             this.func_71352_k();
         }
 
+        FMLClientHandler.instance().onInitializationComplete();
         try
         {
             Display.setVSyncEnabled(this.field_71474_y.field_74352_v);
@@ -970,9 +979,11 @@
 
         if (!this.field_71454_w)
         {
+            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();
+            FMLCommonHandler.instance().onRenderTickEnd(this.field_71428_T.field_74281_c);
         }
 
         GL11.glFlush();
@@ -1554,6 +1565,8 @@
             --this.field_71467_ac;
         }
 
+        FMLCommonHandler.instance().onPreClientTick();
+
         this.field_71424_I.func_76320_a("gui");
 
         if (!this.field_71445_n)
@@ -1698,6 +1711,7 @@
                         this.field_71462_r.func_146274_d();
                     }
                 }
+                FMLCommonHandler.instance().fireMouseInput();
             }
 
             if (this.field_71429_W > 0)
@@ -1834,6 +1848,7 @@
                             }
                         }
                     }
+                    FMLCommonHandler.instance().fireKeyInput();
                 }
             }
 
@@ -2025,12 +2040,15 @@
             this.field_71453_ak.func_74428_b();
         }
 
+        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_)
     {
+        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);
@@ -2066,6 +2084,12 @@
 
         while (!this.field_71437_Z.func_71200_ad())
         {
+            if (!StartupQuery.check())
+            {
+                func_71403_a(null);
+                func_147108_a(null);
+                return;
+            }
             String s2 = this.field_71437_Z.func_71195_b_();
 
             if (s2 != null)
@@ -2141,6 +2165,7 @@
             this.field_110448_aq.func_148529_f();
             this.func_71351_a((ServerData)null);
             this.field_71455_al = false;
+            FMLClientHandler.instance().handleClientWorldClosing(this.field_71441_e);
         }
 
         this.field_147127_av.func_147690_c();
<commit_msg>Make Keyevent also fire for key releases<commit_after>--- ../src-base/minecraft/net/minecraft/client/Minecraft.java
+++ ../src-work/minecraft/net/minecraft/client/Minecraft.java
@@ -9,6 +9,9 @@
 import com.google.common.util.concurrent.ListenableFutureTask;
 import com.mojang.authlib.minecraft.MinecraftSessionService;
 import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.common.FMLCommonHandler;
+import cpw.mods.fml.common.StartupQuery;
 import cpw.mods.fml.relauncher.Side;
 import cpw.mods.fml.relauncher.SideOnly;
 import io.netty.util.concurrent.GenericFutureListener;
@@ -169,6 +172,8 @@
 import org.lwjgl.opengl.PixelFormat;
 import org.lwjgl.util.glu.GLU;
 
+import com.google.common.collect.MapDifference;
+
 @SideOnly(Side.CLIENT)
 public class Minecraft implements IPlayerUsage
 {
@@ -344,21 +349,23 @@
         File file2 = new File(file1, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt");
         System.out.println(p_71377_1_.func_71502_e());
 
+        int retVal;
         if (p_71377_1_.func_71497_f() != null)
         {
             System.out.println("#@!@# 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))
         {
             System.out.println("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath());
-            System.exit(-1);
+            retVal = -1;
         }
         else
         {
             System.out.println("#@?@# Game crashed! Crash report could not be saved. #@?@#");
-            System.exit(-2);
+            retVal = -2;
         }
+        FMLCommonHandler.instance().handleExit(retVal);
     }
 
     public void func_71367_a(String p_71367_1_, int p_71367_2_)
@@ -471,7 +478,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();
+        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.field_152350_aA = new SkinManager(this.field_71446_o, new File(this.field_110446_Y, "skins"), this.field_152355_az);
@@ -532,12 +539,13 @@
         this.field_71446_o.func_130088_a(TextureMap.field_110576_c, new TextureMap(1, "textures/items"));
         GL11.glViewport(0, 0, this.field_71443_c, this.field_71440_d);
         this.field_71452_i = new EffectRenderer(this.field_71441_e, this.field_71446_o);
+        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));
+            FMLClientHandler.instance().connectToServerAtStartup(this.field_71475_ae, this.field_71477_af);
         }
         else
         {
@@ -553,6 +561,7 @@
             this.func_71352_k();
         }
 
+        FMLClientHandler.instance().onInitializationComplete();
         try
         {
             Display.setVSyncEnabled(this.field_71474_y.field_74352_v);
@@ -971,9 +980,11 @@
 
         if (!this.field_71454_w)
         {
+            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();
+            FMLCommonHandler.instance().onRenderTickEnd(this.field_71428_T.field_74281_c);
         }
 
         GL11.glFlush();
@@ -1555,6 +1566,8 @@
             --this.field_71467_ac;
         }
 
+        FMLCommonHandler.instance().onPreClientTick();
+
         this.field_71424_I.func_76320_a("gui");
 
         if (!this.field_71445_n)
@@ -1699,6 +1712,7 @@
                         this.field_71462_r.func_146274_d();
                     }
                 }
+                FMLCommonHandler.instance().fireMouseInput();
             }
 
             if (this.field_71429_W > 0)
@@ -1836,6 +1850,7 @@
                         }
                     }
                 }
+                FMLCommonHandler.instance().fireKeyInput();
             }
 
             for (j = 0; j < 9; ++j)
@@ -2026,12 +2041,15 @@
             this.field_71453_ak.func_74428_b();
         }
 
+        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_)
     {
+        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);
@@ -2067,6 +2085,12 @@
 
         while (!this.field_71437_Z.func_71200_ad())
         {
+            if (!StartupQuery.check())
+            {
+                func_71403_a(null);
+                func_147108_a(null);
+                return;
+            }
             String s2 = this.field_71437_Z.func_71195_b_();
 
             if (s2 != null)
@@ -2142,6 +2166,7 @@
             this.field_110448_aq.func_148529_f();
             this.func_71351_a((ServerData)null);
             this.field_71455_al = false;
+            FMLClientHandler.instance().handleClientWorldClosing(this.field_71441_e);
         }
 
         this.field_147127_av.func_147690_c();

{'fraction_non_alphanumeric': 0.128448778861382, 'fraction_numerical': 0.1141952154705343, 'mean_word_length': 2.410460488914156, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '531546', 'n_tokens_mistral': 5063, 'n_tokens_neox': 4191, 'n_words': 484}