Skip to content

Commit

Permalink
Fix error with inconsistent transformations
Browse files Browse the repository at this point in the history
  • Loading branch information
LunNova committed Feb 28, 2016
1 parent 648a39d commit 25c2616
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public static byte[] getSrgBytes(String name) {
public static void cacheSrgBytes(String transformedName, byte[] bytes) {
byte[] old = cachedSrgClasses.put(transformedName, bytes);
if (old != null && !Arrays.equals(bytes, old)) {
ModPatcher.pool.dropCache(transformedName);
ModPatcherTransformer.pool.dropCache(transformedName);
PatcherLog.error(null, new Error("Inconsistent transformation results. Tried to cache different bytes for class " + transformedName + " to previous result after transformation."));
}
}
Expand Down
9 changes: 2 additions & 7 deletions src/main/java/me/nallar/modpatcher/ModPatcherTransformer.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.nio.file.*;

class ModPatcherTransformer {
public static final ClassLoaderPool pool;
private static final String MOD_PATCHES_DIRECTORY = "./ModPatches/";
private static final Patcher patcher;
private static final String ALREADY_LOADED_PROPERTY_NAME = "nallar.ModPatcher.alreadyLoaded";
Expand All @@ -24,17 +25,11 @@ class ModPatcherTransformer {

checkForMultipleClassLoads();

patcher = createPatcher();
}

private static Patcher createPatcher() {
try {
Patcher patcher = new Patcher(new ClassLoaderPool(), Patches.class, new MCPMappings());
patcher = new Patcher(pool = new ClassLoaderPool(), Patches.class, new MCPMappings());

// TODO - issue #2. Determine layout/config file structure
recursivelyAddXmlFiles(new File(MOD_PATCHES_DIRECTORY), patcher);

return patcher;
} catch (Throwable t) {
throw logError("Failed to create Patcher", t);
}
Expand Down

0 comments on commit 25c2616

Please sign in to comment.