package libshapedraw.internal;

import java.io.File;

import libshapedraw.ApiInfo;
import net.minecraft.client.Minecraft;

public class LSDModDirectory {
    // obf: Minecraft.getMinecraftDir
    public static final File DIRECTORY = new File(Minecraft.b(), "mods" + File.separator + ApiInfo.getName());
}

@@ -45,16 +45,49 @@
 io.File;
+%0Aimport java.lang.reflect.Method;
 %0A%0Aimport
@@ -153,76 +153,623 @@
 t;%0A%0A
-public class LSDModDirectory %7B%0A    // obf: Minecraft.getMinecraftDir
+/**%0A * This internal class is the one exception to the rule that no Minecraft%0A * classes are referenced outside of mod_LibShapeDraw, making the API clean and%0A * free of obfuscated code.%0A * %3Cp%3E%0A * This is necessary because it is entirely possible that the LSDController%0A * will be instantiated before mod_LibShapeDraw: other mods are allowed to%0A * create LibShapeDraw API instances whenever they like.%0A * %3Cp%3E%0A * LSDController needs to know where to locate the log file. We have to ask%0A * Minecraft directly instead of going through the potentially non-existing%0A * mod_LibShapeDraw.%0A */%0Apublic class LSDModDirectory %7B
 %0A   
@@ -815,16 +815,19 @@
 ew File(
+get
 Minecraf
@@ -831,10 +831,11 @@
 raft
-.b
+Dir
 (), 
@@ -879,11 +879,671 @@
 Name());
+%0A%0A    /**%0A     * Use reflection to invoke the static method. This supports both normal%0A     * play (reobfuscated minecraft.jar) and development (deobfuscated classes%0A     * in MCP).%0A     */%0A    private static File getMinecraftDir() %7B%0A        try %7B%0A            Method m;%0A            try %7B%0A                m = Minecraft.class.getMethod(%22b%22);%0A            %7D catch (NoSuchMethodException e) %7B%0A                m = Minecraft.class.getMethod(%22getMinecraftDir%22);%0A            %7D%0A            return (File) m.invoke(null);%0A        %7D catch (Exception e) %7B%0A            throw new LSDInternalReflectionException(%22unable to invoke Minecraft.getMinecraftDir%22, e);%0A        %7D%0A    %7D
 %0A%7D%0A

make LSDModDirectory work with either obfuscated or deobfuscated code, this way 100% of the obfuscation stuff lives in mod_LibShapeDraw