diff --git a/src/main/java/com/jozufozu/flywheel/mixin/BeginFrameMixin.java b/src/main/java/com/jozufozu/flywheel/mixin/BeginFrameMixin.java index e7d6f89d6..b9a7bb5cb 100644 --- a/src/main/java/com/jozufozu/flywheel/mixin/BeginFrameMixin.java +++ b/src/main/java/com/jozufozu/flywheel/mixin/BeginFrameMixin.java @@ -9,6 +9,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; +import com.jozufozu.flywheel.backend.OptifineHandler; import com.jozufozu.flywheel.event.BeginFrameEvent; import com.mojang.blaze3d.matrix.MatrixStack; @@ -35,6 +36,9 @@ public class BeginFrameMixin { @Unique private boolean setup; + /** + * This version gets run by default. + */ @Group(name = "setupRender", min = 1) @Inject(method = "renderLevel", at = @At(value = "INVOKE", target = "net.minecraft.client.renderer.WorldRenderer.compileChunksUntil(J)V"), @@ -44,14 +48,20 @@ public class BeginFrameMixin { CallbackInfo ci, // locals, only care about clippinghelper IProfiler iprofiler, Vector3d vector3d, double d0, double d1, double d2, Matrix4f matrix4f, boolean flag, ClippingHelper clippinghelper) { - MinecraftForge.EVENT_BUS.post(new BeginFrameEvent(level, info, clippinghelper)); - setup = true; + if (!OptifineHandler.usingShaders()) { + MinecraftForge.EVENT_BUS.post(new BeginFrameEvent(level, info, clippinghelper)); + + setup = true; + } } + /** + * This version gets run when optifine is installed and shaders are enabled. + */ @Group(name = "setupRender") @Inject(at = @At("HEAD"), method = "setupRender") - private void setupRenderOptifineCompat(ActiveRenderInfo info, ClippingHelper clippingHelper, boolean p_228437_3_, int frameCount, boolean isSpectator, CallbackInfo ci) { + private void setupRender2(ActiveRenderInfo info, ClippingHelper clippingHelper, boolean p_228437_3_, int frameCount, boolean isSpectator, CallbackInfo ci) { if (!setup) { MinecraftForge.EVENT_BUS.post(new BeginFrameEvent(level, info, clippingHelper)); }