mirror of
https://github.com/GTNewHorizons/CodeChickenCore.git
synced 2026-11-17 19:15:18 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
033009fed5 | ||
|
|
acd863e748 |
No files matched your search
+1
-1
@@ -145,7 +145,7 @@ modrinthProjectId = codechickencore-unofficial
|
|||||||
# type can be one of [project, version],
|
# type can be one of [project, version],
|
||||||
# and the name is the Modrinth project or version slug/id of the other mod.
|
# and the name is the Modrinth project or version slug/id of the other mod.
|
||||||
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
|
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
|
||||||
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
|
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
||||||
modrinthRelations =
|
modrinthRelations =
|
||||||
|
|
||||||
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.38'
|
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.41'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -11,6 +11,7 @@ import java.util.zip.ZipFile;
|
|||||||
|
|
||||||
import net.minecraft.launchwrapper.Launch;
|
import net.minecraft.launchwrapper.Launch;
|
||||||
|
|
||||||
|
import org.objectweb.asm.ClassReader;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
@@ -22,6 +23,7 @@ import cpw.mods.fml.common.Loader;
|
|||||||
import cpw.mods.fml.common.ModClassLoader;
|
import cpw.mods.fml.common.ModClassLoader;
|
||||||
import cpw.mods.fml.relauncher.CoreModManager;
|
import cpw.mods.fml.relauncher.CoreModManager;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public class ClassDiscoverer {
|
public class ClassDiscoverer {
|
||||||
|
|
||||||
public IStringMatcher matcher;
|
public IStringMatcher matcher;
|
||||||
@@ -35,17 +37,12 @@ public class ClassDiscoverer {
|
|||||||
for (int i = 0; i < superclasses.length; i++)
|
for (int i = 0; i < superclasses.length; i++)
|
||||||
this.superclasses[i] = superclasses[i].getName().replace('.', '/');
|
this.superclasses[i] = superclasses[i].getName().replace('.', '/');
|
||||||
|
|
||||||
classes = new ArrayList<Class<?>>();
|
classes = new ArrayList<>();
|
||||||
modClassLoader = (ModClassLoader) Loader.instance().getModClassLoader();
|
modClassLoader = (ModClassLoader) Loader.instance().getModClassLoader();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClassDiscoverer(Class<?>... superclasses) {
|
public ClassDiscoverer(Class<?>... superclasses) {
|
||||||
this(new IStringMatcher() {
|
this(test -> true, superclasses);
|
||||||
|
|
||||||
public boolean matches(String test) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}, superclasses);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Class<?>> findClasses() {
|
public ArrayList<Class<?>> findClasses() {
|
||||||
@@ -63,7 +60,7 @@ public class ClassDiscoverer {
|
|||||||
byte[] bytes = Launch.classLoader.getClassBytes(classname);
|
byte[] bytes = Launch.classLoader.getClassBytes(classname);
|
||||||
if (bytes == null) return;
|
if (bytes == null) return;
|
||||||
|
|
||||||
ClassNode cnode = ASMHelper.createClassNode(bytes);
|
ClassNode cnode = ASMHelper.createClassNode(bytes, ClassReader.SKIP_CODE);
|
||||||
for (String superclass : superclasses)
|
for (String superclass : superclasses)
|
||||||
if (!cnode.interfaces.contains(superclass) && !cnode.superName.equals(superclass)) return;
|
if (!cnode.interfaces.contains(superclass) && !cnode.superName.equals(superclass)) return;
|
||||||
|
|
||||||
@@ -86,7 +83,7 @@ public class ClassDiscoverer {
|
|||||||
List<String> knownLibraries = ImmutableList.<String>builder().addAll(modClassLoader.getDefaultLibraries())
|
List<String> knownLibraries = ImmutableList.<String>builder().addAll(modClassLoader.getDefaultLibraries())
|
||||||
.addAll(CoreModManager.getLoadedCoremods()).build();
|
.addAll(CoreModManager.getLoadedCoremods()).build();
|
||||||
File[] minecraftSources = modClassLoader.getParentSources();
|
File[] minecraftSources = modClassLoader.getParentSources();
|
||||||
HashSet<String> searchedSources = new HashSet<String>();
|
HashSet<String> searchedSources = new HashSet<>();
|
||||||
for (File minecraftSource : minecraftSources) {
|
for (File minecraftSource : minecraftSources) {
|
||||||
if (searchedSources.contains(minecraftSource.getAbsolutePath())) continue;
|
if (searchedSources.contains(minecraftSource.getAbsolutePath())) continue;
|
||||||
searchedSources.add(minecraftSource.getAbsolutePath());
|
searchedSources.add(minecraftSource.getAbsolutePath());
|
||||||
|
|||||||
Reference in new issue
Block a user