From a3769a815993a225c428c56870d6446c7ab18741 Mon Sep 17 00:00:00 2001 From: Luck Date: Fri, 23 Jul 2021 11:15:39 +0100 Subject: Fix ForgeClassSourceLookup for 1.17.1 --- .../java/me/lucko/spark/forge/ForgeClassSourceLookup.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'spark-forge') 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; } -- cgit