From dfd29ba5e0f81854e9b9e9610fc26c0a480259c7 Mon Sep 17 00:00:00 2001 From: tildejustin Date: Sun, 17 Dec 2023 12:34:23 -0500 Subject: [PATCH] fix access issues and copy redlime's accesswidener --- build.gradle | 8 -------- gradle.properties | 2 +- gradle/libs.versions.toml | 2 -- .../optifabric/mod/OptifineInjector.java | 19 +++++++++---------- src/main/resources/optifabric.accesswidener | 2 ++ 5 files changed, 12 insertions(+), 21 deletions(-) diff --git a/build.gradle b/build.gradle index e8722c37..ca0c5b1f 100644 --- a/build.gradle +++ b/build.gradle @@ -12,17 +12,10 @@ base { } repositories { - maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots" } maven { url "https://jitpack.io" } } loom { - decompilers { - vineflower { - options.put("mark-corresponding-synthetics", "1") - options.put("ind", " ") - } - } accessWidenerPath = file("src/main/resources/optifabric.accesswidener") } @@ -30,7 +23,6 @@ dependencies { minecraft libs.minecraft mappings legacy.yarn(libs.versions.minecraft.get(), libs.versions.yarn.build.get()) modImplementation libs.fabric.loader - vineflowerDecompilerClasspath libs.vineflower include(modImplementation libs.fabric.asm.get()) include(implementation libs.zt.zip.get()) include(runtimeOnly libs.slf4j.api.get()) diff --git a/gradle.properties b/gradle.properties index 272742ce..6c453e8f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ org.gradle.jvmargs=-Xmx2G org.gradle.parallel=true -mod_version=2.2.0 +mod_version=2.2.1 target_version=1.6-1.7.10 archives_name=optifabric maven_group=me.modmuss50 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9ba15fd8..5207e3ac 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,7 +3,6 @@ minecraft = "1.7.10" yarn_build = "533" fabric-loader = "0.15.2" loom = "1.4-SNAPSHOT" -vineflower = "1.10.0-SNAPSHOT" fabric-asm = "v2.3.3" zt-zip = "1.16" slf4j-api = "2.0.9" @@ -11,7 +10,6 @@ slf4j-api = "2.0.9" [libraries] minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" } fabric-loader = { module = "net.fabricmc:fabric-loader", version.ref = "fabric-loader" } -vineflower = { module = "org.vineflower:vineflower", version.ref = "vineflower" } fabric-asm = { module = "com.github.Minecraft-Java-Edition-Speedrunning:fabric-asm", version.ref = "fabric-asm" } zt-zip = { module = "org.zeroturnaround:zt-zip", version.ref = "zt-zip" } slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j-api" } diff --git a/src/main/java/me/modmuss50/optifabric/mod/OptifineInjector.java b/src/main/java/me/modmuss50/optifabric/mod/OptifineInjector.java index b56f83d5..c8e5a6d0 100644 --- a/src/main/java/me/modmuss50/optifabric/mod/OptifineInjector.java +++ b/src/main/java/me/modmuss50/optifabric/mod/OptifineInjector.java @@ -1,19 +1,19 @@ package me.modmuss50.optifabric.mod; -import com.chocohead.mm.api.ClassTinkerers; +import com.chocohead.mm.api.*; import me.modmuss50.optifabric.patcher.*; -import org.objectweb.asm.Opcodes; +import net.fabricmc.loader.api.*; +import org.objectweb.asm.*; import org.objectweb.asm.tree.*; import java.util.*; -import java.util.function.Consumer; +import java.util.function.*; public class OptifineInjector { private static final List patched = new ArrayList<>(); ClassCache classCache; // i have no idea why and how this works, if you know better please let me know - @SuppressWarnings("CommentedOutCode") public final Consumer transformer = target -> { if (patched.contains(target.name)) { System.out.println("Already patched" + target.name); @@ -42,12 +42,11 @@ public class OptifineInjector { } // let's make every class we touch public - // is this necessary? I don't think so - // if (!FabricLoader.getInstance().isDevelopmentEnvironment()) { - // target.access = modAccess(target.access); - // target.methods.forEach(methodNode -> methodNode.access = modAccess(methodNode.access)); - // target.fields.forEach(fieldNode -> fieldNode.access = modAccess(fieldNode.access)); - // } + if (!FabricLoader.getInstance().isDevelopmentEnvironment()) { + target.access = modAccess(target.access); + target.methods.forEach(methodNode -> methodNode.access = modAccess(methodNode.access)); + target.fields.forEach(fieldNode -> fieldNode.access = modAccess(fieldNode.access)); + } }; public OptifineInjector(ClassCache classCache) { diff --git a/src/main/resources/optifabric.accesswidener b/src/main/resources/optifabric.accesswidener index 81f4265f..ce87f2d2 100644 --- a/src/main/resources/optifabric.accesswidener +++ b/src/main/resources/optifabric.accesswidener @@ -3,3 +3,5 @@ accessible field net/minecraft/client/gui/widget/ButtonWidget width I accessible field net/minecraft/client/gui/widget/ButtonWidget height I accessible method net/minecraft/util/Language getInstance ()Lnet/minecraft/util/Language; accessible method net/minecraft/block/Block setOpacity (I)Lnet/minecraft/block/Block; +accessible field net/minecraft/entity/LivingEntity despawnCounter I +accessible field net/minecraft/resource/AbstractFileResourcePack base Ljava/io/File;