Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix chunk border rendering #2463

Merged
merged 2 commits into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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