public static Minecraft getMinecraftInstance()
    {
        if (instance == null)
        {
            try
            {
                ThreadGroup var0 = Thread.currentThread().getThreadGroup();
                int var1 = var0.activeCount();
                Thread[] var2 = new Thread[var1];
                var0.enumerate(var2);
                int var3;

                for (var3 = 0; var3 < var2.length; ++var3)
                {
                    System.out.println(var2[var3].getName());
                }

                for (var3 = 0; var3 < var2.length; ++var3)
                {
                    if (var2[var3].getName().equals("Minecraft main thread"))
                    {
                        instance = (Minecraft)getPrivateValue(Thread.class, var2[var3], "target");
                        break;
                    }
                }
            }
            catch (SecurityException var4)
            {
                logger.throwing("ModLoader", "getMinecraftInstance", var4);
                throw new RuntimeException(var4);
            }
            catch (NoSuchFieldException var5)
            {
                logger.throwing("ModLoader", "getMinecraftInstance", var5);
                throw new RuntimeException(var5);
            }
        }

        return instance;
    }