Skip to content

Commit

Permalink
fix chunk border rendering + delete unnecessary rows
Browse files Browse the repository at this point in the history
  • Loading branch information
Plastoid501 committed Sep 10, 2024
1 parent 95672a3 commit 00638dc
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package net.irisshaders.iris.mixin;

import com.llamalad7.mixinextras.injector.WrapWithCondition;
import com.llamalad7.mixinextras.sugar.Local;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.renderer.debug.ChunkBorderRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Slice;

@Mixin(ChunkBorderRenderer.class)
public class MixinChunkBorderRenderer {
@WrapWithCondition(
method = "render",
at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/VertexConsumer;endVertex()V"),
slice = @Slice(
from = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/PoseStack$Pose;pose()Lorg/joml/Matrix4f;"),
to = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/debug/ChunkBorderRenderer;CELL_BORDER:I", ordinal = 0)
)
)
private boolean isCameraChunk(VertexConsumer instance, @Local(ordinal = 0) int k, @Local(ordinal = 1) int l) {
return !((k == 0 || k == 16) && (l == 0 || l == 16));
}

@WrapWithCondition(
method = "render",
at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/VertexConsumer;endVertex()V"),
slice = @Slice(
from = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/ClientLevel;getMinBuildHeight()I", ordinal = 1),
to = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/MultiBufferSource;getBuffer(Lnet/minecraft/client/renderer/RenderType;)Lcom/mojang/blaze3d/vertex/VertexConsumer;", ordinal = 1)
)
)
private boolean isSubChunkBorder(VertexConsumer instance, @Local(ordinal = 0) int k) {
return k % 16 != 0;
}
}
1 change: 1 addition & 0 deletions common/src/main/resources/mixins.iris.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"MixinBooleanState",
"MixinByteBufferBuilder",
"MixinChainedJsonException",
"MixinChunkBorderRenderer",
"MixinClientLanguage",
"MixinClientPacketListener",
"MixinDebugScreenOverlay",
Expand Down

0 comments on commit 00638dc

Please sign in to comment.