mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-12-29 08:26:37 +01:00
Fix compat with optifine shaders, again
This commit is contained in:
parent
a6377b5fe8
commit
3ef6a163f0
1 changed files with 13 additions and 3 deletions
|
@ -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.CallbackInfo;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||||
|
|
||||||
|
import com.jozufozu.flywheel.backend.OptifineHandler;
|
||||||
import com.jozufozu.flywheel.event.BeginFrameEvent;
|
import com.jozufozu.flywheel.event.BeginFrameEvent;
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
|
|
||||||
|
@ -35,6 +36,9 @@ public class BeginFrameMixin {
|
||||||
@Unique
|
@Unique
|
||||||
private boolean setup;
|
private boolean setup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This version gets run by default.
|
||||||
|
*/
|
||||||
@Group(name = "setupRender", min = 1)
|
@Group(name = "setupRender", min = 1)
|
||||||
@Inject(method = "renderLevel",
|
@Inject(method = "renderLevel",
|
||||||
at = @At(value = "INVOKE", target = "net.minecraft.client.renderer.WorldRenderer.compileChunksUntil(J)V"),
|
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
|
CallbackInfo ci, // locals, only care about clippinghelper
|
||||||
IProfiler iprofiler, Vector3d vector3d, double d0, double d1, double d2, Matrix4f matrix4f, boolean flag,
|
IProfiler iprofiler, Vector3d vector3d, double d0, double d1, double d2, Matrix4f matrix4f, boolean flag,
|
||||||
ClippingHelper clippinghelper) {
|
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")
|
@Group(name = "setupRender")
|
||||||
@Inject(at = @At("HEAD"), method = "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) {
|
if (!setup) {
|
||||||
MinecraftForge.EVENT_BUS.post(new BeginFrameEvent(level, info, clippingHelper));
|
MinecraftForge.EVENT_BUS.post(new BeginFrameEvent(level, info, clippingHelper));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue