diff --git a/changelog.txt b/changelog.txt index 40f8f2581..aded75a21 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +0.2.3: +Technical/API: + - Alter BeginFrameEvent to enable compatibility with optifine shadows + 0.2.2: Fixes - Fix ConcurrentModificationException crash diff --git a/gradle.properties b/gradle.properties index 14e6e72ae..86775ac82 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false # mod version info -mod_version=0.2.2 +mod_version=0.2.3 mc_update_version=1.16 minecraft_version=1.16.5 forge_version=36.1.66 diff --git a/src/main/java/com/jozufozu/flywheel/core/Clipping.java b/src/main/java/com/jozufozu/flywheel/core/Clipping.java deleted file mode 100644 index 9f28ef46e..000000000 --- a/src/main/java/com/jozufozu/flywheel/core/Clipping.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.jozufozu.flywheel.core; - -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import net.minecraft.client.renderer.culling.ClippingHelper; - -/** - * Used to capture the ClippingHelper from WorldRenderer#renderLevel - */ -public class Clipping { - - /** - * Assigned in {@link com.jozufozu.flywheel.mixin.GlobalClippingHelperMixin this} mixin. - */ - public static ClippingHelper HELPER; -} diff --git a/src/main/java/com/jozufozu/flywheel/event/BeginFrameEvent.java b/src/main/java/com/jozufozu/flywheel/event/BeginFrameEvent.java index a4c508328..5c7006535 100644 --- a/src/main/java/com/jozufozu/flywheel/event/BeginFrameEvent.java +++ b/src/main/java/com/jozufozu/flywheel/event/BeginFrameEvent.java @@ -7,22 +7,17 @@ import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.culling.ClippingHelper; import net.minecraft.client.world.ClientWorld; +import net.minecraft.util.math.vector.Vector3d; import net.minecraftforge.eventbus.api.Event; public class BeginFrameEvent extends Event { private final ClientWorld world; - private final MatrixStack stack; private final ActiveRenderInfo info; - private final GameRenderer gameRenderer; - private final LightTexture lightTexture; private final ClippingHelper clippingHelper; - public BeginFrameEvent(ClientWorld world, MatrixStack stack, ActiveRenderInfo info, GameRenderer gameRenderer, LightTexture lightTexture, ClippingHelper clippingHelper) { + public BeginFrameEvent(ClientWorld world, ActiveRenderInfo info, ClippingHelper clippingHelper) { this.world = world; - this.stack = stack; this.info = info; - this.gameRenderer = gameRenderer; - this.lightTexture = lightTexture; this.clippingHelper = clippingHelper; } @@ -30,23 +25,15 @@ public class BeginFrameEvent extends Event { return world; } - public MatrixStack getStack() { - return stack; - } - public ActiveRenderInfo getInfo() { return info; } - public GameRenderer getGameRenderer() { - return gameRenderer; - } - - public LightTexture getLightTexture() { - return lightTexture; - } - public ClippingHelper getClippingHelper() { return clippingHelper; } + + public Vector3d getCameraPos() { + return info.getPosition(); + } } diff --git a/src/main/java/com/jozufozu/flywheel/mixin/GlobalClippingHelperMixin.java b/src/main/java/com/jozufozu/flywheel/mixin/GlobalClippingHelperMixin.java deleted file mode 100644 index 39958bbc0..000000000 --- a/src/main/java/com/jozufozu/flywheel/mixin/GlobalClippingHelperMixin.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.jozufozu.flywheel.mixin; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import com.jozufozu.flywheel.core.Clipping; - -import net.minecraft.client.renderer.culling.ClippingHelper; -import net.minecraft.util.math.vector.Matrix4f; - -@Mixin(ClippingHelper.class) -public class GlobalClippingHelperMixin { - - @Inject(at = @At("TAIL"), method = "") - private void init(Matrix4f p_i226026_1_, Matrix4f p_i226026_2_, CallbackInfo ci) { - Clipping.HELPER = (ClippingHelper) (Object) this; - } -} diff --git a/src/main/java/com/jozufozu/flywheel/mixin/RenderHooksMixin.java b/src/main/java/com/jozufozu/flywheel/mixin/RenderHooksMixin.java index 80abdb73e..be51b342c 100644 --- a/src/main/java/com/jozufozu/flywheel/mixin/RenderHooksMixin.java +++ b/src/main/java/com/jozufozu/flywheel/mixin/RenderHooksMixin.java @@ -11,7 +11,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.backend.OptifineHandler; import com.jozufozu.flywheel.backend.instancing.InstancedRenderDispatcher; -import com.jozufozu.flywheel.core.Clipping; import com.jozufozu.flywheel.core.crumbling.CrumblingRenderer; import com.jozufozu.flywheel.event.BeginFrameEvent; import com.jozufozu.flywheel.event.ReloadRenderersEvent; @@ -25,6 +24,7 @@ import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderTypeBuffers; import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.culling.ClippingHelper; import net.minecraft.client.world.ClientWorld; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.vector.Matrix4f; @@ -44,9 +44,9 @@ public class RenderHooksMixin { @Final private RenderTypeBuffers renderBuffers; - @Inject(at = @At(value = "INVOKE", target = "net.minecraft.client.renderer.WorldRenderer.compileChunksUntil(J)V"), method = "renderLevel") - private void setupFrame(MatrixStack stack, float p_228426_2_, long p_228426_3_, boolean p_228426_5_, ActiveRenderInfo info, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projection, CallbackInfo ci) { - MinecraftForge.EVENT_BUS.post(new BeginFrameEvent(level, stack, info, gameRenderer, lightTexture, Clipping.HELPER)); + @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)); } /** diff --git a/src/main/resources/flywheel.mixins.json b/src/main/resources/flywheel.mixins.json index 1959046f5..2c4db2153 100644 --- a/src/main/resources/flywheel.mixins.json +++ b/src/main/resources/flywheel.mixins.json @@ -18,8 +18,7 @@ "atlas.SheetDataAccessor", "light.LightUpdateMixin", "light.NetworkLightUpdateMixin", - "FastChunkProviderMixin", - "GlobalClippingHelperMixin" + "FastChunkProviderMixin" ], "injectors": { "defaultRequire": 0