diff options
author | Luck <git@lucko.me> | 2021-07-23 11:15:39 +0100 |
---|---|---|
committer | Luck <git@lucko.me> | 2021-07-23 11:15:39 +0100 |
commit | a3769a815993a225c428c56870d6446c7ab18741 (patch) | |
tree | 95f2aa845f0423b788c3a2dce3e5953b74c4cdd3 /spark-forge | |
parent | 53373795aa808bd9af227e34d7493fc0f549eb25 (diff) | |
download | spark-a3769a815993a225c428c56870d6446c7ab18741.tar.gz spark-a3769a815993a225c428c56870d6446c7ab18741.tar.bz2 spark-a3769a815993a225c428c56870d6446c7ab18741.zip |
Fix ForgeClassSourceLookup for 1.17.1
Diffstat (limited to 'spark-forge')
-rw-r--r-- | spark-forge/src/main/java/me/lucko/spark/forge/ForgeClassSourceLookup.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/spark-forge/src/main/java/me/lucko/spark/forge/ForgeClassSourceLookup.java b/spark-forge/src/main/java/me/lucko/spark/forge/ForgeClassSourceLookup.java index fc4af30..7900bc3 100644 --- a/spark-forge/src/main/java/me/lucko/spark/forge/ForgeClassSourceLookup.java +++ b/spark-forge/src/main/java/me/lucko/spark/forge/ForgeClassSourceLookup.java @@ -22,15 +22,15 @@ package me.lucko.spark.forge; import me.lucko.spark.common.util.ClassSourceLookup; -import java.net.URL; +import cpw.mods.modlauncher.TransformingClassLoader; -public class ForgeClassSourceLookup extends ClassSourceLookup.ByCodeSource { +public class ForgeClassSourceLookup implements ClassSourceLookup { @Override - protected String identifyUrl(URL url) { - if (url.getProtocol().equals("modjar")) { - String host = url.getHost(); - return host.equals("forge") ? null : host; + public String identify(Class<?> clazz) { + if (clazz.getClassLoader() instanceof TransformingClassLoader) { + String name = clazz.getModule().getName(); + return name.equals("forge") || name.equals("minecraft") ? null : name; } return null; } |