diff --git a/build.gradle b/build.gradle index 20849c29..b7a23a85 100644 --- a/build.gradle +++ b/build.gradle @@ -25,6 +25,7 @@ dependencies { include(implementation("com.github.LlamaLad7:MixinExtras:0.1.1")) annotationProcessor "com.github.LlamaLad7:MixinExtras:0.1.1" + include(implementation("net.lenni0451:Reflect:1.1.0")) } loom { diff --git a/gradle.properties b/gradle.properties index 15ee5048..3aafc560 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,9 +6,9 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties | check these on https://fabricmc.net/versions.html minecraft_version=1.19.3 yarn_mappings=1.19.3+build.5 -loader_version=0.14.12 +loader_version=0.14.15 # Mod Properties -mod_version = 1.1.9 +mod_version = 1.1.10 maven_group = net.raphimc archives_base_name = ImmediatelyFast diff --git a/src/main/java/net/raphimc/immediatelyfast/compat/IrisCompat.java b/src/main/java/net/raphimc/immediatelyfast/compat/IrisCompat.java index 45095385..a91ea90f 100644 --- a/src/main/java/net/raphimc/immediatelyfast/compat/IrisCompat.java +++ b/src/main/java/net/raphimc/immediatelyfast/compat/IrisCompat.java @@ -18,6 +18,7 @@ package net.raphimc.immediatelyfast.compat; import it.unimi.dsi.fastutil.booleans.BooleanConsumer; +import net.lenni0451.reflect.accessor.FieldAccessor; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.VertexFormat; import net.raphimc.immediatelyfast.ImmediatelyFast; @@ -40,23 +41,8 @@ public static void init() { final Class immediateStateClass = Class.forName("net.coderbot.iris.vertices.ImmediateState"); final Class extendingBufferBuilderClass = Class.forName("net.coderbot.iris.vertices.ExtendingBufferBuilder"); - final MethodHandle isRenderingLevelMH = lookup.findStaticGetter(immediateStateClass, "isRenderingLevel", boolean.class); - isRenderingLevel = () -> { - try { - return (boolean) isRenderingLevelMH.invokeExact(); - } catch (Throwable e) { - throw new RuntimeException(e); - } - }; - - final MethodHandle renderWithExtendedVertexFormatMH = lookup.findStaticSetter(immediateStateClass, "renderWithExtendedVertexFormat", boolean.class); - renderWithExtendedVertexFormat = (value) -> { - try { - renderWithExtendedVertexFormatMH.invokeExact(value); - } catch (Throwable e) { - throw new RuntimeException(e); - } - }; + isRenderingLevel = FieldAccessor.makeGetter(BooleanSupplier.class, null, immediateStateClass.getDeclaredField("isRenderingLevel")); + renderWithExtendedVertexFormat = FieldAccessor.makeSetter(BooleanConsumer.class, null, immediateStateClass.getDeclaredField("renderWithExtendedVertexFormat")); final MethodHandle iris$beginWithoutExtendingMH = lookup.findVirtual(extendingBufferBuilderClass, "iris$beginWithoutExtending", MethodType.methodType(void.class, VertexFormat.DrawMode.class, VertexFormat.class)); final CallSite iris$beginWithoutExtendingCallSite = LambdaMetafactory.metafactory(lookup, "accept", MethodType.methodType(TriConsumer.class), MethodType.methodType(void.class, Object.class, Object.class, Object.class), iris$beginWithoutExtendingMH, iris$beginWithoutExtendingMH.type());