diff --git a/.gitignore b/.gitignore index 7114a6cb..a233ec2b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,32 +1,40 @@ # gradle + .gradle/ build/ out/ classes/ -mods/ # eclipse + *.launch # idea + .idea/ *.iml *.ipr *.iws # vscode + .settings/ .vscode/ bin/ .classpath .project +# macos + +*.DS_Store + # fabric + run/ -# macos -*.DS_Store +# java -./ModLoader* -jars/ -remappedSrc/ +hs_err_*.log +replay_*.log +*.hprof +*.jfr \ No newline at end of file diff --git a/build.gradle b/build.gradle index 3fbfb9ff..b2e3deb4 100644 --- a/build.gradle +++ b/build.gradle @@ -1,20 +1,15 @@ import com.diffplug.gradle.spotless.JavaExtension plugins { + id 'java-library' id 'com.diffplug.spotless' version "6.12.0" - id 'fabric-loom' version "1.1-SNAPSHOT" // To use chocoloom, change the version to a commit hash - id 'legacy-looming' version "1.1-SNAPSHOT" // Version must be the same as fabric-loom's + id 'fabric-loom' version "1.3-SNAPSHOT" apply false // To use chocoloom, change the version to a commit hash + id 'legacy-looming' version "1.3-SNAPSHOT" apply false // Version must be the same as fabric-loom's id 'maven-publish' id "com.modrinth.minotaur" version "2.+" } -sourceCompatibility = JavaVersion.VERSION_1_8 -targetCompatibility = JavaVersion.VERSION_1_8 - -archivesBaseName = project.archives_base_name + "-" + project.minecraft_version -version = project.mod_version -def displayVersion = version + "+" + project.minecraft_version -group = project.maven_group +def displayVersion = project.mod_version + "+" + project.minecraft_version def debug = true def branch = System.getenv("GITHUB_REF_NAME") == null ? "-forge" : System.getenv("GITHUB_REF_NAME") @@ -22,73 +17,117 @@ if (!branch.endsWith("-forge")) { debug = false } -repositories { - maven { - name = "Modrinth" - url = "https://api.modrinth.com/maven" - content { - includeGroup "maven.modrinth" +allprojects { + apply plugin: "maven-publish" + apply plugin: "java-library" + apply plugin: "fabric-loom" + apply plugin: "legacy-looming" + + version = project.mod_version + group = project.maven_group + + repositories { + maven { + name = "Modrinth" + url = "https://api.modrinth.com/maven" + content { + includeGroup "maven.modrinth" + } + } + flatDir { + dirs (rootProject.rootDir.toString() + "/lib", rootProject.rootDir.toString() + "/mods") + } + + maven { + name = "Jitpack" + url 'https://jitpack.io/' } } - flatDir { - dirs "./lib" - } - maven { - name = "Jitpack" - url 'https://jitpack.io/' + dependencies { + minecraft "com.mojang:minecraft:${project.minecraft_version}" + mappings legacy.yarn(project.minecraft_version, project.yarn_mappings) + modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + + modApi("maven.modrinth:mod-remapping-api:${project.mod_remapping_api}") + // modApi(group: "local", name: "mod-remapping-api", version: "1.8.0") + + modApi("maven.modrinth:spasm:${project.spasm_version}") + modApi(annotationProcessor("com.github.LlamaLad7.MixinExtras:mixinextras-fabric:${project.mixin_extras_version}")) + + implementation(group: "local", name: "argo", version: "2.25") + implementation(group: "local", name: "guava", version: "12.0.1") + + modImplementation(legacy.apiModule("legacy-fabric-logger-api-v1", "1.9.0+1.8.9")) + + // modRuntimeOnly(files("./forge-${project.minecraft_version}-${project.forge_version}-universal-intermediary.jar")) } -} -loom { - setIntermediaryUrl('https://repo.legacyfabric.net/repository/legacyfabric/net/legacyfabric/intermediary/%1$s/intermediary-%1$s-v2.jar'); + processResources { + inputs.property "version", project.version - accessWidenerPath = file("src/main/resources/fabricated-forge.accesswidener") -} + filesMatching("fabric.mod.json") { + expand "version": project.version + } + } -dependencies { - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.legacyfabric:yarn:${project.minecraft_version}+build.${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + // ensure that the encoding is set to UTF-8, no matter what the system default is + // this fixes some edge cases with special characters not displaying correctly + // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html + tasks.withType(JavaCompile).configureEach { + it.options.encoding = "UTF-8" + if (JavaVersion.current().isJava9Compatible()) it.options.release = 8 - modApi("maven.modrinth:mod-remapping-api:${project.mod_remapping_api}") + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } - modImplementation(legacyFabricApi.module("legacy-fabric-logger-api-v1", "1.9.0+1.8.9")) + java { + // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task + // if it is present. + // If you remove this line, sources will not be generated. + withSourcesJar() + } - implementation(include(group: "local", name: "argo", version: "2.25")) - implementation(include(group: "local", name: "guava", version: "12.0.1")) + jar { + from("LICENSE") { + rename { "${it}_${base.archivesName.get()}" } + } + } +} - modRuntimeOnly(files("./forge-${project.minecraft_version}-${project.forge_version}-universal-intermediary.jar")) +base { + archivesName = project.archives_base_name + "-" + project.minecraft_version } -processResources { - inputs.property "version", project.version +loom { + accessWidenerPath = file("src/main/resources/fabricated-forge.accesswidener") +} - filesMatching("fabric.mod.json") { - expand "version": project.version - } +dependencies { + include(group: "local", name: "argo", version: "2.25") + include(group: "local", name: "guava", version: "12.0.1") + + include("org.apache.commons:commons-lang3:3.12.0") } -// ensure that the encoding is set to UTF-8, no matter what the system default is -// this fixes some edge cases with special characters not displaying correctly -// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html -tasks.withType(JavaCompile).configureEach { - it.options.encoding = "UTF-8" - if (JavaVersion.current().isJava9Compatible()) it.options.release = 8 +subprojects { + dependencies { + api(project.dependencies.project(path: ":", configuration: 'namedElements')) + } } -java { - // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task - // if it is present. - // If you remove this line, sources will not be generated. - withSourcesJar() +remapJar { + afterEvaluate { + subprojects.each { + // Include the jar from the sub project. + nestedJars.from project("${it.path}").tasks.getByName("remapJar") + } + } } jar { from("licensing.md") - from("LICENSE") { - rename { "${it}_${project.archivesBaseName}" } - } from("LICENSE-fml.txt") from("CREDITS-fml.txt") from("MinecraftForge-Credits.txt") @@ -126,7 +165,7 @@ modrinth { token = System.getenv("MODRINTH_TOKEN") == null ? "dev" : System.getenv("MODRINTH_TOKEN") // This is the default. Remember to have the MODRINTH_TOKEN environment variable set or else this will fail, or set it to whatever you want - just make sure it stays private! projectId = "JpHZ1Cyv" // This can be the project ID or the slug. Either will work! versionName = displayVersion - changelog = "Update to Mod-Remapping-API 1.7.1 and use ASM Magic." + changelog = "Update to MRAPI 1.14.2.\nFix more compatibility issues with CodeChickenCore and NEI.\nNEI plugins still do not work for now." uploadFile = remapJar gameVersions = [project.minecraft_version] // Must be an array, even with only one version debugMode = debug @@ -134,6 +173,6 @@ modrinth { // scope.type // The scope can be `required`, `optional`, `incompatible`, or `embedded` // The type can either be `project` or `version` - required.version "eRGeQXjD", project.mod_remapping_api + required.version "mod-remapping-api", project.mod_remapping_api } } diff --git a/gradle.properties b/gradle.properties index 1280ba1c..9789a33c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,13 +6,15 @@ org.gradle.jvmargs=-Xmx2G # Fabric Properties minecraft_version = 1.4.3 yarn_mappings = 451 - loader_version = 0.14.13 + loader_version = 0.14.22 # Legacy Fabric API - mod_remapping_api = 1.7.1 + mod_remapping_api = 1.14.2 forge_version = 6.2.1.358 + mixin_extras_version=0.2.0-beta.8 + spasm_version=0.1.2 # Mod Properties - mod_version = 2.4.0 + mod_version = 2.6.0 maven_group = fr.catcore archives_base_name = fabricated-forge diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 249e5832..033e24c4 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ae04661e..9f4197d5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index a69d9cb6..fcb6fca1 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +130,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,6 +197,10 @@ if "$cygwin" || "$msys" ; then done fi + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Collect all arguments for the java command; # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # shell script including quotes and variable substitutions, so put them in diff --git a/gradlew.bat b/gradlew.bat index 53a6b238..6689b85b 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% diff --git a/lib/CodeChickenCore-0.6.12.jar b/lib/CodeChickenCore-0.6.12.jar new file mode 100644 index 00000000..050317a9 Binary files /dev/null and b/lib/CodeChickenCore-0.6.12.jar differ diff --git a/lib/NotEnoughItems-1.4.2.1.jar b/lib/NotEnoughItems-1.4.2.1.jar new file mode 100644 index 00000000..c4372672 Binary files /dev/null and b/lib/NotEnoughItems-1.4.2.1.jar differ diff --git a/mod-compat/build.gradle b/mod-compat/build.gradle new file mode 100644 index 00000000..7aee06f7 --- /dev/null +++ b/mod-compat/build.gradle @@ -0,0 +1,14 @@ +//project.name = "fabricated-forge-mod-compat" + +dependencies { + // How to add a mod + // add the intermediary jar of the mod in rootfolder/lib with a dummy fabric.mod.json file in it + // if the file is named like "filename-fileversion.jar" then import it this way: + // modCompileOnly(group: "local", name: "filename", version: "fileversion") + modCompileOnly(group: "local", name: "CodeChickenCore", version: "0.6.12") + modCompileOnly(group: "local", name: "NotEnoughItems", version: "1.4.2.1") +} + +base { + archivesName = "fabricated-forge-mod-compat" +} \ No newline at end of file diff --git a/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/Dummy.java b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/Dummy.java new file mode 100644 index 00000000..9f148b0b --- /dev/null +++ b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/Dummy.java @@ -0,0 +1,9 @@ +package fr.catcore.fabricatedforge.compat; + +import net.fabricmc.loader.api.entrypoint.PreLaunchEntrypoint; + +public class Dummy implements PreLaunchEntrypoint { + @Override + public void onPreLaunch() { + } +} diff --git a/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/ExtraRemapper.java b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/ExtraRemapper.java new file mode 100644 index 00000000..9a8e996b --- /dev/null +++ b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/ExtraRemapper.java @@ -0,0 +1,40 @@ +package fr.catcore.fabricatedforge.compat; + +import fr.catcore.fabricatedforge.util.Utils; +import fr.catcore.modremapperapi.api.ModRemapper; +import fr.catcore.modremapperapi.remapping.RemapUtil; +import fr.catcore.modremapperapi.remapping.VisitorInfos; +import org.spongepowered.asm.mixin.MixinEnvironment; +import org.spongepowered.asm.mixin.Mixins; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ExtraRemapper implements ModRemapper { + @Override + public String[] getJarFolders() { + return new String[0]; + } + + @Override + public Map> getExclusions() { + return new HashMap<>(); + } + + @Override + public void getMappingList(RemapUtil.MappingList mappingList) { + + } + + @Override + public void registerVisitors(VisitorInfos visitorInfos) { + + } + + @Override + public void afterRemap() { + Mixins.addConfiguration("fabricated-forge.mods.mixins.json"); + Utils.TRANSFORMER_EXCLUSIONS.add("fr.catcore.fabricatedforge.compat.nei.NEIFixer"); + } +} diff --git a/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/ModsMixinPlugin.java b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/ModsMixinPlugin.java new file mode 100644 index 00000000..af02472d --- /dev/null +++ b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/ModsMixinPlugin.java @@ -0,0 +1,50 @@ +package fr.catcore.fabricatedforge.compat; + +import org.objectweb.asm.tree.ClassNode; +import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; +import org.spongepowered.asm.mixin.extensibility.IMixinInfo; + +import java.util.List; +import java.util.Set; + +public class ModsMixinPlugin implements IMixinConfigPlugin { + @Override + public void onLoad(String mixinPackage) { + } + + @Override + public String getRefMapperConfig() { + return null; + } + + @Override + public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { + if (mixinClassName.contains(".nei.")) { + try { + this.getClass().getClassLoader().loadClass("codechicken.nei.forge.IContainerClientSide"); + return true; + } catch (ClassNotFoundException e) { + return false; + } + } + return true; + } + + @Override + public void acceptTargets(Set myTargets, Set otherTargets) { + + } + + @Override + public List getMixins() { + return null; + } + + @Override + public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { + } + + @Override + public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { + } +} diff --git a/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/codechickencore/ClassHeirachyManagerMixin.java b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/codechickencore/ClassHeirachyManagerMixin.java new file mode 100644 index 00000000..c06f698d --- /dev/null +++ b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/codechickencore/ClassHeirachyManagerMixin.java @@ -0,0 +1,14 @@ +package fr.catcore.fabricatedforge.compat.mixin.codechickencore; + +import codechicken.core.asm.ClassHeirachyManager; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(ClassHeirachyManager.class) +public class ClassHeirachyManagerMixin { + @Redirect(method = "classExtends(Ljava/lang/String;Ljava/lang/String;)Z", at = @At(value = "INVOKE", target = "Ljava/lang/Class;forName(Ljava/lang/String;)Ljava/lang/Class;", remap = false), remap = false) + private static Class fixClassExtends(String className) throws ClassNotFoundException { + return Class.forName(className, false, ClassHeirachyManager.class.getClassLoader()); + } +} diff --git a/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/codechickencore/ClassMappingMixin.java b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/codechickencore/ClassMappingMixin.java new file mode 100644 index 00000000..99d0ca35 --- /dev/null +++ b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/codechickencore/ClassMappingMixin.java @@ -0,0 +1,24 @@ +package fr.catcore.fabricatedforge.compat.mixin.codechickencore; + +import codechicken.core.asm.ObfuscationManager; +import fr.catcore.fabricatedforge.Constants; +import fr.catcore.fabricatedforge.compat.nei.NEIFixer; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(ObfuscationManager.ClassMapping.class) +public class ClassMappingMixin { + @Shadow(remap = false) public String classname; + + @Inject(method = "", remap = false, at = @At("RETURN")) + private void remapClassName(String classname, CallbackInfo ci) { + if (NEIFixer.FIX_CLASSES.containsKey(classname)) { + this.classname = NEIFixer.FIX_CLASSES.get(classname); + } else if (!this.classname.contains(".")) { + this.classname = Constants.getRemappedClassName(this.classname); + } + } +} diff --git a/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/codechickencore/ClassOverriderMixin.java b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/codechickencore/ClassOverriderMixin.java new file mode 100644 index 00000000..fb704c82 --- /dev/null +++ b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/codechickencore/ClassOverriderMixin.java @@ -0,0 +1,22 @@ +package fr.catcore.fabricatedforge.compat.mixin.codechickencore; + +import codechicken.core.asm.ClassOverrider; +import codechicken.core.asm.ObfuscationManager; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import java.io.File; + +@Mixin(ClassOverrider.class) +public class ClassOverriderMixin { + @Inject(method = "overrideBytes", remap = false, at = @At("HEAD"), cancellable = true) + private static void disableClassOverwriting(String name, byte[] bytes, ObfuscationManager.ClassMapping classMapping, File location, CallbackInfoReturnable cir) { + if (classMapping.classname.equals(name)) { + System.out.println("[ClassOverrider] Canceled class overwrite of " + name); + } + + cir.setReturnValue(bytes); + } +} diff --git a/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/codechickencore/FieldMappingMixin.java b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/codechickencore/FieldMappingMixin.java new file mode 100644 index 00000000..02aa27b3 --- /dev/null +++ b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/codechickencore/FieldMappingMixin.java @@ -0,0 +1,29 @@ +package fr.catcore.fabricatedforge.compat.mixin.codechickencore; + +import codechicken.core.asm.ObfuscationManager; +import fr.catcore.fabricatedforge.Constants; +import net.fabricmc.tinyremapper.extension.mixin.common.data.Pair; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(ObfuscationManager.FieldMapping.class) +public class FieldMappingMixin { + @Shadow(remap = false) public String owner; + + @Shadow(remap = false) public String name; + + @Shadow(remap = false) public String type; + + @Inject(method = "", at = @At("RETURN"), remap = false) + private void remap(String declaringclass, String fieldname, String type, CallbackInfo ci) { + if (!this.owner.contains(".")) { + this.owner = Constants.getRemappedClassName(this.owner); + } + Pair pair = Constants.getRemappedFieldName(this.owner, this.name, this.type); + this.name = pair.first(); + this.type = pair.second(); + } +} diff --git a/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/codechickencore/MethodMappingMixin.java b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/codechickencore/MethodMappingMixin.java new file mode 100644 index 00000000..a63f46d2 --- /dev/null +++ b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/codechickencore/MethodMappingMixin.java @@ -0,0 +1,54 @@ +package fr.catcore.fabricatedforge.compat.mixin.codechickencore; + +import codechicken.core.asm.ObfuscationManager; +import fr.catcore.fabricatedforge.Constants; +import fr.catcore.fabricatedforge.compat.nei.NEIFixer; +import net.fabricmc.tinyremapper.extension.mixin.common.data.Pair; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(ObfuscationManager.MethodMapping.class) +public class MethodMappingMixin { + @Shadow(remap = false) public String owner; + + @Shadow(remap = false) public String name; + + @Shadow(remap = false) public String desc; + + @Inject(method = "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", remap = false, at = @At("RETURN")) + private void remap(String declaringclass, String methodname, String descriptor, CallbackInfo ci) { + this.remap(); + } + + @Inject(method = "(Ljava/lang/String;Lcodechicken/core/asm/ObfuscationManager$MethodMapping;)V", remap = false, at = @At("RETURN")) + private void remap(String declaringclass, ObfuscationManager.MethodMapping methodmap, CallbackInfo ci) { + this.remap(); + } + + @Unique + private void remap() { + if (NEIFixer.FIX_CLASSES.containsKey(this.owner)) { + this.owner = NEIFixer.FIX_CLASSES.get(this.owner); + } else if (!this.owner.contains(".")) { + this.owner = Constants.getRemappedClassName(this.owner); + } + + Pair pair = Constants.getRemappedMethodName(this.owner, this.name, this.desc); + + if (NEIFixer.FIX_METHOD_NAMES.containsKey(this.name)) { + this.name = NEIFixer.FIX_METHOD_NAMES.get(this.name); + } else { + this.name = pair.first(); + } + + if (NEIFixer.FIX_METHOD_ARGS.containsKey(this.desc)) { + this.desc = NEIFixer.FIX_METHOD_ARGS.get(this.desc); + } else { + this.desc = pair.second(); + } + } +} diff --git a/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/nei/FurnaceRecipeHandlerMixin.java b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/nei/FurnaceRecipeHandlerMixin.java new file mode 100644 index 00000000..7ca08dfb --- /dev/null +++ b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/nei/FurnaceRecipeHandlerMixin.java @@ -0,0 +1,19 @@ +package fr.catcore.fabricatedforge.compat.mixin.nei; + +import codechicken.nei.recipe.FurnaceRecipeHandler; +import fr.catcore.modremapperapi.remapping.RemapUtil; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +import java.lang.reflect.Method; + +@Mixin(FurnaceRecipeHandler.class) +public class FurnaceRecipeHandlerMixin { + @Redirect(method = "findFuels", remap = false, at = @At(value = "INVOKE", target = "Ljava/lang/Class;getDeclaredMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;")) + private static Method fixFindFuels(Class instance, String name, Class[] parameterTypes) throws NoSuchMethodException { + name = RemapUtil.getRemappedMethodName(instance, name, parameterTypes); + + return instance.getDeclaredMethod(name, parameterTypes); + } +} diff --git a/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/nei/HandledScreenMixin.java b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/nei/HandledScreenMixin.java new file mode 100644 index 00000000..04b6a712 --- /dev/null +++ b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/nei/HandledScreenMixin.java @@ -0,0 +1,258 @@ +package fr.catcore.fabricatedforge.compat.mixin.nei; + +import codechicken.nei.forge.GuiContainerManager; +import codechicken.nei.forge.IContainerClientSide; +import com.llamalad7.mixinextras.injector.WrapWithCondition; +import com.mojang.blaze3d.platform.GLX; +import fr.catcore.fabricatedforge.compat.nei.NEIHandledScreen; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.screen.ingame.HandledScreen; +import net.minecraft.client.network.ClientPlayerInteractionManager; +import net.minecraft.client.render.DiffuseLighting; +import net.minecraft.client.render.item.ItemRenderer; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.inventory.slot.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.screen.ScreenHandler; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import java.util.List; + +@Mixin(HandledScreen.class) +public abstract class HandledScreenMixin extends Screen implements NEIHandledScreen { + @Shadow protected int x; + @Shadow protected int y; + + @Shadow private Slot focusedSlot; + @Shadow public ScreenHandler screenHandler; + @Shadow protected int backgroundHeight; + + @Shadow protected abstract boolean handleHotbarKeyPressed(int keyCode); + + @Shadow protected abstract Slot getSlotAt(int x, int y); + + @Shadow protected int backgroundWidth; + + @Shadow protected abstract void onMouseClick(Slot slot, int invSlot, int button, int slotAction); + + @Shadow protected abstract void drawBackground(float delta, int mouseX, int mouseY); + + @Shadow protected abstract void drawSlot(Slot slot); + + @Shadow protected abstract boolean isPointOverSlot(Slot slot, int pointX, int pointY); + + @Shadow protected abstract void drawForeground(int mouseX, int mouseY); + + @Shadow protected static ItemRenderer field_1346; + public GuiContainerManager manager; + + @Override + public void method_1028(Minecraft mc, int i, int j) { + super.method_1028(mc, i, j); + if (mc.currentScreen == this) { + this.manager = new GuiContainerManager((HandledScreen)(Object) this); + this.manager.load(); + } + } + + /** + * @author ChickenBones + * @reason hooks for NEI + */ + @Overwrite + public void render(int par1, int par2, float par3) { + this.manager.preDraw(); + this.renderBackground(); + int var4 = this.x; + int var5 = this.y; + this.drawBackground(par3, par1, par2); + GL11.glDisable(32826); + DiffuseLighting.disable(); + GL11.glDisable(2896); + GL11.glDisable(2929); + super.render(par1, par2, par3); + DiffuseLighting.enable(); + GL11.glPushMatrix(); + GL11.glTranslatef((float)var4, (float)var5, 0.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glEnable(32826); + this.focusedSlot = null; + short var6 = 240; + short var7 = 240; + GLX.gl13MultiTexCoord2f(GLX.lightmapTextureUnit, (float)var6 / 1.0F, (float)var7 / 1.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + boolean objectundermouse = this.manager.objectUnderMouse(par1, par2); + + for(int var10 = 0; var10 < this.screenHandler.slots.size(); ++var10) { + Slot var11 = (Slot)this.screenHandler.slots.get(var10); + this.drawSlot(var11); + if (this.isPointOverSlot(var11, par1, par2) && !objectundermouse) { + this.focusedSlot = var11; + GL11.glDisable(2896); + GL11.glDisable(2929); + int var8 = var11.x; + int var9 = var11.y; + this.fillGradient(var8, var9, var8 + 16, var9 + 16, -2130706433, -2130706433); + GL11.glEnable(2896); + GL11.glEnable(2929); + } + } + + this.drawForeground(par1, par2); + PlayerInventory var12 = this.field_1229.playerEntity.inventory; + GL11.glTranslatef((float)(-var4), (float)(-var5), 200.0F); + this.manager.renderObjects(par1, par2); + GL11.glTranslatef((float)var4, (float)var5, -200.0F); + if (var12.getCursorStack() != null) { + GL11.glTranslatef(0.0F, 0.0F, 32.0F); + this.zOffset = 500.0F; + field_1346.zOffset = 500.0F; + field_1346.method_4336(this.textRenderer, this.field_1229.textureManager, var12.getCursorStack(), par1 - var4 - 8, par2 - var5 - 8); + field_1346.method_1549(this.textRenderer, this.field_1229.textureManager, var12.getCursorStack(), par1 - var4 - 8, par2 - var5 - 8); + this.zOffset = 0.0F; + field_1346.zOffset = 0.0F; + } + + this.manager.renderToolTips(par1, par2); + GL11.glPopMatrix(); + GL11.glEnable(2896); + GL11.glEnable(2929); + DiffuseLighting.enableNormally(); + } + + @Override + public List handleTooltip(int mousex, int mousey, List currenttip) { + return currenttip; + } + + @Override + public List handleItemTooltip(ItemStack stack, int mousex, int mousey, List currenttip) { + return currenttip; + } + + @Inject(method = "drawSlot", at = { + @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glEnable(I)V", ordinal = 1, remap = false), + @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/client/render/item/ItemRenderer;method_1549(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/client/TextureManager;Lnet/minecraft/item/ItemStack;II)V") + }) + private void renderSlotUnderlay(Slot par1Slot, CallbackInfo ci) { + this.manager.renderSlotUnderlay(par1Slot); + } + + /** + * @author ChickenBones + * @reason idk + */ + @Overwrite + protected void mouseClicked(int par1, int par2, int par3) { + super.mouseClicked(par1, par2, par3); + boolean var4 = par3 == this.field_1229.options.keyPickItem.code + 100; + if (!this.manager.mouseClicked(par1, par2, par3) && (par3 == 0 || par3 == 1 || var4)) { + Slot var5 = this.getSlotAt(par1, par2); + int var6 = this.x; + int var7 = this.y; + boolean var8 = (par1 < var6 || par2 < var7 || par1 >= var6 + this.backgroundWidth || par2 >= var7 + this.backgroundHeight) && var5 == null; + int var9 = -1; + if (var5 != null) { + var9 = var5.id; + } + + if (var8) { + var9 = -999; + } + + if (var9 != -1) { + boolean var10 = Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54); + this.manager.handleMouseClick(var5, var9, par3, var4 ? 3 : (var10 ? 1 : 0)); + } + } + } + + @WrapWithCondition(method = "onMouseClick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;clickSlot(IIIILnet/minecraft/entity/player/PlayerEntity;)Lnet/minecraft/item/ItemStack;")) + private boolean wrapClickSlot( + ClientPlayerInteractionManager interactionManager, int syncId, int slotId, int mouseButton, int actionType, PlayerEntity player + ) { + if (slotId != 1) { + if (this instanceof IContainerClientSide) { + this.screenHandler.onSlotClick(slotId, mouseButton, actionType, player); + } else { + return true; + } + } + + return false; + } + + @Override + protected void mouseReleased(int i, int j, int k) { + if (k >= 0) { + this.manager.mouseUp(i, j, k); + } + } + + /** + * @author ChickenBones + * @reason idk + */ + @Overwrite + protected void keyPressed(char par1, int par2) { + if (par2 == 1) { + this.field_1229.playerEntity.closeHandledScreen(); + } else if (!this.manager.lastKeyTyped(par2, par1)) { + if (!this.handleHotbarKeyPressed(par2) + && par2 == this.field_1229.options.keyPickItem.code + && this.focusedSlot != null + && this.focusedSlot.hasStack()) { + this.onMouseClick(this.focusedSlot, this.focusedSlot.id, this.backgroundHeight, 3); + } + + if (par2 == this.field_1229.options.keyInventory.code) { + this.field_1229.playerEntity.closeHandledScreen(); + } + } + } + + @Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/ControllablePlayerEntity;isAlive()Z")) + private void tickManager(CallbackInfo ci) { + this.manager.guiTick(); + } + + @Override + public void method_1040() { + if (Keyboard.getEventKeyState()) { + if (Keyboard.getEventKey() == 87) { + this.field_1229.toggleFullscreen(); + return; + } + + if (this.manager.firstKeyTyped(Keyboard.getEventKey(), Keyboard.getEventCharacter())) { + return; + } + + this.keyPressed(Keyboard.getEventCharacter(), Keyboard.getEventKey()); + } + } + + @Override + public void handleMouse() { + super.handleMouse(); + int i = Mouse.getEventDWheel(); + if (i != 0) { + this.manager.mouseWheel(i > 0 ? 1 : -1); + } + } + + @Override + public void refresh() { + this.manager.refresh(); + } +} diff --git a/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/nei/TMIUninstallerMixin.java b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/nei/TMIUninstallerMixin.java new file mode 100644 index 00000000..c0e3e4a8 --- /dev/null +++ b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/mixin/nei/TMIUninstallerMixin.java @@ -0,0 +1,19 @@ +package fr.catcore.fabricatedforge.compat.mixin.nei; + +import codechicken.nei.TMIUninstaller; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.ModClassLoader; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import java.io.File; + +@Mixin(TMIUninstaller.class) +public class TMIUninstallerMixin { + @Inject(method = "getJarFile", remap = false, at = @At("HEAD"), cancellable = true) + private static void fixGetJar(CallbackInfoReturnable cir) { + cir.setReturnValue(((ModClassLoader) Loader.instance().getModClassLoader()).getParentSources()[0]); + } +} diff --git a/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/nei/NEIFixer.java b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/nei/NEIFixer.java new file mode 100644 index 00000000..25dc76b5 --- /dev/null +++ b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/nei/NEIFixer.java @@ -0,0 +1,22 @@ +package fr.catcore.fabricatedforge.compat.nei; + +import java.util.HashMap; +import java.util.Map; + +public class NEIFixer { + public static Map FIX_CLASSES = new HashMap<>(); + public static Map FIX_METHOD_NAMES = new HashMap<>(); + public static Map FIX_METHOD_ARGS = new HashMap<>(); + + static { + FIX_CLASSES.put("net.minecraft.src.GuiContainer", "net.minecraft.class_409"); + FIX_CLASSES.put("net.minecraft.src.GuiScreen", "net.minecraft.class_388"); + FIX_CLASSES.put("net.minecraft.src.BlockMobSpawner", "net.minecraft.class_159"); + FIX_CLASSES.put("net.minecraft.src.Block", "net.minecraft.class_197"); + + FIX_METHOD_NAMES.put("updateScreen", "method_1033"); + FIX_METHOD_NAMES.put("onBlockPlacedBy", "method_419"); + + FIX_METHOD_ARGS.put("(Lnet/minecraft/src/World;IIILnet/minecraft/src/EntityLiving;)V", "(Lnet/minecraft/class_1150;IIILnet/minecraft/class_871;)V"); + } +} diff --git a/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/nei/NEIHandledScreen.java b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/nei/NEIHandledScreen.java new file mode 100644 index 00000000..b8f1693b --- /dev/null +++ b/mod-compat/src/main/java/fr/catcore/fabricatedforge/compat/nei/NEIHandledScreen.java @@ -0,0 +1,12 @@ +package fr.catcore.fabricatedforge.compat.nei; + +import net.minecraft.item.ItemStack; + +import java.util.List; + +public interface NEIHandledScreen { + List handleTooltip(int mousex, int mousey, List currenttip); + List handleItemTooltip(ItemStack stack, int mousex, int mousey, List currenttip); + + void refresh(); +} diff --git a/mod-compat/src/main/resources/fabric.mod.json b/mod-compat/src/main/resources/fabric.mod.json new file mode 100644 index 00000000..80239dfc --- /dev/null +++ b/mod-compat/src/main/resources/fabric.mod.json @@ -0,0 +1,33 @@ +{ + "schemaVersion": 1, + "id": "fabricated-forge-compat", + "version": "${version}", + "name": "Fabricated Forge Mod Compatibility Module", + "description": "", + "authors": [ + "CatCore" + ], + "contributors": [], + "contact": { + "homepage": "https://modrinth.com/mod/fabricated-forge", + "sources": "https://github.com/thecatcore/Fabricated-Legacy-Forge", + "issues": "https://github.com/thecatcore/Fabricated-Legacy-Forge/issues" + }, + "license": "CC0-1.0", + "icon": "assets/fabricated-forge/icon.png", + "environment": "*", + "entrypoints": { + "mod-remapper-api:modremapper": [ + "fr.catcore.fabricatedforge.compat.ExtraRemapper" + ], + "preLaunch": [ + "fr.catcore.fabricatedforge.compat.Dummy" + ] + }, + "mixins": [ + ], + "depends": { + "fabricloader": ">0.14.3", + "mod-remapping-api": ">=1.14.2" + } +} diff --git a/mod-compat/src/main/resources/fabricated-forge.mods.mixins.json b/mod-compat/src/main/resources/fabricated-forge.mods.mixins.json new file mode 100644 index 00000000..f849bee6 --- /dev/null +++ b/mod-compat/src/main/resources/fabricated-forge.mods.mixins.json @@ -0,0 +1,24 @@ +{ + "required": true, + "minVersion": "0.8", + "package": "fr.catcore.fabricatedforge.compat.mixin", + "compatibilityLevel": "JAVA_8", + "server": [], + "mixins": [ + "codechickencore.ClassHeirachyManagerMixin", + "codechickencore.ClassMappingMixin", + "codechickencore.ClassOverriderMixin", + "codechickencore.FieldMappingMixin", + "codechickencore.MethodMappingMixin", + "nei.FurnaceRecipeHandlerMixin", + "nei.TMIUninstallerMixin" + ], + "client": [ + "nei.HandledScreenMixin" + ], + "injectors": { + "defaultRequire": 1 + }, + "plugin": "fr.catcore.fabricatedforge.compat.ModsMixinPlugin", + "refmap": "fabricated-forge-mod-compat-refmap.json" +} diff --git a/settings.gradle b/settings.gradle index 53818d89..e6b54afa 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,8 +6,10 @@ pluginManagement { } maven { name = "legacy-fabric" - url = "https://repo.legacyfabric.net/repository/legacyfabric" + url = "https://maven.legacyfabric.net/" } gradlePluginPortal() } } + +include 'mod-compat' \ No newline at end of file diff --git a/src/main/java/cpw/mods/fml/common/asm/transformers/AccessTransformer.java b/src/main/java/cpw/mods/fml/common/asm/transformers/AccessTransformer.java index a7ae21af..96f4e228 100644 --- a/src/main/java/cpw/mods/fml/common/asm/transformers/AccessTransformer.java +++ b/src/main/java/cpw/mods/fml/common/asm/transformers/AccessTransformer.java @@ -22,6 +22,10 @@ import com.google.common.io.LineProcessor; import com.google.common.io.Resources; import cpw.mods.fml.relauncher.IClassTransformer; +import fr.catcore.fabricatedforge.Constants; +import net.fabricmc.loader.api.FabricLoader; +import net.fabricmc.loader.impl.launch.FabricLauncherBase; +import net.fabricmc.tinyremapper.extension.mixin.common.data.Pair; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.tree.ClassNode; @@ -31,8 +35,8 @@ import java.io.*; import java.net.URL; import java.util.Collection; -import java.util.Iterator; import java.util.List; +import java.util.NoSuchElementException; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import java.util.zip.ZipOutputStream; @@ -75,20 +79,35 @@ public boolean processLine(String input) throws IOException { AccessTransformer.Modifier m = AccessTransformer.this.new Modifier(); m.setTargetAccess((String)parts.get(0)); List descriptor = Lists.newArrayList(Splitter.on(".").trimResults().split((CharSequence)parts.get(1))); + + String className = ((String)descriptor.get(0)).replace('/', '.'); + String finalClassName = className; + try { + className = FabricLauncherBase.getLauncher().getMappingConfiguration().getMappings().getClasses().stream() + .filter(classDef -> classDef.getName("official").equals(finalClassName)).findFirst().get() + .getName(FabricLoader.getInstance().getMappingResolver().getCurrentRuntimeNamespace()); + } catch (NullPointerException | NoSuchElementException ignored) {} + + if (className.equals("net")) { + className = "net.minecraft.client.Minecraft"; + } + if (descriptor.size() == 1) { m.modifyClassVisibility = true; } else { - String nameReference = (String)descriptor.get(1); + String nameReference = descriptor.get(1); int parenIdx = nameReference.indexOf(40); if (parenIdx > 0) { - m.desc = nameReference.substring(parenIdx); - m.name = nameReference.substring(0, parenIdx); + Pair o = Constants.getRemappedMethodNameNative(className, + nameReference.substring(0, parenIdx), nameReference.substring(parenIdx)); + m.desc = o.second(); + m.name = o.first(); } else { - m.name = nameReference; + m.name = Constants.getRemappedFieldNameNative(className, nameReference); } } - AccessTransformer.this.modifiers.put(((String)descriptor.get(0)).replace('/', '.'), m); + AccessTransformer.this.modifiers.put(className, m); return true; } } diff --git a/src/main/java/cpw/mods/fml/common/asm/transformers/MarkerTransformer.java b/src/main/java/cpw/mods/fml/common/asm/transformers/MarkerTransformer.java index c9d3f23c..9bd0cde9 100644 --- a/src/main/java/cpw/mods/fml/common/asm/transformers/MarkerTransformer.java +++ b/src/main/java/cpw/mods/fml/common/asm/transformers/MarkerTransformer.java @@ -22,6 +22,8 @@ import com.google.common.io.LineProcessor; import com.google.common.io.Resources; import cpw.mods.fml.relauncher.IClassTransformer; +import net.fabricmc.loader.api.FabricLoader; +import net.fabricmc.loader.impl.launch.FabricLauncherBase; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.tree.ClassNode; @@ -30,6 +32,7 @@ import java.net.URL; import java.util.Iterator; import java.util.List; +import java.util.NoSuchElementException; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import java.util.zip.ZipOutputStream; @@ -69,7 +72,19 @@ public boolean processLine(String input) throws IOException { throw new RuntimeException("Invalid config file line " + input); } else { for(String marker : Lists.newArrayList(Splitter.on(",").trimResults().split((CharSequence)parts.get(1)))) { - MarkerTransformer.this.markers.put(parts.get(0), marker); + String className = ((String)parts.get(0)).replace('/', '.'); + String finalClassName = className; + try { + className = FabricLauncherBase.getLauncher().getMappingConfiguration().getMappings().getClasses().stream() + .filter(classDef -> classDef.getName("official").equals(finalClassName)).findFirst().get() + .getName(FabricLoader.getInstance().getMappingResolver().getCurrentRuntimeNamespace()); + } catch (NullPointerException | NoSuchElementException ignored) {} + + if (className.equals("net")) { + className = "net.minecraft.client.Minecraft"; + } + + MarkerTransformer.this.markers.put(className, marker); } return true; diff --git a/src/main/java/cpw/mods/fml/relauncher/IClassTransformer.java b/src/main/java/cpw/mods/fml/relauncher/IClassTransformer.java index 0aec6893..307a31e8 100644 --- a/src/main/java/cpw/mods/fml/relauncher/IClassTransformer.java +++ b/src/main/java/cpw/mods/fml/relauncher/IClassTransformer.java @@ -13,6 +13,49 @@ */ package cpw.mods.fml.relauncher; -public interface IClassTransformer { +import fr.catcore.fabricatedforge.util.Utils; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public interface IClassTransformer extends fr.catcore.modremapperapi.api.IClassTransformer { + static final List CLASS_NAMES = new ArrayList<>(); + + Map> transformed = new HashMap<>(); + byte[] transform(String string, byte[] bs); + + @Override + default byte[] transformClass(String name, String transformedName, byte[] original) { + if (original == null) return null; + return this.transform(name, original); + } + + @Override + default boolean handlesClass(String s, String s1) { + String className = this.getClass().getName(); + + if (!CLASS_NAMES.contains(className)) { + CLASS_NAMES.add(className); + transformed.put(this, new ArrayList<>()); + } + + if (CLASS_NAMES.contains(s)) return false; + + for (String toExclude : Utils.TRANSFORMER_EXCLUSIONS) { + if (s.startsWith(toExclude)) return false; + } + + if (transformed.get(this).contains(s)) { + throw new RuntimeException("Detected transformation loop for class " + s + " in ClassTransformer " + className); + } + + transformed.get(this).add(s); + + if (s.equals("net.minecraft.class_415") && this.getClass().getName().equals("codechicken.nei.asm.NEITransformer")) return false; + + return true; + } } \ No newline at end of file diff --git a/src/main/java/cpw/mods/fml/relauncher/ReflectionHelper.java b/src/main/java/cpw/mods/fml/relauncher/ReflectionHelper.java index a0c04bd4..8c2ba809 100644 --- a/src/main/java/cpw/mods/fml/relauncher/ReflectionHelper.java +++ b/src/main/java/cpw/mods/fml/relauncher/ReflectionHelper.java @@ -82,7 +82,7 @@ public static Class getClass(ClassLoader loader, String... class { try { - return (Class) Class.forName(className, false, loader); + return (Class) Class.forName(className, false, ReflectionHelper.class.getClassLoader()); } catch (Exception e) { diff --git a/src/main/java/cpw/mods/fml/relauncher/RelaunchClassLoader.java b/src/main/java/cpw/mods/fml/relauncher/RelaunchClassLoader.java index 3b3f756d..5ce239cb 100644 --- a/src/main/java/cpw/mods/fml/relauncher/RelaunchClassLoader.java +++ b/src/main/java/cpw/mods/fml/relauncher/RelaunchClassLoader.java @@ -14,7 +14,17 @@ package cpw.mods.fml.relauncher; import java.net.*; +import java.security.CodeSigner; +import java.security.CodeSource; +import java.util.jar.Attributes; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; +import java.util.jar.Manifest; + +import fr.catcore.fabricatedforge.util.Utils; +import fr.catcore.modremapperapi.ClassTransformer; import net.fabricmc.loader.impl.launch.FabricLauncherBase; +import net.fabricmc.loader.impl.util.UrlUtil; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -54,7 +64,10 @@ public RelaunchClassLoader() { public void registerTransformer(String transformerClassName) { try { - this.transformers.add((IClassTransformer)this.loadClass(transformerClassName).newInstance()); + IClassTransformer classTransformer = (IClassTransformer)Class.forName(transformerClassName).newInstance(); + ClassTransformer.registerTransformer(classTransformer); + System.out.println("Registered ClassTransformer: " + transformerClassName); + this.transformers.add(classTransformer); } catch (Exception var3) { FMLRelaunchLog.log(Level.SEVERE, var3, "A critical problem occured registering the ASM transformer class %s", new Object[]{transformerClassName}); } @@ -109,27 +122,28 @@ public Class findClass(String name) throws ClassNotFoundException { } public byte[] getClassBytes(String name) throws IOException { - InputStream classStream = null; - - Object var4; - try { - URL classResource = this.findResource(name.replace('.', '/').concat(".class")); - if (classResource != null) { - classStream = classResource.openStream(); - return this.readFully(classStream); - } - - var4 = null; - } finally { - if (classStream != null) { - try { - classStream.close(); - } catch (IOException var12) { - } - } - } - - return (byte[])var4; + return null; + // InputStream classStream = null; +// +// Object var4; +// try { +// URL classResource = this.findResource(name.replace('.', '/').concat(".class")); +// if (classResource != null) { +// classStream = classResource.openStream(); +// return this.readFully(classStream); +// } +// +// var4 = null; +// } finally { +// if (classStream != null) { +// try { +// classStream.close(); +// } catch (IOException var12) { +// } +// } +// } +// +// return (byte[])var4; } private byte[] runTransformers(String name, byte[] basicClass) { @@ -142,6 +156,9 @@ private byte[] runTransformers(String name, byte[] basicClass) { public void addURL(URL url) { super.addURL(url); + + FabricLauncherBase.getLauncher().addToClassPath(UrlUtil.asPath(url)); + this.sources.add(url); } @@ -170,9 +187,11 @@ public List getTransformers() { private void addClassLoaderExclusion(String toExclude) { this.classLoaderExceptions.add(toExclude); + Utils.TRANSFORMER_EXCLUSIONS.add(toExclude); } void addTransformerExclusion(String toExclude) { this.transformerExceptions.add(toExclude); + Utils.TRANSFORMER_EXCLUSIONS.add(toExclude); } } diff --git a/src/main/java/cpw/mods/fml/relauncher/RelaunchLibraryManager.java b/src/main/java/cpw/mods/fml/relauncher/RelaunchLibraryManager.java index 1de535f2..170d3277 100644 --- a/src/main/java/cpw/mods/fml/relauncher/RelaunchLibraryManager.java +++ b/src/main/java/cpw/mods/fml/relauncher/RelaunchLibraryManager.java @@ -51,11 +51,11 @@ public static void handleLaunch(File mcDir, RelaunchClassLoader actualClassLoade for(String s : rootPlugins) { try { - IFMLLoadingPlugin plugin = (IFMLLoadingPlugin)Class.forName(s, true, actualClassLoader).newInstance(); + IFMLLoadingPlugin plugin = (IFMLLoadingPlugin)Class.forName(s, true, RelaunchLibraryManager.class.getClassLoader()).newInstance(); loadPlugins.add(plugin); for(String libName : plugin.getLibraryRequestClass()) { - libraries.add((ILibrarySet)Class.forName(libName, true, actualClassLoader).newInstance()); + libraries.add((ILibrarySet)Class.forName(libName, true, RelaunchLibraryManager.class.getClassLoader()).newInstance()); } } catch (Exception var42) { } @@ -73,7 +73,7 @@ public static void handleLaunch(File mcDir, RelaunchClassLoader actualClassLoade try { actualClassLoader.addTransformerExclusion(s); - Class coreModClass = Class.forName(s, true, actualClassLoader); + Class coreModClass = Class.forName(s, true, RelaunchLibraryManager.class.getClassLoader()); IFMLLoadingPlugin.TransformerExclusions trExclusions = (IFMLLoadingPlugin.TransformerExclusions)coreModClass.getAnnotation(IFMLLoadingPlugin.TransformerExclusions.class); if (trExclusions != null) { for(String st : trExclusions.value()) { @@ -85,7 +85,7 @@ public static void handleLaunch(File mcDir, RelaunchClassLoader actualClassLoade loadPlugins.add(plugin); if (plugin.getLibraryRequestClass() != null) { for(String libName : plugin.getLibraryRequestClass()) { - libraries.add((ILibrarySet)Class.forName(libName, true, actualClassLoader).newInstance()); + libraries.add((ILibrarySet)Class.forName(libName, true, RelaunchLibraryManager.class.getClassLoader()).newInstance()); } } } catch (Throwable var41) { @@ -330,7 +330,7 @@ public static void handleLaunch(File mcDir, RelaunchClassLoader actualClassLoade String setupClass = plugin.getSetupClass(); if (setupClass != null) { try { - IFMLCallHook call = (IFMLCallHook)Class.forName(setupClass, true, actualClassLoader).newInstance(); + IFMLCallHook call = (IFMLCallHook)Class.forName(setupClass, true, RelaunchLibraryManager.class.getClassLoader()).newInstance(); Map callData = new HashMap(); callData.put("classLoader", actualClassLoader); call.injectData(callData); @@ -349,7 +349,7 @@ public static void handleLaunch(File mcDir, RelaunchClassLoader actualClassLoade try { downloadMonitor.updateProgressString("Validating minecraft", new Object[0]); - Class loaderClazz = Class.forName("cpw.mods.fml.common.Loader", true, actualClassLoader); + Class loaderClazz = Class.forName("cpw.mods.fml.common.Loader", true, RelaunchLibraryManager.class.getClassLoader()); Method m = loaderClazz.getMethod("injectData", Object[].class); m.invoke(null, (Object)FMLInjectionData.data()); m = loaderClazz.getMethod("instance"); @@ -402,7 +402,7 @@ public boolean accept(File dir, String name) { try { downloadMonitor.updateProgressString("Loading coremod %s", new Object[]{coreMod.getName()}); classLoader.addTransformerExclusion(fmlCorePlugin); - Class coreModClass = Class.forName(fmlCorePlugin, true, classLoader); + Class coreModClass = Class.forName(fmlCorePlugin, true, RelaunchLibraryManager.class.getClassLoader()); IFMLLoadingPlugin.TransformerExclusions trExclusions = (IFMLLoadingPlugin.TransformerExclusions)coreModClass.getAnnotation(IFMLLoadingPlugin.TransformerExclusions.class); if (trExclusions != null) { for(String st : trExclusions.value()) { @@ -415,7 +415,7 @@ public boolean accept(File dir, String name) { pluginLocations.put(plugin, coreMod); if (plugin.getLibraryRequestClass() != null) { for(String libName : plugin.getLibraryRequestClass()) { - libraries.add((ILibrarySet)Class.forName(libName, true, classLoader).newInstance()); + libraries.add((ILibrarySet)Class.forName(libName, true, RelaunchLibraryManager.class.getClassLoader()).newInstance()); } } diff --git a/src/main/java/fr/catcore/fabricatedforge/Constants.java b/src/main/java/fr/catcore/fabricatedforge/Constants.java index dbee6280..ce686578 100644 --- a/src/main/java/fr/catcore/fabricatedforge/Constants.java +++ b/src/main/java/fr/catcore/fabricatedforge/Constants.java @@ -1,6 +1,17 @@ package fr.catcore.fabricatedforge; +import net.fabricmc.loader.api.FabricLoader; +import net.fabricmc.loader.api.MappingResolver; +import net.fabricmc.loader.impl.launch.FabricLauncherBase; +import net.fabricmc.mapping.tree.ClassDef; +import net.fabricmc.mapping.tree.FieldDef; +import net.fabricmc.mapping.tree.MethodDef; +import net.fabricmc.tinyremapper.extension.mixin.common.data.Pair; + import java.io.File; +import java.util.Objects; + +import static fr.catcore.modremapperapi.remapping.RemapUtil.getNativeNamespace; public class Constants { public static final String FORGE_URL = "https://maven.minecraftforge.net/net/minecraftforge/forge/1.4.3-6.2.1.358/forge-1.4.3-6.2.1.358-universal.zip"; @@ -12,4 +23,86 @@ public class Constants { MODS_FOLDER.mkdirs(); COREMODS_FOLDER.mkdirs(); } + + public static Pair getRemappedMethodNameNative(String owner, String methodName, String argDesc) { + MappingResolver resolver = FabricLoader.getInstance().getMappingResolver(); + + for(ClassDef def : FabricLauncherBase.getLauncher().getMappingConfiguration().getMappings().getClasses()) { + if (def.getName(getNativeNamespace()).replace(".", "/").equals(owner.replace(".", "/"))) { + for(MethodDef methodDef : def.getMethods()) { + if (Objects.equals(methodDef.getName(getNativeNamespace()), methodName)) { + String methodDescriptor = methodDef.getDescriptor(getNativeNamespace()); + if (methodDescriptor.startsWith(argDesc)) { + return Pair.of(methodDef.getName(resolver.getCurrentRuntimeNamespace()), methodDef.getDescriptor(resolver.getCurrentRuntimeNamespace())); + } + } + } + } + } + + return Pair.of(methodName, argDesc); + } + + public static Pair getRemappedMethodName(String owner, String methodName, String argDesc) { + MappingResolver resolver = FabricLoader.getInstance().getMappingResolver(); + + for(ClassDef def : FabricLauncherBase.getLauncher().getMappingConfiguration().getMappings().getClasses()) { + if (def.getName(resolver.getCurrentRuntimeNamespace()).replace(".", "/").equals(owner.replace(".", "/"))) { + for(MethodDef methodDef : def.getMethods()) { + if (Objects.equals(methodDef.getName(getNativeNamespace()), methodName)) { + String methodDescriptor = methodDef.getDescriptor(getNativeNamespace()); + if (methodDescriptor.startsWith(argDesc)) { + return Pair.of(methodDef.getName(resolver.getCurrentRuntimeNamespace()), methodDef.getDescriptor(resolver.getCurrentRuntimeNamespace())); + } + } + } + } + } + + return Pair.of(methodName, argDesc); + } + + public static String getRemappedClassName(String name) { + MappingResolver resolver = FabricLoader.getInstance().getMappingResolver(); + + for(ClassDef def : FabricLauncherBase.getLauncher().getMappingConfiguration().getMappings().getClasses()) { + if (def.getName(getNativeNamespace()).replace(".", "/").equals(name.replace(".", "/"))) { + return def.getName(resolver.getCurrentRuntimeNamespace()).replace("/", "."); + } + } + + return name.replace("/", "."); + } + + public static String getRemappedFieldNameNative(String owner, String fieldName) { + MappingResolver resolver = FabricLoader.getInstance().getMappingResolver(); + + for(ClassDef def : FabricLauncherBase.getLauncher().getMappingConfiguration().getMappings().getClasses()) { + if (def.getName(getNativeNamespace()).replace(".", "/").equals(owner.replace(".", "/"))) { + for(FieldDef fieldDef : def.getFields()) { + if (Objects.equals(fieldDef.getName(getNativeNamespace()), fieldName)) { + return fieldDef.getName(resolver.getCurrentRuntimeNamespace()); + } + } + } + } + + return fieldName; + } + + public static Pair getRemappedFieldName(String owner, String fieldName, String fieldDesc) { + MappingResolver resolver = FabricLoader.getInstance().getMappingResolver(); + + for(ClassDef def : FabricLauncherBase.getLauncher().getMappingConfiguration().getMappings().getClasses()) { + if (def.getName(resolver.getCurrentRuntimeNamespace()).replace(".", "/").equals(owner.replace(".", "/"))) { + for(FieldDef fieldDef : def.getFields()) { + if (Objects.equals(fieldDef.getName(getNativeNamespace()), fieldName)) { + return Pair.of(fieldDef.getName(resolver.getCurrentRuntimeNamespace()), fieldDef.getDescriptor(resolver.getCurrentRuntimeNamespace())); + } + } + } + } + + return Pair.of(fieldName, fieldDesc); + } } diff --git a/src/main/java/fr/catcore/fabricatedforge/ForgeModRemapper.java b/src/main/java/fr/catcore/fabricatedforge/ForgeModRemapper.java index e32d37e9..80aa0a95 100644 --- a/src/main/java/fr/catcore/fabricatedforge/ForgeModRemapper.java +++ b/src/main/java/fr/catcore/fabricatedforge/ForgeModRemapper.java @@ -5,6 +5,7 @@ import fr.catcore.modremapperapi.remapping.RemapUtil; import fr.catcore.modremapperapi.remapping.VisitorInfos; import net.fabricmc.loader.api.FabricLoader; +import org.spongepowered.asm.mixin.Mixins; import java.util.HashMap; import java.util.List; @@ -58,29 +59,11 @@ private String getOfficialClassName(String className) { @Override public void registerVisitors(VisitorInfos infos) { - Map types = new HashMap<>(); - - for (Map.Entry entry : types.entrySet()) { - infos.registerSuperType(entry.getKey(), entry.getValue()); - infos.registerMethodTypeIns(entry.getKey(), entry.getValue()); - - infos.registerMethodMethodIns( - new VisitorInfos.MethodNamed(entry.getKey().type, ""), - new VisitorInfos.MethodNamed(entry.getValue().type, "") - ); - } - infos.registerMethodMethodIns( new VisitorInfos.MethodNamed("net/minecraft/class_197", "setBurnProperties"), new VisitorInfos.MethodNamed("fr/catcore/fabricatedforge/forged/ReflectionUtils", "Block_setBurnProperties") ); - // Mystcraft - infos.registerMethodFieldIns( - new VisitorInfos.MethodNamed("xcompwiz/mystcraft/Mystcraft", "registeredDims"), - new VisitorInfos.MethodNamed("fr/catcore/fabricatedforge/compat/MystcraftCompat", "registeredDims") - ); - infos.registerMethodFieldIns( new VisitorInfos.MethodNamed("net/minecraft/class_9", "allowedBiomes"), new VisitorInfos.MethodNamed("fr/catcore/fabricatedforge/forged/ReflectionUtils", "StrongholdStructure_allowedBiomes") @@ -98,13 +81,68 @@ public void registerVisitors(VisitorInfos infos) { new VisitorInfos.MethodNamed("net/minecraft/class_570", "NAME_TAG_RANGE_SNEAK"), new VisitorInfos.MethodNamed("fr/catcore/fabricatedforge/forged/ReflectionUtils", "NAME_TAG_RANGE_SNEAK") ); + + // Mystcraft + infos.registerMethodFieldIns( + new VisitorInfos.MethodNamed("xcompwiz/mystcraft/Mystcraft", "registeredDims"), + new VisitorInfos.MethodNamed("fr/catcore/fabricatedforge/compat/MystcraftCompat", "registeredDims") + ); + +// // CodeChickenCore +// infos.registerMethodMethodIns( +// new VisitorInfos.MethodNamed("codechicken/core/asm/ClassOverrider", "overrideBytes"), +// new VisitorInfos.MethodNamed("fr/catcore/fabricatedforge/compat/CodeChickenCoreCompat", "overrideBytes") +// ); +// +// // NEI +// infos.registerMethodLdcIns( +// new VisitorInfos.MethodValue("codechicken/nei/asm/NEITransformer", "aqh"), +// new VisitorInfos.MethodValue("codechicken/nei/asm/NEITransformer", "net.minecraft.class_409") +// ); +// infos.registerMethodLdcIns( +// new VisitorInfos.MethodValue("codechicken/nei/asm/NEITransformer", "apn"), +// new VisitorInfos.MethodValue("codechicken/nei/asm/NEITransformer", "net.minecraft.class_388") +// ); +// infos.registerMethodLdcIns( +// new VisitorInfos.MethodValue("codechicken/nei/asm/NEITransformer", "agu"), +// new VisitorInfos.MethodValue("codechicken/nei/asm/NEITransformer", "net.minecraft.class_159") +// ); +// infos.registerMethodLdcIns( +// new VisitorInfos.MethodValue("codechicken/nei/asm/NEITransformer", "aig"), +// new VisitorInfos.MethodValue("codechicken/nei/asm/NEITransformer", "net.minecraft.class_197") +// ); +// infos.registerMethodLdcIns( +// new VisitorInfos.MethodValue("codechicken/nei/asm/NEITransformer", "c"), +// new VisitorInfos.MethodValue("codechicken/nei/asm/NEITransformer", "method_1033") +// ); +// infos.registerMethodLdcIns( +// new VisitorInfos.MethodValue("codechicken/nei/asm/NEITransformer", "a"), +// new VisitorInfos.MethodValue("codechicken/nei/asm/NEITransformer", "method_419") +// ); +// infos.registerMethodLdcIns( +// new VisitorInfos.MethodValue("codechicken/nei/asm/NEITransformer", "(Lup;IIILjw;)V"), +// new VisitorInfos.MethodValue("codechicken/nei/asm/NEITransformer", "(Lnet/minecraft/class_1150;IIILnet/minecraft/class_871;)V") +// ); +// infos.registerMethodMethodIns( +// new VisitorInfos.MethodNamed("codechicken/nei/TMIUninstaller", "getJarFile"), +// new VisitorInfos.MethodNamed("fr/catcore/fabricatedforge/compat/CodeChickenCoreCompat", "getJarFile") +// ); +// infos.registerMethodLdcIns( +// new VisitorInfos.MethodValue("codechicken/nei/recipe/FurnaceRecipeHandler", "getItemBurnTime"), +// new VisitorInfos.MethodValue("codechicken/nei/recipe/FurnaceRecipeHandler", "method_519") +// ); } @Override public Optional getDefaultPackage() { return Optional.of("net/minecraft/"); } - + + @Override + public void afterRemap() { + + } + static { FORGE_EXCLUDED.put("a") .put("aae") diff --git a/src/main/java/fr/catcore/fabricatedforge/compat/CodeChickenCoreCompat.java b/src/main/java/fr/catcore/fabricatedforge/compat/CodeChickenCoreCompat.java new file mode 100644 index 00000000..7981d31a --- /dev/null +++ b/src/main/java/fr/catcore/fabricatedforge/compat/CodeChickenCoreCompat.java @@ -0,0 +1,4 @@ +package fr.catcore.fabricatedforge.compat; + +public class CodeChickenCoreCompat { +} diff --git a/src/main/java/fr/catcore/fabricatedforge/forged/ReflectionUtils.java b/src/main/java/fr/catcore/fabricatedforge/forged/ReflectionUtils.java index 181f6dac..5ef8f03e 100644 --- a/src/main/java/fr/catcore/fabricatedforge/forged/ReflectionUtils.java +++ b/src/main/java/fr/catcore/fabricatedforge/forged/ReflectionUtils.java @@ -19,6 +19,14 @@ public class ReflectionUtils { public static int[] Block_blockFlammability = new int[4096]; public static void Block_setBurnProperties(int id, int encouragement, int flammability) { + if (Block_blockFireSpreadSpeed == null) { + Block_blockFireSpreadSpeed = new int[4096]; + } + + if (Block_blockFlammability == null) { + Block_blockFlammability = new int[4096]; + } + Block_blockFireSpreadSpeed[id] = encouragement; Block_blockFlammability[id] = flammability; } diff --git a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/client/gui/screen/ingame/CreativeInventoryScreenMixin.java b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/client/gui/screen/ingame/CreativeInventoryScreenMixin.java index 6f2e3757..d7c8907e 100644 --- a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/client/gui/screen/ingame/CreativeInventoryScreenMixin.java +++ b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/client/gui/screen/ingame/CreativeInventoryScreenMixin.java @@ -65,6 +65,18 @@ private void fmlAddChangeButton(CallbackInfo ci) { } } + /** + * @author codechicken + * @reason add super + */ + @Overwrite + public void tick() { + super.tick(); + if (!this.field_1229.interactionManager.hasCreativeInventory()) { + this.field_1229.openScreen(new SurvivalInventoryScreen(this.field_1229.playerEntity)); + } + } + /** * @author Minecraft Forge * @reason none diff --git a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/client/gui/screen/options/ControlsOptionsScreenMixin.java b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/client/gui/screen/options/ControlsOptionsScreenMixin.java index ef6a6bce..e41eb612 100644 --- a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/client/gui/screen/options/ControlsOptionsScreenMixin.java +++ b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/client/gui/screen/options/ControlsOptionsScreenMixin.java @@ -41,7 +41,7 @@ public void init() { * @reason none */ @Overwrite - protected void buttonClicked(ButtonWidget par1GuiButton) { + public void buttonClicked(ButtonWidget par1GuiButton) { if (par1GuiButton.id == 200) { this.field_1229.openScreen(this.parent); } @@ -52,7 +52,7 @@ protected void buttonClicked(ButtonWidget par1GuiButton) { * @reason none */ @Overwrite - protected void mouseClicked(int par1, int par2, int par3) { + public void mouseClicked(int par1, int par2, int par3) { super.mouseClicked(par1, par2, par3); } @@ -61,7 +61,7 @@ protected void mouseClicked(int par1, int par2, int par3) { * @reason none */ @Overwrite - protected void keyPressed(char par1, int par2) { + public void keyPressed(char par1, int par2) { if (this.scrollPane.keyTyped(par1, par2)) { super.keyPressed(par1, par2); } diff --git a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/client/render/entity/BipedEntityRendererMixin.java b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/client/render/entity/BipedEntityRendererMixin.java index e6649f84..6acc3b10 100644 --- a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/client/render/entity/BipedEntityRendererMixin.java +++ b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/client/render/entity/BipedEntityRendererMixin.java @@ -40,7 +40,7 @@ public BipedEntityRendererMixin(EntityModel entityModel, float f) { * @reason none */ @Overwrite - protected int method_1564(MobEntity par1EntityLiving, int par2, float par3) { + public int method_1564(MobEntity par1EntityLiving, int par2, float par3) { ItemStack var4 = par1EntityLiving.method_4485(3 - par2); if (var4 != null) { Item var5 = var4.getItem(); @@ -99,7 +99,7 @@ protected int method_1564(MobEntity par1EntityLiving, int par2, float par3) { * @reason none */ @Overwrite - protected void method_1569(MobEntity par1EntityLiving, float par2) { + public void method_1569(MobEntity par1EntityLiving, float par2) { float var3 = 1.0F; GL11.glColor3f(var3, var3, var3); super.method_1569(par1EntityLiving, par2); diff --git a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/client/render/entity/PlayerEntityRendererMixin.java b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/client/render/entity/PlayerEntityRendererMixin.java index b8ceeb25..8efbc63c 100644 --- a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/client/render/entity/PlayerEntityRendererMixin.java +++ b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/client/render/entity/PlayerEntityRendererMixin.java @@ -44,7 +44,7 @@ public PlayerEntityRendererMixin(EntityModel entityModel, float f) { * @reason none */ @Overwrite - protected int method_1564(PlayerEntity par1EntityPlayer, int par2, float par3) { + public int method_1564(PlayerEntity par1EntityPlayer, int par2, float par3) { ItemStack var4 = par1EntityPlayer.inventory.getArmor(3 - par2); if (var4 != null) { Item var5 = var4.getItem(); @@ -103,7 +103,7 @@ protected int method_1564(PlayerEntity par1EntityPlayer, int par2, float par3) { * @reason none */ @Overwrite - protected void method_4337(PlayerEntity par1EntityPlayer, int par2, float par3) { + public void method_4337(PlayerEntity par1EntityPlayer, int par2, float par3) { ItemStack var4 = par1EntityPlayer.inventory.getArmor(3 - par2); if (var4 != null) { Item var5 = var4.getItem(); @@ -173,7 +173,7 @@ protected void method_1566(PlayerEntity par1EntityPlayer, double par2, double pa * @reason none */ @Overwrite - protected void method_1569(PlayerEntity par1EntityPlayer, float par2) { + public void method_1569(PlayerEntity par1EntityPlayer, float par2) { float var3 = 1.0F; GL11.glColor3f(var3, var3, var3); super.method_1569(par1EntityPlayer, par2); diff --git a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/client/render/entity/SnowGolemEntityRendererMixin.java b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/client/render/entity/SnowGolemEntityRendererMixin.java index 390a06bb..4ec5cc62 100644 --- a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/client/render/entity/SnowGolemEntityRendererMixin.java +++ b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/client/render/entity/SnowGolemEntityRendererMixin.java @@ -29,7 +29,7 @@ public SnowGolemEntityRendererMixin(EntityModel entityModel, float f) { * @reason none */ @Overwrite - protected void method_1569(SnowGolemEntity par1EntitySnowman, float par2) { + public void method_1569(SnowGolemEntity par1EntitySnowman, float par2) { super.method_1569(par1EntitySnowman, par2); ItemStack var3 = new ItemStack(Block.PUMPKIN, 1); if (var3 != null && var3.getItem() instanceof BlockItem) { diff --git a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/client/world/ClientWorldMixin.java b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/client/world/ClientWorldMixin.java index 38958c36..4dab2524 100644 --- a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/client/world/ClientWorldMixin.java +++ b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/client/world/ClientWorldMixin.java @@ -38,7 +38,7 @@ private void ctrFix2(class_469 par1NetClientHandler, LevelInfo par2WorldSettings * @reason none */ @Overwrite - protected void tickWeather() { + public void tickWeather() { super.tickWeather(); } diff --git a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/entity/EntityMixin.java b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/entity/EntityMixin.java index 5137914a..60bfb607 100644 --- a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/entity/EntityMixin.java +++ b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/entity/EntityMixin.java @@ -105,7 +105,7 @@ public abstract class EntityMixin implements IEntity { */ @Environment(EnvType.CLIENT) @Overwrite - protected void afterSpawn() { + public void afterSpawn() { if (this.world != null) { while(true) { if (this.y > 0.0) { diff --git a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/entity/mob/MobEntityMixin.java b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/entity/mob/MobEntityMixin.java index a4a2cdf4..8fa79b5c 100644 --- a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/entity/mob/MobEntityMixin.java +++ b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/entity/mob/MobEntityMixin.java @@ -355,13 +355,12 @@ public boolean damage(DamageSource par1DamageSource, int par2) { * @reason none */ @Overwrite - protected void method_2653(DamageSource par1DamageSource, int par2) { + public void method_2653(DamageSource par1DamageSource, int par2) { if (!this.method_4447()) { par2 = ForgeHooks.onLivingHurt((MobEntity)(Object) this, par1DamageSource, par2); if (par2 <= 0) { return; } - par2 = this.method_2626(par1DamageSource, par2); par2 = this.method_2648(par1DamageSource, par2); this.field_3294 -= par2; @@ -422,7 +421,7 @@ public void dropInventory(DamageSource par1DamageSource) { * @reason none */ @Overwrite - protected void method_2490(float par1) { + public void method_2490(float par1) { par1 = ForgeHooks.onLivingFall((MobEntity)(Object) this, par1); if (!(par1 <= 0.0F)) { super.method_2490(par1); @@ -462,7 +461,7 @@ public boolean method_2660() { * @reason none */ @Overwrite - protected void method_2612() { + public void method_2612() { this.velocityY = 0.42F; if (this.method_2581(StatusEffect.JUMP_BOOST)) { this.velocityY += (double)((float)(this.method_2627(StatusEffect.JUMP_BOOST).getAmplifier() + 1) * 0.1F); diff --git a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/entity/player/PlayerEntityMixin.java b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/entity/player/PlayerEntityMixin.java index 00025ed1..602a16f9 100644 --- a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/entity/player/PlayerEntityMixin.java +++ b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/entity/player/PlayerEntityMixin.java @@ -358,13 +358,12 @@ public boolean isUsingEffectiveTool(Block par1Block) { * @reason none */ @Overwrite - protected void method_2653(DamageSource par1DamageSource, int par2) { + public void method_2653(DamageSource par1DamageSource, int par2) { if (!this.method_4447()) { par2 = ForgeHooks.onLivingHurt(this, par1DamageSource, par2); if (par2 <= 0) { return; } - if (!par1DamageSource.bypassesArmor() && this.method_2611()) { par2 = 1 + par2 >> 1; } diff --git a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/entity/vehicle/AbstractMinecartEntityMixin.java b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/entity/vehicle/AbstractMinecartEntityMixin.java index 7eb9d48a..d2af34b5 100644 --- a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/entity/vehicle/AbstractMinecartEntityMixin.java +++ b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/entity/vehicle/AbstractMinecartEntityMixin.java @@ -542,7 +542,7 @@ public Vec3d snapPositionToRail(double par1, double par3, double par5) { * @reason none */ @Overwrite - protected void writeCustomDataToNbt(NbtCompound par1NBTTagCompound) { + public void writeCustomDataToNbt(NbtCompound par1NBTTagCompound) { par1NBTTagCompound.putInt("Type", this.field_3897); if (this.isPoweredCart()) { par1NBTTagCompound.putDouble("PushX", this.field_3904); @@ -571,7 +571,7 @@ protected void writeCustomDataToNbt(NbtCompound par1NBTTagCompound) { * @reason none */ @Overwrite - protected void readCustomDataFromNbt(NbtCompound par1NBTTagCompound) { + public void readCustomDataFromNbt(NbtCompound par1NBTTagCompound) { this.field_3897 = par1NBTTagCompound.getInt("Type"); if (this.isPoweredCart()) { this.field_3904 = par1NBTTagCompound.getDouble("PushX"); diff --git a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/item/ItemMixin.java b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/item/ItemMixin.java index ffbd5118..048c2e8b 100644 --- a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/item/ItemMixin.java +++ b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/item/ItemMixin.java @@ -64,7 +64,7 @@ private String fmlCtr(String x) { * @reason none */ @Overwrite - protected BlockHitResult onHit(World par1World, PlayerEntity par2EntityPlayer, boolean par3) { + public BlockHitResult onHit(World par1World, PlayerEntity par2EntityPlayer, boolean par3) { float var4 = 1.0F; float var5 = par2EntityPlayer.prevPitch + (par2EntityPlayer.pitch - par2EntityPlayer.prevPitch) * var4; float var6 = par2EntityPlayer.prevYaw + (par2EntityPlayer.yaw - par2EntityPlayer.prevYaw) * var4; diff --git a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/server/MinecraftServerMixin.java b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/server/MinecraftServerMixin.java index df130b11..2ea1f735 100644 --- a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/server/MinecraftServerMixin.java +++ b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/server/MinecraftServerMixin.java @@ -130,7 +130,7 @@ public abstract class MinecraftServerMixin implements Runnable, Snoopable, Comma * @reason none */ @Overwrite - protected void setupWorld(String par1Str, String par2Str, long par3, LevelGeneratorType par5WorldType, String par6Str) { + public void setupWorld(String par1Str, String par2Str, long par3, LevelGeneratorType par5WorldType, String par6Str) { this.upgradeWorld(par1Str); this.setServerOperation("menu.loadingLevel"); SaveHandler var7 = this.saveStorage.createSaveHandler(par1Str, true); diff --git a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/server/dedicated/MinecraftDedicatedServerMixin.java b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/server/dedicated/MinecraftDedicatedServerMixin.java index e6510adc..1a29c4ac 100644 --- a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/server/dedicated/MinecraftDedicatedServerMixin.java +++ b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/server/dedicated/MinecraftDedicatedServerMixin.java @@ -47,7 +47,7 @@ public MinecraftDedicatedServerMixin(File file) { * @reason none */ @Overwrite - protected boolean setupServer() { + public boolean setupServer() { try { class_772 var1 = class_772Accessor.newInstance((MinecraftDedicatedServer) (Object) this); var1.setDaemon(true); diff --git a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/server/integrated/IntegratedServerMixin.java b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/server/integrated/IntegratedServerMixin.java index 2b748d98..e590894e 100644 --- a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/server/integrated/IntegratedServerMixin.java +++ b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/server/integrated/IntegratedServerMixin.java @@ -35,7 +35,7 @@ public IntegratedServerMixin(File file) { * @reason none */ @Overwrite - protected void setupWorld(String par1Str, String par2Str, long par3, LevelGeneratorType par5WorldType, String par6Str) { + public void setupWorld(String par1Str, String par2Str, long par3, LevelGeneratorType par5WorldType, String par6Str) { this.upgradeWorld(par1Str); SaveHandler var7 = this.getSaveStorage().createSaveHandler(par1Str, true); ServerWorld overWorld = (ServerWorld)(this.isDemo() @@ -65,7 +65,7 @@ protected void setupWorld(String par1Str, String par2Str, long par3, LevelGenera * @reason none */ @Overwrite - protected boolean setupServer() { + public boolean setupServer() { field_3848.info("Starting integrated minecraft server version 1.4.3"); this.setOnlineMode(false); this.setSpawnAnimals(true); diff --git a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/server/world/ServerWorldMixin.java b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/server/world/ServerWorldMixin.java index b08ba243..9fb60544 100644 --- a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/server/world/ServerWorldMixin.java +++ b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/server/world/ServerWorldMixin.java @@ -55,8 +55,6 @@ public abstract class ServerWorldMixin extends World implements IServerWorld { @Shadow @Final private MinecraftServer server; - @Shadow public ServerChunkProvider chunkCache; - @Shadow public abstract void resetIdleTimeout(); @Shadow protected abstract void method_2131(); @@ -154,7 +152,7 @@ private void resetWeather() { * @reason none */ @Overwrite - protected void tickBlocks() { + public void tickBlocks() { super.tickBlocks(); int var1 = 0; int var2 = 0; @@ -405,7 +403,7 @@ public boolean canMineBlockBody(PlayerEntity par1EntityPlayer, int par2, int par * @reason none */ @Overwrite - protected void placeBonusChest() { + public void placeBonusChest() { BonusChestFeature var1 = new BonusChestFeature(ChestGenHooks.getItems("bonusChest"), ChestGenHooks.getCount("bonusChest", this.random)); for(int var2 = 0; var2 < 10; ++var2) { @@ -450,9 +448,4 @@ protected void method_2132() throws WorldSaveException { this.persistentStateManager.save(); this.getPerWorldStorage().save(); } - - @Override - public File getChunkSaveLocation() { - return ((IThreadedAnvilChunkStorage)((IServerChunkProvider)this.chunkCache).getChunkWriter()).getSaveLocation(); - } } diff --git a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/world/WorldMixin.java b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/world/WorldMixin.java index baa5cab5..d587d331 100644 --- a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/world/WorldMixin.java +++ b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/world/WorldMixin.java @@ -1011,7 +1011,7 @@ public void calculateInitialWeatherBody() { * @reason none */ @Overwrite - protected void tickWeather() { + public void tickWeather() { this.dimension.updateWeather(); } @@ -1096,7 +1096,7 @@ public void method_3733() { * @reason none */ @Overwrite - protected void updateLighting() { + public void updateLighting() { this.field_4530.clear(); this.field_4530.addAll(this.getPersistentChunks().keySet()); this.profiler.push("buildList"); diff --git a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/world/dimension/DimensionMixin.java b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/world/dimension/DimensionMixin.java index a3a7df21..b5ee1493 100644 --- a/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/world/dimension/DimensionMixin.java +++ b/src/main/java/fr/catcore/fabricatedforge/mixin/forgefml/world/dimension/DimensionMixin.java @@ -44,7 +44,7 @@ public class DimensionMixin implements IDimension { * @reason none */ @Overwrite - protected void init() { + public void init() { this.biomeSource = ((ILevelGeneratorType)this.generatorType).getChunkManager(this.world); } diff --git a/src/main/java/fr/catcore/fabricatedforge/util/Utils.java b/src/main/java/fr/catcore/fabricatedforge/util/Utils.java new file mode 100644 index 00000000..59307a93 --- /dev/null +++ b/src/main/java/fr/catcore/fabricatedforge/util/Utils.java @@ -0,0 +1,8 @@ +package fr.catcore.fabricatedforge.util; + +import java.util.ArrayList; +import java.util.List; + +public class Utils { + public static final List TRANSFORMER_EXCLUSIONS = new ArrayList<>(); +} diff --git a/src/main/java/net/minecraftforge/common/ForgeChunkManager.java b/src/main/java/net/minecraftforge/common/ForgeChunkManager.java index e64a52bb..11c3b25c 100644 --- a/src/main/java/net/minecraftforge/common/ForgeChunkManager.java +++ b/src/main/java/net/minecraftforge/common/ForgeChunkManager.java @@ -10,7 +10,9 @@ import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.ModContainer; +import fr.catcore.fabricatedforge.mixininterface.IServerChunkProvider; import fr.catcore.fabricatedforge.mixininterface.IServerWorld; +import fr.catcore.fabricatedforge.mixininterface.IThreadedAnvilChunkStorage; import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.nbt.NbtCompound; @@ -54,7 +56,7 @@ static void loadWorld(World world) { if (world instanceof ServerWorld) { dormantChunkCache.put(world, CacheBuilder.newBuilder().maximumSize((long)dormantChunkCacheSize).build()); ServerWorld worldServer = (ServerWorld)world; - File chunkDir = ((IServerWorld)worldServer).getChunkSaveLocation(); + File chunkDir = ((IThreadedAnvilChunkStorage)((IServerChunkProvider)worldServer.chunkCache).getChunkWriter()).getSaveLocation(); File chunkLoaderData = new File(chunkDir, "forcedchunks.dat"); if (chunkLoaderData.exists() && chunkLoaderData.isFile()) { ArrayListMultimap loadedTickets = ArrayListMultimap.create(); @@ -326,7 +328,7 @@ public static ImmutableSetMultimap getPersis static void saveWorld(World world) { if (world instanceof ServerWorld) { ServerWorld worldServer = (ServerWorld)world; - File chunkDir = ((IServerWorld)worldServer).getChunkSaveLocation(); + File chunkDir = ((IThreadedAnvilChunkStorage)((IServerChunkProvider)worldServer.chunkCache).getChunkWriter()).getSaveLocation(); File chunkLoaderData = new File(chunkDir, "forcedchunks.dat"); NbtCompound forcedChunkData = new NbtCompound(); NbtList ticketList = new NbtList(); diff --git a/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java b/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java index b4529b1e..fc898b18 100644 --- a/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java +++ b/src/main/java/net/minecraftforge/common/WorldSpecificSaveHandler.java @@ -4,7 +4,9 @@ */ package net.minecraftforge.common; +import fr.catcore.fabricatedforge.mixininterface.IServerChunkProvider; import fr.catcore.fabricatedforge.mixininterface.IServerWorld; +import fr.catcore.fabricatedforge.mixininterface.IThreadedAnvilChunkStorage; import net.minecraft.nbt.NbtCompound; import net.minecraft.server.world.ServerWorld; import net.minecraft.world.PlayerDataHandler; @@ -24,7 +26,7 @@ public class WorldSpecificSaveHandler implements SaveHandler { public WorldSpecificSaveHandler(ServerWorld world, SaveHandler parent) { this.world = world; this.parent = parent; - this.dataDir = new File(((IServerWorld) world).getChunkSaveLocation(), "data"); + this.dataDir = new File(((IThreadedAnvilChunkStorage)((IServerChunkProvider)world.chunkCache).getChunkWriter()).getSaveLocation(), "data"); this.dataDir.mkdirs(); } diff --git a/src/main/java/net/minecraftforge/transformers/EventTransformer.java b/src/main/java/net/minecraftforge/transformers/EventTransformer.java index 6ffd1e00..01880b2c 100644 --- a/src/main/java/net/minecraftforge/transformers/EventTransformer.java +++ b/src/main/java/net/minecraftforge/transformers/EventTransformer.java @@ -71,7 +71,7 @@ private boolean buildEvents(ClassNode classNode) throws Exception { } if (!hasSetup) { - Type tSuper = Type.getType(classNode.superName); + Type tSuper = Type.getType(parent); classNode.fields.add(new FieldNode(10, "LISTENER_LIST", tList.getDescriptor(), null, null)); MethodNode method = new MethodNode(262144, 1, "", Type.getMethodDescriptor(Type.VOID_TYPE, new Type[0]), null, null); method.instructions.add(new VarInsnNode(25, 0)); diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 4eb5fdc0..10275fed 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -5,7 +5,7 @@ "name": "Fabricated Forge", "description": "A compatibility layer to load Forge mods on FabricLoader.", "authors": [ - "CatCore/arthurbambou" + "CatCore" ], "contributors": [ "MinecraftForge:\n- Eloraam\n- FlowerChild\n- Hawkye\n- MALfunction84\n- Scokeev9\n- SpaceToad\n- LexManos", @@ -16,8 +16,8 @@ ], "contact": { "homepage": "https://modrinth.com/mod/fabricated-forge", - "sources": "https://github.com/arthurbambou/Fabricated-Legacy-Forge", - "issues": "https://github.com/arthurbambou/Fabricated-Legacy-Forge/issues" + "sources": "https://github.com/thecatcore/Fabricated-Legacy-Forge", + "issues": "https://github.com/thecatcore/Fabricated-Legacy-Forge/issues" }, "license": "CC0-1.0", "icon": "assets/fabricated-forge/icon.png", @@ -34,7 +34,7 @@ "depends": { "fabricloader": ">0.14.3", "minecraft": "1.4.3", - "mod-remapping-api": ">=1.7.1" + "mod-remapping-api": ">=1.14.2" }, "custom": { "loom:injected_interfaces": { diff --git a/src/main/resources/fabricated-forge.accesswidener b/src/main/resources/fabricated-forge.accesswidener index 30817e88..416fddec 100644 --- a/src/main/resources/fabricated-forge.accesswidener +++ b/src/main/resources/fabricated-forge.accesswidener @@ -1,4 +1,4 @@ -accessWidener v1 named +accessWidener v2 named ### FML accessible method net/minecraft/block/entity/BlockEntity registerBlockEntity (Ljava/lang/Class;Ljava/lang/String;)V @@ -358,4 +358,23 @@ accessible class net/minecraft/structure/class_8 accessible class net/minecraft/structure/class_7 accessible class net/minecraft/structure/class_31 accessible class net/minecraft/structure/class_25 -accessible class net/minecraft/util/LogFormatter \ No newline at end of file +accessible class net/minecraft/util/LogFormatter + +### NEI Fix +accessible field net/minecraft/client/gui/screen/ingame/HandledScreen field_1346 Lnet/minecraft/client/render/item/ItemRenderer; +accessible field net/minecraft/client/gui/screen/ingame/HandledScreen backgroundWidth I +accessible field net/minecraft/client/gui/screen/ingame/HandledScreen backgroundHeight I +accessible field net/minecraft/client/gui/screen/ingame/HandledScreen x I +accessible field net/minecraft/client/gui/screen/ingame/HandledScreen y I +accessible field net/minecraft/client/gui/screen/Screen field_1229 Lnet/minecraft/client/Minecraft; +accessible method net/minecraft/client/gui/screen/ingame/HandledScreen getSlotAt (II)Lnet/minecraft/inventory/slot/Slot; +accessible field net/minecraft/client/gui/screen/Screen textRenderer Lnet/minecraft/client/font/TextRenderer; +accessible field net/minecraft/client/gui/DrawableHelper zOffset F +accessible method net/minecraft/client/gui/DrawableHelper fillGradient (IIIIII)V +accessible field net/minecraft/world/chunk/ThreadedAnvilChunkStorage saveLocation Ljava/io/File; +accessible field net/minecraft/client/class_469 connection Lnet/minecraft/network/Connection; +accessible field net/minecraft/client/gui/screen/ingame/CreativeInventoryScreen selectedTab I +accessible class net/minecraft/inventory/slot/class_1019 +accessible method net/minecraft/inventory/slot/class_1019 (Lnet/minecraft/screen/PlayerScreenHandler;Lnet/minecraft/inventory/Inventory;IIII)V +accessible field net/minecraft/client/gui/screen/ingame/HandledScreen focusedSlot Lnet/minecraft/inventory/slot/Slot; +accessible method net/minecraft/client/gui/screen/ingame/HandledScreen onMouseClick (Lnet/minecraft/inventory/slot/Slot;III)V \ No newline at end of file diff --git a/src/main/resources/fml_at.cfg b/src/main/resources/fml_at.cfg index ff1c743d..2594aec9 100644 --- a/src/main/resources/fml_at.cfg +++ b/src/main/resources/fml_at.cfg @@ -1 +1,71 @@ -#Main FML Access Transformer configuration file \ No newline at end of file +#Main FML Access Transformer configuration file +# TileEntity addMapping +public amm.a(Ljava/lang/Class;Ljava/lang/String;)V # TileEntity/func_70306_a +# EntityList addMappings +public lf.a(Ljava/lang/Class;Ljava/lang/String;I)V # EntityList/func_75618_a +public lf.a(Ljava/lang/Class;Ljava/lang/String;III)V # EntityList/func_75614_a +public lf.b # EntityList/field_75625_b nameToClassMap +public lf.c # EntityList/field_75626_c classToNameMap +public lf.d # EntityList/field_75623_d idToClassMap +# RenderEngine +public azc.h # RenderEngine/field_78367_h textureList +public azc.k # RenderEngine/field_78366_k texturePack +# RenderManager +public azw.o # RenderManager/field_78729_o renderers +# RenderBlocks - everything +public azd.* +public azd.*() +#RenderPlayer +public-f baq.h # RenderPlayer/field_77110_j armorlist +#RenderBiped +public-f bae.k # RenderBiped/field_82424_k armorlist +#StringTranslate +public be.b # StringTranslate/field_74815_b +public be.d # StringTranslate/field_74813_d +# TileEntityRenderer +public bby.m # TileEntityRenderer/field_76966_m +# CraftingManager - make the add recipe methods public +public vq.a(Ltv;[Ljava/lang/Object;)V # CraftingManager/func_77595_a +public vq.b(Ltv;[Ljava/lang/Object;)V # CraftingManager/func_77596_b +# WeightedRandomItem +public kg.a # WeightedRandomItem/field_76292_a probability +# ItemStack +#public+f tv.c # ItemStack/field_77993_c itemId +# StatBase +public jc.a # StatBase/field_75978_a statName +# NetLoginHandler +public ik.a(Lik;Z)Z # NetLoginHandler/func_72531_a 'complete connection' +public ik.h # NetLoginHandler/field_72543_h userName +# EntityPlayerMP getNextWindowId +public ih.cd()V # EntityPlayerMP/func_71117_bO +public ih.cv # EntityPlayerMP/field_71139_cq +# EntityAITaskEntry +public mo +# EntityAITasks +public mn.a # EntityAITasks/field_75782_a taskList +# BlockChest +public ahy.n(Lxd;III)Z # BlockChest/func_72292_n isOcelotBlockingChest +# EntityLiving +public ln.aS # EntityLiving/field_70736_aM carryoverDamage +public ln.bn # EntityLiving/field_70714_bg tasks +public ln.bG # EntityLiving/field_70703_bu isJumping +# EntityAIOcelotSit +protected na.a(Lxe;III)Z # EntityAIOcelotSit/func_75398_a nearestSittableBlock +protected na.f()Z # EntityAIOcelotSit/func_75399_f isblocksittable +# CallableMinecraftVersion - sanity check the MC version +public b +public b.(La;)V # constructor +# EntityAnimal +public oh.d # EntityAnimal/field_70881_d inLove +# WorldType +public xp.(ILjava/lang/String;)V +public xp.(ILjava/lang/String;I)V +# ComponentVillage +public aeq +# EntityVillager - minmax lists +public qd.a(Lww;ILjava/util/Random;F)V # EntityVillager/func_70948_a addBuy +public qd.b(Lww;ILjava/util/Random;F)V # EntityVillager/func_70949_b addSell +public qd.bP # EntityVillager/field_70958_bB +public qd.bQ # EntityVillager/field_70960_bC +# GuiButtonMerchant +public aum \ No newline at end of file diff --git a/src/main/resources/forge_at.cfg b/src/main/resources/forge_at.cfg index e75f52f8..b9fb01b8 100644 --- a/src/main/resources/forge_at.cfg +++ b/src/main/resources/forge_at.cfg @@ -1 +1,95 @@ -#Main Forge Access Transformer configuration file \ No newline at end of file +#Main Forge Access Transformer configuration file +# RailLogic.getNAdjacentTracks +public akh.a(Lakh;)I # RailLogic/func_73650_a +# Tessellator +public-f azb.a # Tessellator/field_78398_a instance +public azb.u # Tessellator/field_78409_u drawMode +public azb.v # Tessellator/field_78408_v xOffset +public azb.w # Tessellator/field_78407_w yOffset +public azb.x # Tessellator/field_78417_xzOffset +public azb.z # Tessellator/field_78415_z isDrawing +# ItemPickaxe +public uc.(ILtu;)V # constructor +public+f uc.c # ItemPickaxe/field_77867_c blocksEffectiveAgainst +# ItemAxe +public tr.(ILtu;)V # constructor +public+f tr.c # ItemAxe/field_77868_c blocksEffectiveAgainst +# ItemSpade +public un.(ILtu;)V # constructor +public+f un.c # ItemSpade/field_77866_c blocksEffectiveAgainst +# ItemTool +public td.a # ItemTool/field_77864_a efficiencyOnProperMaterial +public td.ck # ItemTool/field_77865_bY damageVsEntity +# EntityEnderman +public pm.d # EntityEnderman/field_70827_d carriableBlocks +# RenderGlobal +public ayy.h # RenderGlobal/field_72769_h theWorld +public ayy.i # RenderGlobal/field_72770_i renderEngine +public ayy.q # RenderGlobal/field_72777_q mc +public ayy.r # RenderGlobal/field_72776_r globalRenderBlocks +public aty.E # RenderGlobal/field_72738_E damagedBlocks +# SoundManager +public bcx.a # SoundManager/field_77381_a sndSystem +public bcx.b # SoundManager/field_77379_b soundPoolSounds +public bcx.c # SoundManager/field_77380_c soundPoolStreaming +public bcx.d # SoundManager/field_77377_d soundPoolMusic +# EntityMinecart +protected ph.* # All private -> protected +public ph.h()Z # EntityMinecart/func_70490_h isMinecartPowered +# Block +public alf.(ILafg;)V #Constructor +public alf.(IILafg;)V #Constructor +public alf.r()Lalf; # Block/func_71912_p setRequiresSelfNotify +public alf.a(Lalj;)Lalf; # Block/func_71884_a setStepSound +public alf.b(F)Lalf; # Block/func_71894_b setResistance +public alf.c(F)Lalf; # Block/func_71848_c setHardness +public alf.h(I)Lalf; # Block/func_71868_h setLightOpacity +public alf.a(F)Lalf; # Block/func_71900_a setLightValue +public alf.s()Lalf; # Block/func_71875_q setBlockUnbreakable +public alf.b(Z)Lalf; # Block/func_71907_b setTickRandomly +public alf.a(FFFFFF)V #Block/func_71905_a setBlockBounds +# NetServerHandler +public im.g # NetServerHandler/field_72572_g playerInAirTime +# TileEntity +public amm.k # TileEntity/field_70331_k worldObj +# BlockLeavesBase +public aln.c # BlockLeavesBase/field_72131_c graphicsLevel +# Item +public tt.e(I)Ltt; # Item/func_77656_e setMaxDamage +public-f tt.f(Ltv;)I # Item/func_77650_f getIconIndex +# RailLogic +public akh +public akh.a(Lakh;)I # RailLogic/func_73650_a getNAdjacentTiles +# EntityPlayer +public qg.a(Lpg;)V # EntityPlayer/func_71012_a joinEntityItemWithWorld +public qg.i()V # EntityPlayer/func_71053_j closeScreen +# EntityPlayerMP +public axc.a(Lpg;)V # EntityClientPlayerMP/func_71012_a joinEntityItemWithWorld +# World Gen Chests Related +public ie.S # WorldServer/field_73069_S bonusChestContent +public abq.a # StructureMineshaftPieces/field_78818_a mineshaftChestContents +public acu.i # ComponentScatteredFeatureDesertPyramid/field_74941_i itemsToGenerateInTemple +public acv.l # ComponentScatteredFeatureJunglePyramid/field_74943_l junglePyramidsChestContents +public acv.m # ComponentScatteredFeatureJunglePyramid/field_74944_m junglePyramidsDispenserContents +public adf.a # ComponentStrongholdChestCorridor/field_75003_a strongholdChestContents +public adj.b # ComponentStrongholdLibrary/field_75007_b strongholdLibraryChestContents +public ado.c # ComponentStrongholdRoomCrossing/field_75014_c strongholdCorridorChestContents +public aem.a # ComponentVillageHouse2/field_74918_a villageBlacksmithChestContents +# AnvilChunkLoader.chunkSaveLocation +default zn.d # AnvilChunkLoader/field_75825_d +# ChunkProviderServer.currentChunkLoader +default id.e # ChunkProviderServer/field_73247_e +# PlayerManager +default ib.a(IIZ)Lic; # PlayerManager/func_72690_a getOrCreateChunkWatcher +# World +public-f xe.C # World/field_72982_D villageCollectionObj +public xe.H # World/field_72993_I activeChunkSet +# EntityLiving +public ln.bc # EntityLiving/field_70728_aV experienceValue +# GuiFlatPresets +public asr.a(Ljava/lang/String;ILxz;Ljava/util/List;[Labm;)V # GuiFlatPresets/func_82294_a +public asr.a(Ljava/lang/String;ILxz;[Labm;)V # GuiFlatPresets/func_82297_a +# BiomeGenBase +public xz.*() # Everything protected->public +# MapGenVillage +public-f aea.e # MapGenVillage/field_75055_e villageSpawnBiomes \ No newline at end of file