diff --git a/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizedRenderDispatcher.java b/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizedRenderDispatcher.java index 781425a14..262c996e1 100644 --- a/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizedRenderDispatcher.java +++ b/src/main/java/com/jozufozu/flywheel/impl/visualization/VisualizedRenderDispatcher.java @@ -166,7 +166,7 @@ public class VisualizedRenderDispatcher { public static boolean tryAddBlockEntity(T blockEntity) { Level level = blockEntity.getLevel(); - if (FlwUtil.canUseVisualization(level)) { + if (!FlwUtil.canUseVisualization(level)) { return false; } diff --git a/src/main/java/com/jozufozu/flywheel/lib/instance/TransformedInstance.java b/src/main/java/com/jozufozu/flywheel/lib/instance/TransformedInstance.java index 8e14bc299..936f6b71f 100644 --- a/src/main/java/com/jozufozu/flywheel/lib/instance/TransformedInstance.java +++ b/src/main/java/com/jozufozu/flywheel/lib/instance/TransformedInstance.java @@ -64,24 +64,24 @@ public class TransformedInstance extends ColoredLitInstance implements Transform } @Override - public TransformedInstance scale(float pX, float pY, float pZ) { + public TransformedInstance scale(float x, float y, float z) { setChanged(); - model.multiply(Matrix4f.createScaleMatrix(pX, pY, pZ)); - if (pX == pY && pY == pZ) { - if (pX > 0.0F) { - return this; + model.multiply(Matrix4f.createScaleMatrix(x, y, z)); + + if (x == y && y == z) { + if (x < 0.0f) { + normal.mul(-1.0f); } - normal.mul(-1.0F); return this; } - float f = 1.0F / pX; - float f1 = 1.0F / pY; - float f2 = 1.0F / pZ; - float f3 = Mth.fastInvCubeRoot(Math.abs(f * f1 * f2)); - normal.mul(Matrix3f.createScaleMatrix(f3 * f, f3 * f1, f3 * f2)); + float invX = 1.0f / x; + float invY = 1.0f / y; + float invZ = 1.0f / z; + float f = Mth.fastInvCubeRoot(Math.abs(invX * invY * invZ)); + normal.mul(Matrix3f.createScaleMatrix(f * invX, f * invY, f * invZ)); return this; } diff --git a/src/main/java/com/jozufozu/flywheel/lib/util/AnimationTickHolder.java b/src/main/java/com/jozufozu/flywheel/lib/util/AnimationTickHolder.java index 3c2fbaff6..f0c9bd10e 100644 --- a/src/main/java/com/jozufozu/flywheel/lib/util/AnimationTickHolder.java +++ b/src/main/java/com/jozufozu/flywheel/lib/util/AnimationTickHolder.java @@ -36,7 +36,7 @@ public final class AnimationTickHolder { public static float getPartialTicks() { Minecraft mc = Minecraft.getInstance(); - return (mc.isPaused() ? ((PausedPartialTickAccessor) mc).flywheel$getPartialTicksPaused() : mc.getFrameTime()); + return (mc.isPaused() ? ((PausedPartialTickAccessor) mc).flywheel$getPausePartialTick() : mc.getFrameTime()); } // Unused but might be useful for debugging. diff --git a/src/main/java/com/jozufozu/flywheel/mixin/BufferBuilderMixin.java b/src/main/java/com/jozufozu/flywheel/mixin/BufferBuilderMixin.java index 114d54d9c..e91321ca5 100644 --- a/src/main/java/com/jozufozu/flywheel/mixin/BufferBuilderMixin.java +++ b/src/main/java/com/jozufozu/flywheel/mixin/BufferBuilderMixin.java @@ -46,22 +46,22 @@ public abstract class BufferBuilderMixin implements BufferBuilderExtension { @Override public void flywheel$freeBuffer() { - if (this.buffer != null) { - MemoryUtil.memFree(this.buffer); - this.buffer = null; + if (buffer != null) { + MemoryUtil.memFree(buffer); + buffer = null; } } @Override public void flywheel$injectForRender(@NotNull ByteBuffer buffer, @NotNull VertexFormat format, int vertexCount) { - this.building = true; - this.mode = VertexFormat.Mode.QUADS; + building = true; + mode = VertexFormat.Mode.QUADS; this.buffer = buffer; this.format = format; - this.vertices = vertexCount; + vertices = vertexCount; - this.currentElement = this.format.getElements().get(0); - this.elementIndex = 0; + currentElement = format.getElements().get(0); + elementIndex = 0; } } diff --git a/src/main/java/com/jozufozu/flywheel/mixin/ClientLevelMixin.java b/src/main/java/com/jozufozu/flywheel/mixin/ClientLevelMixin.java index e4d65813c..b947f1187 100644 --- a/src/main/java/com/jozufozu/flywheel/mixin/ClientLevelMixin.java +++ b/src/main/java/com/jozufozu/flywheel/mixin/ClientLevelMixin.java @@ -27,15 +27,17 @@ public abstract class ClientLevelMixin implements ClientLevelExtension { return getEntities().getAll(); } - @Inject(method = "entitiesForRendering", at = @At("RETURN"), cancellable = true) + @Inject(method = "entitiesForRendering()Ljava/lang/Iterable;", at = @At("RETURN"), cancellable = true) private void flywheel$filterEntities(CallbackInfoReturnable> cir) { - if (FlwUtil.canUseVisualization((ClientLevel) (Object) this)) { - Iterable entities = cir.getReturnValue(); - ArrayList filtered = Lists.newArrayList(entities); - - filtered.removeIf(VisualizationHelper::shouldSkipRender); - - cir.setReturnValue(filtered); + if (!FlwUtil.canUseVisualization((ClientLevel) (Object) this)) { + return; } + + Iterable entities = cir.getReturnValue(); + ArrayList filtered = Lists.newArrayList(entities); + + filtered.removeIf(VisualizationHelper::shouldSkipRender); + + cir.setReturnValue(filtered); } } diff --git a/src/main/java/com/jozufozu/flywheel/mixin/ClientMainMixin.java b/src/main/java/com/jozufozu/flywheel/mixin/ClientMainMixin.java index 0b687e233..c24f31f0e 100644 --- a/src/main/java/com/jozufozu/flywheel/mixin/ClientMainMixin.java +++ b/src/main/java/com/jozufozu/flywheel/mixin/ClientMainMixin.java @@ -9,7 +9,7 @@ import net.minecraft.client.main.Main; @Mixin(Main.class) public class ClientMainMixin { - @Inject(method = "main", at = @At("HEAD")) + @Inject(method = "main([Ljava/lang/String;)V", at = @At("HEAD")) private static void flywheel$injectRenderDoc(CallbackInfo ci) { // Only try to load RenderDoc if a system property is set. if (System.getProperty("flw.loadRenderDoc") == null) { diff --git a/src/main/java/com/jozufozu/flywheel/mixin/FixFabulousDepthMixin.java b/src/main/java/com/jozufozu/flywheel/mixin/FixFabulousDepthMixin.java deleted file mode 100644 index 683c597db..000000000 --- a/src/main/java/com/jozufozu/flywheel/mixin/FixFabulousDepthMixin.java +++ /dev/null @@ -1,23 +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.mojang.blaze3d.platform.GlStateManager; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.math.Matrix4f; - -import net.minecraft.client.Camera; -import net.minecraft.client.renderer.GameRenderer; -import net.minecraft.client.renderer.LevelRenderer; -import net.minecraft.client.renderer.LightTexture; - -@Mixin(LevelRenderer.class) -public class FixFabulousDepthMixin { - @Inject(method = "renderLevel", at = @At(value = "INVOKE", ordinal = 1, target = "Lnet/minecraft/client/renderer/PostChain;process(F)V")) - private void flywheel$disableTransparencyShaderDepth(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) { - GlStateManager._depthMask(false); - } -} diff --git a/src/main/java/com/jozufozu/flywheel/mixin/FogUpdateMixin.java b/src/main/java/com/jozufozu/flywheel/mixin/FogUpdateMixin.java index 1eea4af61..cfdc009d5 100644 --- a/src/main/java/com/jozufozu/flywheel/mixin/FogUpdateMixin.java +++ b/src/main/java/com/jozufozu/flywheel/mixin/FogUpdateMixin.java @@ -1,6 +1,7 @@ package com.jozufozu.flywheel.mixin; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -11,21 +12,22 @@ import net.minecraft.client.renderer.FogRenderer; @Mixin(FogRenderer.class) public class FogUpdateMixin { + @Unique private static void flywheel$updateFog() { FlwShaderUniforms.FOG_UPDATE = true; } - @Inject(method = "setupNoFog", at = @At("TAIL")) + @Inject(method = "setupNoFog()V", at = @At("RETURN")) private static void flywheel$onNoFog(CallbackInfo ci) { flywheel$updateFog(); } - @Inject(method = "setupFog(Lnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/FogRenderer$FogMode;FZF)V", remap = false, at = @At("TAIL")) + @Inject(method = "setupFog(Lnet/minecraft/client/Camera;Lnet/minecraft/client/renderer/FogRenderer$FogMode;FZF)V", at = @At("RETURN"), remap = false) private static void flywheel$onFog(CallbackInfo ci) { flywheel$updateFog(); } - @Inject(method = "levelFogColor", at = @At("TAIL")) + @Inject(method = "levelFogColor()V", at = @At("RETURN")) private static void flywheel$onFogColor(CallbackInfo ci) { flywheel$updateFog(); } diff --git a/src/main/java/com/jozufozu/flywheel/mixin/GlStateManagerMixin.java b/src/main/java/com/jozufozu/flywheel/mixin/GlStateManagerMixin.java index 2275d3973..9e6a13497 100644 --- a/src/main/java/com/jozufozu/flywheel/mixin/GlStateManagerMixin.java +++ b/src/main/java/com/jozufozu/flywheel/mixin/GlStateManagerMixin.java @@ -11,18 +11,18 @@ import com.mojang.blaze3d.platform.GlStateManager; @Mixin(GlStateManager.class) public class GlStateManagerMixin { - @Inject(method = "_glBindBuffer", at = @At("TAIL")) - private static void flywheel$onBindBuffer(int pTarget, int pBuffer, CallbackInfo ci) { - GlStateTracker._setBuffer(GlBufferType.fromTarget(pTarget), pBuffer); + @Inject(method = "_glBindBuffer(II)V", at = @At("RETURN")) + private static void flywheel$onBindBuffer(int target, int buffer, CallbackInfo ci) { + GlStateTracker._setBuffer(GlBufferType.fromTarget(target), buffer); } - @Inject(method = "_glBindVertexArray", at = @At("TAIL")) - private static void flywheel$onBindVertexArray(int pArray, CallbackInfo ci) { - GlStateTracker._setVertexArray(pArray); + @Inject(method = "_glBindVertexArray(I)V", at = @At("RETURN")) + private static void flywheel$onBindVertexArray(int array, CallbackInfo ci) { + GlStateTracker._setVertexArray(array); } - @Inject(method = "_glUseProgram", at = @At("TAIL")) - private static void flywheel$onUseProgram(int pProgram, CallbackInfo ci) { - GlStateTracker._setProgram(pProgram); + @Inject(method = "_glUseProgram(I)V", at = @At("RETURN")) + private static void flywheel$onUseProgram(int program, CallbackInfo ci) { + GlStateTracker._setProgram(program); } } diff --git a/src/main/java/com/jozufozu/flywheel/mixin/LevelRendererMixin.java b/src/main/java/com/jozufozu/flywheel/mixin/LevelRendererMixin.java index 4be0294ae..9d676fcb3 100644 --- a/src/main/java/com/jozufozu/flywheel/mixin/LevelRendererMixin.java +++ b/src/main/java/com/jozufozu/flywheel/mixin/LevelRendererMixin.java @@ -38,26 +38,27 @@ public class LevelRendererMixin { @Unique private RenderContext flywheel$renderContext; - @Inject(at = @At("HEAD"), method = "renderLevel") - private void flywheel$beginRender(PoseStack pPoseStack, float pPartialTick, long pFinishNanoTime, boolean pRenderBlockOutline, Camera pCamera, GameRenderer pGameRenderer, LightTexture pLightTexture, Matrix4f pProjectionMatrix, CallbackInfo ci) { - flywheel$renderContext = RenderContext.create((LevelRenderer) (Object) this, level, renderBuffers, pPoseStack, pProjectionMatrix, pCamera); + @Inject(method = "renderLevel", at = @At("HEAD")) + private void flywheel$beginRender(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) { + flywheel$renderContext = RenderContext.create((LevelRenderer) (Object) this, level, renderBuffers, poseStack, projectionMatrix, camera); MinecraftForge.EVENT_BUS.post(new BeginFrameEvent(flywheel$renderContext)); } - @Inject(at = @At("TAIL"), method = "renderLevel") - private void flywheel$endRender(PoseStack pPoseStack, float pPartialTick, long pFinishNanoTime, boolean pRenderBlockOutline, Camera pCamera, GameRenderer pGameRenderer, LightTexture pLightTexture, Matrix4f pProjectionMatrix, CallbackInfo ci) { + @Inject(method = "renderLevel", at = @At("RETURN")) + private void flywheel$endRender(CallbackInfo ci) { flywheel$renderContext = null; } - @Inject(at = @At("TAIL"), method = "allChanged") + @Inject(method = "allChanged", at = @At("RETURN")) private void flywheel$refresh(CallbackInfo ci) { MinecraftForge.EVENT_BUS.post(new ReloadRenderersEvent(level)); } -// @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/RenderBuffers;crumblingBufferSource()Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;", ordinal = 2, shift = Shift.BY, by = 2 // after the game renders the breaking overlay normally -// ), method = "renderLevel") -// private void flywheel$renderCrumbling(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) { +// // after the game renders the breaking overlay normally +// @Inject(method = "renderLevel", +// at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/RenderBuffers;crumblingBufferSource()Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;", ordinal = 2, shift = Shift.BY, by = 2)) +// private void flywheel$renderCrumbling(CallbackInfo ci) { // if (flywheel$renderContext != null) { // // TODO: Crumbling // } diff --git a/src/main/java/com/jozufozu/flywheel/mixin/PausedPartialTickAccessor.java b/src/main/java/com/jozufozu/flywheel/mixin/PausedPartialTickAccessor.java index 29e56c31e..8e196640b 100644 --- a/src/main/java/com/jozufozu/flywheel/mixin/PausedPartialTickAccessor.java +++ b/src/main/java/com/jozufozu/flywheel/mixin/PausedPartialTickAccessor.java @@ -8,5 +8,5 @@ import net.minecraft.client.Minecraft; @Mixin(Minecraft.class) public interface PausedPartialTickAccessor { @Accessor("pausePartialTick") - float flywheel$getPartialTicksPaused(); + float flywheel$getPausePartialTick(); } diff --git a/src/main/java/com/jozufozu/flywheel/mixin/fix/FixFabulousDepthMixin.java b/src/main/java/com/jozufozu/flywheel/mixin/fix/FixFabulousDepthMixin.java new file mode 100644 index 000000000..a119b1e09 --- /dev/null +++ b/src/main/java/com/jozufozu/flywheel/mixin/fix/FixFabulousDepthMixin.java @@ -0,0 +1,18 @@ +package com.jozufozu.flywheel.mixin.fix; + +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.mojang.blaze3d.platform.GlStateManager; + +import net.minecraft.client.renderer.LevelRenderer; + +@Mixin(LevelRenderer.class) +public class FixFabulousDepthMixin { + @Inject(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/PostChain;process(F)V", ordinal = 1)) + private void flywheel$disableTransparencyShaderDepth(CallbackInfo ci) { + GlStateManager._depthMask(false); + } +} diff --git a/src/main/java/com/jozufozu/flywheel/mixin/fix/FixNormalScalingMixin.java b/src/main/java/com/jozufozu/flywheel/mixin/fix/FixNormalScalingMixin.java new file mode 100644 index 000000000..144d6efa9 --- /dev/null +++ b/src/main/java/com/jozufozu/flywheel/mixin/fix/FixNormalScalingMixin.java @@ -0,0 +1,36 @@ +package com.jozufozu.flywheel.mixin.fix; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.At.Shift; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.ModifyArg; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import com.mojang.blaze3d.vertex.PoseStack; + +@Mixin(PoseStack.class) +public class FixNormalScalingMixin { + /** + * Minecraft negates the normal matrix if all scales are equal and negative, but + * does not return afterward. This allows the rest of the method's logic to be + * applied, which negates the matrix again, resulting in the matrix being the + * same as in the beginning. + */ + @Inject(method = "scale(FFF)V", at = @At(value = "INVOKE", target = "Lcom/mojang/math/Matrix3f;mul(F)V", shift = Shift.AFTER), cancellable = true) + private void flywheel$returnAfterNegate(float x, float y, float z, CallbackInfo ci) { + ci.cancel(); + } + + /** + * Minecraft takes the inverse cube root of the product of all scales to provide a + * rough estimate for normalization so that it does not need to be done later. It + * does not make sense for this "normalization factor" to be negative though, as + * that would invert all normals. Additionally, Minecraft's fastInvCubeRoot method + * does not work for negative numbers. + */ + @ModifyArg(method = "scale(FFF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Mth;fastInvCubeRoot(F)F")) + private float flywheel$absInvCbrtInput(float input) { + return Math.abs(input); + } +} diff --git a/src/main/java/com/jozufozu/flywheel/mixin/visualmanage/ChunkRebuildHooksMixin.java b/src/main/java/com/jozufozu/flywheel/mixin/visualmanage/ChunkRebuildHooksMixin.java index 43ab75e0d..2a4e09437 100644 --- a/src/main/java/com/jozufozu/flywheel/mixin/visualmanage/ChunkRebuildHooksMixin.java +++ b/src/main/java/com/jozufozu/flywheel/mixin/visualmanage/ChunkRebuildHooksMixin.java @@ -14,9 +14,9 @@ import net.minecraft.world.level.block.entity.BlockEntity; @Mixin(targets = "net.minecraft.client.renderer.chunk.ChunkRenderDispatcher$RenderChunk$RebuildTask") public class ChunkRebuildHooksMixin { - @Inject(method = "handleBlockEntity", at = @At("HEAD"), cancellable = true) - private void flywheel$addAndFilterBEs(ChunkRenderDispatcher.CompiledChunk compiledChunk, Set set, E be, CallbackInfo ci) { - if (VisualizedRenderDispatcher.tryAddBlockEntity(be)) { + @Inject(method = "handleBlockEntity(Lnet/minecraft/client/renderer/chunk/ChunkRenderDispatcher$CompiledChunk;Ljava/util/Set;Lnet/minecraft/world/level/block/entity/BlockEntity;)V", at = @At("HEAD"), cancellable = true) + private void flywheel$tryAddBlockEntity(ChunkRenderDispatcher.CompiledChunk compiledChunk, Set globalBlockEntities, BlockEntity blockEntity, CallbackInfo ci) { + if (VisualizedRenderDispatcher.tryAddBlockEntity(blockEntity)) { ci.cancel(); } } diff --git a/src/main/java/com/jozufozu/flywheel/mixin/visualmanage/VisualAddMixin.java b/src/main/java/com/jozufozu/flywheel/mixin/visualmanage/VisualAddMixin.java index 64cb29d9f..9d07dcf6b 100644 --- a/src/main/java/com/jozufozu/flywheel/mixin/visualmanage/VisualAddMixin.java +++ b/src/main/java/com/jozufozu/flywheel/mixin/visualmanage/VisualAddMixin.java @@ -20,12 +20,14 @@ public class VisualAddMixin { @Final Level level; - @Inject(method = "setBlockEntity", + @Inject(method = "setBlockEntity(Lnet/minecraft/world/level/block/entity/BlockEntity;)V", at = @At(value = "INVOKE_ASSIGN", target = "Ljava/util/Map;put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;")) private void flywheel$onBlockEntityAdded(BlockEntity blockEntity, CallbackInfo ci) { - if (level.isClientSide && FlwUtil.canUseVisualization(level)) { - VisualizedRenderDispatcher.getBlockEntities(level) - .add(blockEntity); + if (!FlwUtil.canUseVisualization(level)) { + return; } + + VisualizedRenderDispatcher.getBlockEntities(level) + .add(blockEntity); } } diff --git a/src/main/java/com/jozufozu/flywheel/mixin/visualmanage/VisualRemoveMixin.java b/src/main/java/com/jozufozu/flywheel/mixin/visualmanage/VisualRemoveMixin.java index b97d33d26..0db6027b3 100644 --- a/src/main/java/com/jozufozu/flywheel/mixin/visualmanage/VisualRemoveMixin.java +++ b/src/main/java/com/jozufozu/flywheel/mixin/visualmanage/VisualRemoveMixin.java @@ -10,7 +10,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import com.jozufozu.flywheel.impl.visualization.VisualizedRenderDispatcher; import com.jozufozu.flywheel.util.FlwUtil; -import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; @@ -20,11 +19,13 @@ public class VisualRemoveMixin { @Nullable protected Level level; - @Inject(at = @At("TAIL"), method = "setRemoved") + @Inject(method = "setRemoved()V", at = @At("TAIL")) private void flywheel$removeVisual(CallbackInfo ci) { - if (level instanceof ClientLevel && FlwUtil.canUseVisualization(level)) { - VisualizedRenderDispatcher.getBlockEntities(level) - .remove((BlockEntity) (Object) this); + if (!FlwUtil.canUseVisualization(level)) { + return; } + + VisualizedRenderDispatcher.getBlockEntities(level) + .remove((BlockEntity) (Object) this); } } diff --git a/src/main/java/com/jozufozu/flywheel/mixin/visualmanage/VisualUpdateMixin.java b/src/main/java/com/jozufozu/flywheel/mixin/visualmanage/VisualUpdateMixin.java index 455656ef6..9eb4cb37b 100644 --- a/src/main/java/com/jozufozu/flywheel/mixin/visualmanage/VisualUpdateMixin.java +++ b/src/main/java/com/jozufozu/flywheel/mixin/visualmanage/VisualUpdateMixin.java @@ -23,13 +23,13 @@ public class VisualUpdateMixin { /** * This gets called when a block is marked for rerender by vanilla. */ - @Inject(at = @At("TAIL"), method = "setBlockDirty(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/state/BlockState;)V") - private void flywheel$checkUpdate(BlockPos pos, BlockState lastState, BlockState newState, CallbackInfo ci) { + @Inject(method = "setBlockDirty(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/state/BlockState;)V", at = @At("TAIL")) + private void flywheel$checkUpdate(BlockPos pos, BlockState oldState, BlockState newState, CallbackInfo ci) { if (!FlwUtil.canUseVisualization(level)) { return; } - BlockEntity blockEntity = level.getBlockEntity(pos); + BlockEntity blockEntity = level.getBlockEntity(pos); if (blockEntity == null) { return; } diff --git a/src/main/resources/flywheel.mixins.json b/src/main/resources/flywheel.mixins.json index 6f559c065..94beb07d1 100644 --- a/src/main/resources/flywheel.mixins.json +++ b/src/main/resources/flywheel.mixins.json @@ -10,7 +10,6 @@ "ClientLevelMixin", "ClientMainMixin", "EntityTypeMixin", - "FixFabulousDepthMixin", "FogUpdateMixin", "GlStateManagerMixin", "LevelRendererAccessor", @@ -19,6 +18,8 @@ "PausedPartialTickAccessor", "RenderTypeMixin", "VertexFormatMixin", + "fix.FixFabulousDepthMixin", + "fix.FixNormalScalingMixin", "matrix.Matrix3fAccessor", "matrix.Matrix4fAccessor", "matrix.PoseStackMixin", diff --git a/src/main/resources/flywheel.sodium.mixins.json b/src/main/resources/flywheel.sodium.mixins.json index f97f130ca..14e256632 100644 --- a/src/main/resources/flywheel.sodium.mixins.json +++ b/src/main/resources/flywheel.sodium.mixins.json @@ -4,7 +4,7 @@ "package": "com.jozufozu.flywheel.mixin.sodium", "compatibilityLevel": "JAVA_17", "refmap": "flywheel.refmap.json", - "plugin": "com.jozufozu.flywheel.compat.SodiumMixinConfigPlugin", + "plugin": "com.jozufozu.flywheel.compat.SodiumMixinPlugin", "client": [ "ChunkRenderRebuildTaskMixin", "FlywheelCompatMixin"