mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-11-10 20:45:59 +01:00
Fix BeginFrameEvent not firing with sodium installed
- Rendering is still broken, that fix must come from within sodium
This commit is contained in:
parent
0eafe8f453
commit
a6377b5fe8
@ -0,0 +1,60 @@
|
|||||||
|
package com.jozufozu.flywheel.mixin;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Group;
|
||||||
|
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.event.BeginFrameEvent;
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||||
|
import net.minecraft.client.renderer.GameRenderer;
|
||||||
|
import net.minecraft.client.renderer.LightTexture;
|
||||||
|
import net.minecraft.client.renderer.WorldRenderer;
|
||||||
|
import net.minecraft.client.renderer.culling.ClippingHelper;
|
||||||
|
import net.minecraft.client.world.ClientWorld;
|
||||||
|
import net.minecraft.profiler.IProfiler;
|
||||||
|
import net.minecraft.util.math.vector.Matrix4f;
|
||||||
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
|
||||||
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
@Mixin(WorldRenderer.class)
|
||||||
|
public class BeginFrameMixin {
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
private ClientWorld level;
|
||||||
|
|
||||||
|
@Unique
|
||||||
|
private boolean setup;
|
||||||
|
|
||||||
|
@Group(name = "setupRender", min = 1)
|
||||||
|
@Inject(method = "renderLevel",
|
||||||
|
at = @At(value = "INVOKE", target = "net.minecraft.client.renderer.WorldRenderer.compileChunksUntil(J)V"),
|
||||||
|
locals = LocalCapture.CAPTURE_FAILSOFT)
|
||||||
|
private void setupRender(MatrixStack stack, float p_228426_2_, long p_228426_3_, boolean p_228426_5_,
|
||||||
|
ActiveRenderInfo info, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projection,
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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) {
|
||||||
|
if (!setup) {
|
||||||
|
MinecraftForge.EVENT_BUS.post(new BeginFrameEvent(level, info, clippingHelper));
|
||||||
|
}
|
||||||
|
setup = false;
|
||||||
|
}
|
||||||
|
}
|
@ -4,9 +4,12 @@ import org.lwjgl.opengl.GL20;
|
|||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Group;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
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 com.jozufozu.flywheel.backend.Backend;
|
import com.jozufozu.flywheel.backend.Backend;
|
||||||
import com.jozufozu.flywheel.backend.OptifineHandler;
|
import com.jozufozu.flywheel.backend.OptifineHandler;
|
||||||
@ -26,6 +29,7 @@ import net.minecraft.client.renderer.RenderTypeBuffers;
|
|||||||
import net.minecraft.client.renderer.WorldRenderer;
|
import net.minecraft.client.renderer.WorldRenderer;
|
||||||
import net.minecraft.client.renderer.culling.ClippingHelper;
|
import net.minecraft.client.renderer.culling.ClippingHelper;
|
||||||
import net.minecraft.client.world.ClientWorld;
|
import net.minecraft.client.world.ClientWorld;
|
||||||
|
import net.minecraft.profiler.IProfiler;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.vector.Matrix4f;
|
import net.minecraft.util.math.vector.Matrix4f;
|
||||||
import net.minecraft.util.math.vector.Vector3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
@ -44,11 +48,6 @@ public class RenderHooksMixin {
|
|||||||
@Final
|
@Final
|
||||||
private RenderTypeBuffers renderBuffers;
|
private RenderTypeBuffers renderBuffers;
|
||||||
|
|
||||||
@Inject(at = @At("HEAD"), method = "setupRender")
|
|
||||||
private void setupRender(ActiveRenderInfo info, ClippingHelper clippingHelper, boolean p_228437_3_, int frameCount, boolean isSpectator, CallbackInfo ci) {
|
|
||||||
MinecraftForge.EVENT_BUS.post(new BeginFrameEvent(level, info, clippingHelper));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JUSTIFICATION: This method is called once per layer per frame. It allows us to perform
|
* JUSTIFICATION: This method is called once per layer per frame. It allows us to perform
|
||||||
* layer-correct custom rendering. RenderWorldLast is not refined enough for rendering world objects.
|
* layer-correct custom rendering. RenderWorldLast is not refined enough for rendering world objects.
|
||||||
|
@ -4,22 +4,7 @@
|
|||||||
"package": "com.jozufozu.flywheel.mixin",
|
"package": "com.jozufozu.flywheel.mixin",
|
||||||
"compatibilityLevel": "JAVA_8",
|
"compatibilityLevel": "JAVA_8",
|
||||||
"refmap": "flywheel.refmap.json",
|
"refmap": "flywheel.refmap.json",
|
||||||
"client": [
|
"client": ["BeginFrameMixin", "CancelEntityRenderMixin", "CancelTileEntityRenderMixin", "FastChunkProviderMixin", "FixFabulousDepthMixin", "FogColorTrackerMixin", "RenderHooksMixin", "ShaderCloseMixin", "StoreProjectionMatrixMixin", "TileRemoveMixin", "TileWorldHookMixin", "atlas.AtlasDataMixin", "atlas.SheetDataAccessor", "light.LightUpdateMixin", "light.NetworkLightUpdateMixin"],
|
||||||
"CancelEntityRenderMixin",
|
|
||||||
"CancelTileEntityRenderMixin",
|
|
||||||
"FixFabulousDepthMixin",
|
|
||||||
"FogColorTrackerMixin",
|
|
||||||
"RenderHooksMixin",
|
|
||||||
"ShaderCloseMixin",
|
|
||||||
"StoreProjectionMatrixMixin",
|
|
||||||
"TileRemoveMixin",
|
|
||||||
"TileWorldHookMixin",
|
|
||||||
"atlas.AtlasDataMixin",
|
|
||||||
"atlas.SheetDataAccessor",
|
|
||||||
"light.LightUpdateMixin",
|
|
||||||
"light.NetworkLightUpdateMixin",
|
|
||||||
"FastChunkProviderMixin"
|
|
||||||
],
|
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 0
|
"defaultRequire": 0
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user