mirror of
https://github.com/GTNewHorizons/CodeChickenCore.git
synced 2026-11-16 10:44:51 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
678970e48b | ||
|
|
5ad7ebe1ac | ||
|
|
033009fed5 | ||
|
|
acd863e748 | ||
|
|
850e2b9368 | ||
|
|
4713f7aebd |
No files matched your search
+2
-2
@@ -14,7 +14,7 @@ modId = CodeChickenCore
|
|||||||
modGroup = codechicken
|
modGroup = codechicken
|
||||||
|
|
||||||
# Whether to use modGroup as the maven publishing group.
|
# Whether to use modGroup as the maven publishing group.
|
||||||
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
|
# When false, com.github.GTNewHorizons is used.
|
||||||
useModGroupForPublishing = false
|
useModGroupForPublishing = false
|
||||||
|
|
||||||
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
|
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
|
||||||
@@ -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.
|
||||||
|
|||||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
@@ -86,8 +86,7 @@ done
|
|||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||||
' "$PWD" ) || exit
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
@@ -206,7 +205,7 @@ fi
|
|||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
# Collect all arguments for the java command:
|
# Collect all arguments for the java command:
|
||||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
# and any embedded shellness will be escaped.
|
# and any embedded shellness will be escaped.
|
||||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
# treated as '${Hostname}' itself on the command line.
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.30'
|
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());
|
||||||
|
|||||||
@@ -1,186 +0,0 @@
|
|||||||
package codechicken.core.launch;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import javax.swing.Box;
|
|
||||||
import javax.swing.JDialog;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.versioning.ComparableVersion;
|
|
||||||
import cpw.mods.fml.relauncher.IFMLCallHook;
|
|
||||||
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
|
|
||||||
import cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* For autodownloading stuff. This is really unoriginal, mostly ripped off FML, credits to cpw.
|
|
||||||
*/
|
|
||||||
@MCVersion("1.7.10")
|
|
||||||
public class DepLoader implements IFMLLoadingPlugin, IFMLCallHook {
|
|
||||||
|
|
||||||
public interface IDownloadDisplay {
|
|
||||||
|
|
||||||
void resetProgress(int sizeGuess);
|
|
||||||
|
|
||||||
void setPokeThread(Thread currentThread);
|
|
||||||
|
|
||||||
void updateProgress(int fullLength);
|
|
||||||
|
|
||||||
boolean shouldStopIt();
|
|
||||||
|
|
||||||
void updateProgressString(String string, Object... data);
|
|
||||||
|
|
||||||
Object makeDialog();
|
|
||||||
|
|
||||||
void showErrorDialog(String name, String url);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public static class Downloader extends JOptionPane implements IDownloadDisplay {
|
|
||||||
|
|
||||||
boolean stopIt;
|
|
||||||
Thread pokeThread;
|
|
||||||
|
|
||||||
private Box makeProgressPanel() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JDialog makeDialog() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void requestClose(String message) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateProgressString(String progressUpdate, Object... data) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void resetProgress(int sizeGuess) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateProgress(int fullLength) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPokeThread(Thread currentThread) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldStopIt() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void showErrorDialog(String name, String url) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class DummyDownloader implements IDownloadDisplay {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void resetProgress(int sizeGuess) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPokeThread(Thread currentThread) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateProgress(int fullLength) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldStopIt() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateProgressString(String string, Object... data) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object makeDialog() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void showErrorDialog(String name, String url) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class VersionedFile {
|
|
||||||
|
|
||||||
public final Pattern pattern;
|
|
||||||
public final String filename;
|
|
||||||
public final ComparableVersion version;
|
|
||||||
public final String name;
|
|
||||||
|
|
||||||
public VersionedFile(String filename, Pattern pattern) {
|
|
||||||
this.pattern = pattern;
|
|
||||||
this.filename = filename;
|
|
||||||
Matcher m = pattern.matcher(filename);
|
|
||||||
if (m.matches()) {
|
|
||||||
name = m.group(1);
|
|
||||||
version = new ComparableVersion(m.group(2));
|
|
||||||
} else {
|
|
||||||
name = null;
|
|
||||||
version = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean matches() {
|
|
||||||
return name != null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Dependency {
|
|
||||||
|
|
||||||
public String url;
|
|
||||||
public VersionedFile file;
|
|
||||||
|
|
||||||
public String existing;
|
|
||||||
/**
|
|
||||||
* Flag set to add this dep to the classpath immediately because it is required for a coremod.
|
|
||||||
*/
|
|
||||||
public boolean coreLib;
|
|
||||||
|
|
||||||
public Dependency(String url, VersionedFile file, boolean coreLib) {
|
|
||||||
this.url = url;
|
|
||||||
this.file = file;
|
|
||||||
this.coreLib = coreLib;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class DepLoadInst {
|
|
||||||
|
|
||||||
public DepLoadInst() {}
|
|
||||||
|
|
||||||
public void load() {}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void load() {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String[] getASMTransformerClass() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getModContainerClass() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSetupClass() {
|
|
||||||
return getClass().getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void injectData(Map<String, Object> data) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Void call() {
|
|
||||||
load();
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getAccessTransformerClass() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,13 +4,15 @@ import java.io.BufferedReader;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
import java.lang.reflect.Constructor;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.objectweb.asm.ClassVisitor;
|
import org.objectweb.asm.ClassVisitor;
|
||||||
import org.objectweb.asm.commons.RemappingClassAdapter;
|
import org.objectweb.asm.commons.Remapper;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
@@ -181,7 +183,40 @@ public class ObfuscationRun implements ILogStreams {
|
|||||||
|
|
||||||
public void remap(ClassNode cnode, ClassVisitor cv) {
|
public void remap(ClassNode cnode, ClassVisitor cv) {
|
||||||
cstMappper.transform(cnode);
|
cstMappper.transform(cnode);
|
||||||
cnode.accept(new RemappingClassAdapter(cv, obfMapper));
|
cnode.accept(newRemapper(cv, obfMapper));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ClassVisitor newRemapper(ClassVisitor visitor, Remapper remapper) {
|
||||||
|
try {
|
||||||
|
return theConstructor.newInstance(visitor, remapper);
|
||||||
|
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Constructor<? extends ClassVisitor> theConstructor;
|
||||||
|
|
||||||
|
static {
|
||||||
|
Class<? extends ClassVisitor> remapperClass;
|
||||||
|
try {
|
||||||
|
// noinspection unchecked
|
||||||
|
remapperClass = (Class<? extends ClassVisitor>) Class.forName("org.objectweb.asm.commons.ClassRemapper");
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
try {
|
||||||
|
// noinspection unchecked
|
||||||
|
remapperClass = (Class<? extends ClassVisitor>) Class
|
||||||
|
.forName("org.objectweb.asm.commons.RemappingClassAdapter");
|
||||||
|
} catch (ClassNotFoundException ex) {
|
||||||
|
RuntimeException err = new RuntimeException(ex);
|
||||||
|
err.addSuppressed(e);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
theConstructor = remapperClass.getConstructor(ClassVisitor.class, Remapper.class);
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> getParents(ClassNode cnode) {
|
public static List<String> getParents(ClassNode cnode) {
|
||||||
|
|||||||
Reference in new issue
Block a user