From 9d0ee2e0e7b44e9eace911261b2064654bf1822a Mon Sep 17 00:00:00 2001 From: Chocohead Date: Thu, 11 Jan 2024 23:47:11 +0000 Subject: [PATCH] Fix connected textures for 1.19.3+ Turns out part of the old mixin was useful after all Closes #1224 Fixes #1218 Fixes #1164 Fixes #1149 Fixes #1107 Fixes #1089 Fixes #1036 Fixes #1011 Fixes #980 --- gradle.properties | 2 +- .../mixin/DefaultResourcePackMixin.java | 21 +++++++++++++++++++ .../optifabric/mod/OptifabricSetup.java | 2 ++ .../optifabric.optifine.new-mixins.json | 7 +++++++ 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 src/main/java/me/modmuss50/optifabric/mixin/DefaultResourcePackMixin.java create mode 100644 src/main/resources/optifabric.optifine.new-mixins.json diff --git a/gradle.properties b/gradle.properties index c067fb16..f18b6c66 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,6 +9,6 @@ fabric_version=0.42.0+1.16 tiny_remapper_version=0.8.11 fabric_asm_version=v2.3 -mod_version = 1.14.1 +mod_version = 1.14.2 maven_group = me.modmuss50 archives_base_name = optifabric diff --git a/src/main/java/me/modmuss50/optifabric/mixin/DefaultResourcePackMixin.java b/src/main/java/me/modmuss50/optifabric/mixin/DefaultResourcePackMixin.java new file mode 100644 index 00000000..a9422646 --- /dev/null +++ b/src/main/java/me/modmuss50/optifabric/mixin/DefaultResourcePackMixin.java @@ -0,0 +1,21 @@ +package me.modmuss50.optifabric.mixin; + +import java.io.IOException; +import java.io.InputStream; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +import net.minecraft.resource.DefaultResourcePack; + +import me.modmuss50.optifabric.mod.OptifineResources; + +@Mixin(value = DefaultResourcePack.class, priority = 400) +abstract class DefaultResourcePackMixin { + @Redirect(method = "getResourceOF", remap = false, + at = @At(value = "INVOKE", target = "Lnet/optifine/reflect/ReflectorForge;getOptiFineResourceStream(Ljava/lang/String;)Ljava/io/InputStream;")) + private InputStream onFindInputStream(String path) throws IOException { + return OptifineResources.INSTANCE.getResource(path); + } +} \ No newline at end of file diff --git a/src/main/java/me/modmuss50/optifabric/mod/OptifabricSetup.java b/src/main/java/me/modmuss50/optifabric/mod/OptifabricSetup.java index 32886dcb..0235ce68 100644 --- a/src/main/java/me/modmuss50/optifabric/mod/OptifabricSetup.java +++ b/src/main/java/me/modmuss50/optifabric/mod/OptifabricSetup.java @@ -241,6 +241,8 @@ protected boolean isPresent() { Mixins.addConfiguration("optifabric.optifine.mixins.json"); if (OptifabricSetup.isPresent("minecraft", "<=1.19.2")) { Mixins.addConfiguration("optifabric.optifine.old-mixins.json"); + } else { + Mixins.addConfiguration("optifabric.optifine.new-mixins.json"); } if (isPresent("fabricloader", ">=0.13.0") && (isPresent("cloth-client-events-v0", ">=3.1.58") || isPresent("cloth-client-events-v0", ">=2.1.60 <3.0") || isPresent("cloth-client-events-v0", ">=1.6.59 <2.0"))) { diff --git a/src/main/resources/optifabric.optifine.new-mixins.json b/src/main/resources/optifabric.optifine.new-mixins.json new file mode 100644 index 00000000..93953d86 --- /dev/null +++ b/src/main/resources/optifabric.optifine.new-mixins.json @@ -0,0 +1,7 @@ +{ + "parent": "optifabric.optifine.mixins.json", + "package": "me.modmuss50.optifabric.mixin", + "mixins": [ + "DefaultResourcePackMixin" + ] +}