diff --git a/build.gradle b/build.gradle index 2b27d1da..e6a78481 100644 --- a/build.gradle +++ b/build.gradle @@ -15,6 +15,10 @@ repositories { maven { url "https://jitpack.io" } } +loom { + accessWidenerPath = file("src/main/resources/optifabric.accesswidener") +} + dependencies { minecraft libs.minecraft mappings variantOf(libs.feather.mappings) { classifier "v2" } diff --git a/gradle.properties b/gradle.properties index 607ce1d0..6ac21721 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-ornithe archives_name=optifabric maven_group=me.modmuss50 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 b1db1043..91456217 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/locale/Language getInstance ()Lnet/minecraft/locale/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;