mirror of
https://github.com/LegacyModdingMC/UniMixins.git
synced 2026-11-26 23:22:59 +00:00
Remove GTNHMixins shaded MixinExtras generation
As far as I can tell, no current mods use this.
This commit is contained in:
1 parent
a5df63e923
commit
b7549fdc04
4 files changed
+2
-121
No files matched your search
@@ -1,34 +1,14 @@
|
||||
def mixinExtrasVersion = "0.1.1"
|
||||
|
||||
configurations.create("shadowMixinExtras")
|
||||
|
||||
dependencies {
|
||||
compileOnly('org.spongepowered:mixin:0.8.7')
|
||||
shadow(project(":module-common")) {
|
||||
transitive = false
|
||||
}
|
||||
compileOnly(project(":module-mixingasm")) {
|
||||
transitive = false
|
||||
}
|
||||
compileOnly("com.github.LlamaLad7:MixinExtras:$mixinExtrasVersion")
|
||||
shadowMixinExtras("com.github.LlamaLad7:MixinExtras:$mixinExtrasVersion")
|
||||
}
|
||||
|
||||
archivesBaseName = archivesBaseName.replace("-1.7.10", "-gtnhmixins-1.7.10")
|
||||
|
||||
apply plugin: "com.github.johnrengelman.shadow"
|
||||
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
|
||||
task mixinExtrasJar(type: ShadowJar) {
|
||||
destinationDirectory = file("build/tmp")
|
||||
archiveClassifier.set("mixinExtras")
|
||||
archiveVersion = mixinExtrasVersion
|
||||
configurations = [project.configurations.shadowMixinExtras]
|
||||
relocate 'com.llamalad7.mixinextras', 'com.gtnewhorizon.mixinextras'
|
||||
relocate 'org.objectweb.asm', 'org.spongepowered.asm.lib'
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
classifier = ''
|
||||
configurations = [project.configurations.shadow]
|
||||
@@ -36,12 +16,6 @@ shadowJar {
|
||||
relocate 'org.objectweb.asm', 'org.spongepowered.asm.lib'
|
||||
relocate 'io.github.legacymoddingmc.unimixins.common', 'io.github.legacymoddingmc.unimixins.gtnhmixins.repackage.common'
|
||||
|
||||
from(zipTree(tasks.mixinExtrasJar.archiveFile)) {
|
||||
eachFile({
|
||||
setPath("data/legacy_gtnh_mixinextras/" + getPath().replaceAll("\\.class", ".klass"))
|
||||
})
|
||||
}
|
||||
|
||||
manifest {
|
||||
attributes (
|
||||
'TweakClass': 'org.spongepowered.asm.launch.MixinTweaker',
|
||||
@@ -58,8 +32,6 @@ jar {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
shadowJar.dependsOn mixinExtrasJar
|
||||
|
||||
// Obfuscation is unnecessary since this module does not reference Minecraft classes
|
||||
reobf.enabled = false
|
||||
|
||||
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package io.github.legacymoddingmc.unimixins.gtnhmixins;
|
||||
|
||||
import io.github.legacymoddingmc.unimixins.common.config.AnnotatedProperties;
|
||||
|
||||
public class GTNHMixinsConfig {
|
||||
@AnnotatedProperties.ConfigString(def = "true", com = "Provide the deprecated `com.gtnewhorizons.mixinextras` relocation of MixinExtras 0.1.1. May be required by some older mods.", cat = "gtnhmixins")
|
||||
public static boolean enableLegacyGTNHMixinExtrasPackage;
|
||||
}
|
||||
+2
-35
@@ -4,10 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import io.github.legacymoddingmc.unimixins.common.abstraction.ComparableVersion;
|
||||
import io.github.legacymoddingmc.unimixins.common.config.ConfigUtil;
|
||||
import io.github.legacymoddingmc.unimixins.common.sanitycheck.SanityCheckHelper;
|
||||
import net.minecraft.launchwrapper.Launch;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -16,38 +13,10 @@ public class GTNHMixinsModule {
|
||||
public static final Logger LOGGER = LogManager.getLogger("unimixins-gtnhmixins");
|
||||
|
||||
public static void init() {
|
||||
if(SanityCheckHelper.isEnabled()) {
|
||||
if (SanityCheckHelper.isEnabled()) {
|
||||
SanityCheckHelper.warnIfJarPrefixesExist(Arrays.asList("gasstation-", "mixinbooterlegacy-", "spongemixins-"));
|
||||
checkComponentIntegrity();
|
||||
}
|
||||
|
||||
ConfigUtil.load(GTNHMixinsConfig.class);
|
||||
|
||||
if(isLegacyGTNHMixinExtrasEnabled()) {
|
||||
Launch.classLoader.registerTransformer("io.github.legacymoddingmc.unimixins.gtnhmixins.asm.LegacyGTNHMixinExtrasGenerator");
|
||||
try {
|
||||
Class.forName("com.gtnewhorizon.mixinextras.MixinExtrasBootstrap").getMethod("init").invoke(null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException("Failed to initialize MixinExtrasBootstrap");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isLegacyGTNHMixinExtrasEnabled() {
|
||||
if(!GTNHMixinsConfig.enableLegacyGTNHMixinExtrasPackage) return false;
|
||||
|
||||
String requiredVersion = "0.8.5";
|
||||
String mixinVersion = (String)Launch.blackboard.get("mixin.initialised");
|
||||
if(mixinVersion != null && new ComparableVersion(mixinVersion).compareTo(new ComparableVersion(requiredVersion)) >= 0) {
|
||||
LOGGER.debug("Initializing MixinExtras");
|
||||
return true;
|
||||
} else if(!SanityCheckHelper.isEnabled()){
|
||||
LOGGER.warn("Skipping MixinExtras because Mixin version (" + mixinVersion + ") is lower than the required (" + requiredVersion + ")");
|
||||
return false;
|
||||
} else {
|
||||
throw new RuntimeException("Cannot load MixinExtras because Mixin version (" + mixinVersion + ") is lower than the required (" + requiredVersion + ")");
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkComponentIntegrity() {
|
||||
@@ -62,7 +31,7 @@ public class GTNHMixinsModule {
|
||||
}
|
||||
|
||||
if(!missingComponents.isEmpty()) {
|
||||
LOGGER.error("The following missing components were detected: " + missingComponents);
|
||||
LOGGER.error("The following missing components were detected: {}", missingComponents);
|
||||
LOGGER.error("Please obtain mods which provide them.");
|
||||
throw new RuntimeException("Missing components detected");
|
||||
}
|
||||
@@ -71,7 +40,5 @@ public class GTNHMixinsModule {
|
||||
public static boolean classExists(String string) {
|
||||
return GTNHMixinsModule.class.getResource("/" + string.replaceAll("\\.", "/") + ".class") != null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
-50
@@ -1,50 +0,0 @@
|
||||
package io.github.legacymoddingmc.unimixins.gtnhmixins.asm;
|
||||
|
||||
import static io.github.legacymoddingmc.unimixins.gtnhmixins.GTNHMixinsModule.LOGGER;
|
||||
|
||||
import io.github.legacymoddingmc.unimixins.gtnhmixins.util.LaunchClassLoaderUtils;
|
||||
import makamys.mixingasm.api.MixinSafeTransformer;
|
||||
import makamys.mixingasm.api.TransformerInclusions;
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@MixinSafeTransformer
|
||||
public class LegacyGTNHMixinExtrasGenerator implements IClassTransformer {
|
||||
static {
|
||||
if(LegacyGTNHMixinExtrasGenerator.class.getResource("/makamys/mixingasm/api/TransformerInclusions.class") != null
|
||||
&& LegacyGTNHMixinExtrasGenerator.class.getResource("/makamys/mixingasm/api/MixinSafeTransformer.class") == null) {
|
||||
// Mixingasm < 0.3 compat
|
||||
TransformerInclusions.getTransformerInclusionList().add("io.github.legacymoddingmc.unimixins.compat.asm.LegacyGTNHMixinExtrasGenerator");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] transform(String name, String transformedName, byte[] basicClass) {
|
||||
if(basicClass == null && name.startsWith("com.gtnewhorizon.mixinextras") && !name.startsWith("org.apache.commons.io.")) {
|
||||
try {
|
||||
LOGGER.trace("Generating class " + name);
|
||||
byte[] bytes = getClassBytes(name);
|
||||
|
||||
if(bytes != null) {
|
||||
// If NEI is on the class path before CCL (which would cause the game to crash immediately in
|
||||
// production, but is possible in a dev env), ClassHeirachyTransformer will try to call getClassBytes,
|
||||
// and if it fails, it will call Class.forName for the class being loaded, causing a
|
||||
// ClassCircularityError.
|
||||
// So we need to populate the cache to avoid that from happening.
|
||||
LaunchClassLoaderUtils.putInResourceCache(name, bytes);
|
||||
return bytes;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Failed to generate class " + name);
|
||||
}
|
||||
}
|
||||
return basicClass;
|
||||
}
|
||||
|
||||
private byte[] getClassBytes(String name) throws IOException {
|
||||
final String resourcePath = "/data/legacy_gtnh_mixinextras/" + name.replace('.', '/').concat(".klass");
|
||||
return IOUtils.toByteArray(LegacyGTNHMixinExtrasGenerator.class.getResourceAsStream(resourcePath));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user