package vorquel.mod.simpleskygrid.asm;

import com.google.common.collect.Sets;
import cpw.mods.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper;
import org.objectweb.asm.ClassReader;
import vorquel.mod.simpleskygrid.helper.Log;

import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

class SuperClassMap {
    
    private boolean useNotchNames;
    private Set<String> toMatch;
    private Map<String, Set<String>> map = new HashMap<>();
    
    SuperClassMap(boolean useNotchNames, String... toMatch) {
        this.useNotchNames = useNotchNames;
        this.toMatch = Sets.newHashSet(toMatch);
    }
    
    Set<String> get(String className) {
        className = getGoodClassName(className);
        if(map.containsKey(className))
            return map.get(className);
        else {
            InputStream classStream = this.getClass().getClassLoader().getResourceAsStream(className + ".class");
            Set<String> matching = Sets.newHashSet();
            if(toMatch.contains(className))
                matching.add(className);
            try {
                String superClassName = new ClassReader(classStream).getSuperName();
                classStream.close();
                if(superClassName != null)
                    matching.addAll(get(superClassName));
            } catch (IOException e) {
                Log.error("Exception determining superclass of %s: %s", className, e.getMessage());
            }
            map.put(className, matching);
            return matching;
        }
    }
    
    private String getGoodClassName(String className) {
        if(className.indexOf('.') != -1)
            className = className.replace('.', '/');
        if(useNotchNames)
            return FMLDeobfuscatingRemapper.INSTANCE.unmap(className);
        else
            return className;
    }
}

@@ -33,16 +33,55 @@
 d.asm;%0A%0A
+import com.google.common.collect.Maps;%0A
 import c
@@ -111,16 +111,16 @@
 t.Sets;%0A
-
 import c
@@ -472,20 +472,28 @@
 private 
-Set%3C
+Map%3CString, 
 String%3E 
@@ -695,19 +695,19 @@
 Match = 
-Set
+Map
 s.newHas
@@ -711,21 +711,136 @@
 Hash
-Set(toMatch);
+Map();%0A        for(String className : toMatch) %7B%0A            this.toMatch.put(getGoodClassName(className), className);%0A        %7D
 %0A   
@@ -1228,16 +1228,19 @@
 contains
+Key
 (classNa
@@ -1273,16 +1273,28 @@
 ing.add(
+toMatch.get(
 classNam
@@ -1287,32 +1287,33 @@
 h.get(className)
+)
 ;%0A            tr

Fix coremod in non-dev environment