diff --git a/common/src/main/java/ca/fxco/moreculling/mixin/CloudRenderer_cloudsMixin.java b/common/src/main/java/ca/fxco/moreculling/mixin/CloudRenderer_cloudsMixin.java index 0d6e1f0..453ab83 100644 --- a/common/src/main/java/ca/fxco/moreculling/mixin/CloudRenderer_cloudsMixin.java +++ b/common/src/main/java/ca/fxco/moreculling/mixin/CloudRenderer_cloudsMixin.java @@ -39,14 +39,32 @@ private static boolean isEastEmpty(long l) { return false; } + @Inject( + method = "buildMesh(Lnet/minecraft/client/renderer/CloudRenderer$RelativeCameraPos;Lcom/mojang/blaze3d/vertex/BufferBuilder;IIIIIIZ)V", + at = @At(value = "HEAD") + ) + private void moreculling$enableCull(CloudRenderer.RelativeCameraPos p_363221_, BufferBuilder p_364486_, + int p_361006_, int p_362674_, int p_362100_, int p_360889_, int p_360776_, + int p_365003_, boolean p_362207_, CallbackInfo ci) { + if (p_362207_ && MoreCulling.CONFIG.cloudCulling) + RenderSystem.enableCull(); + } + @Inject( method = "buildExtrudedCell", at = @At(value = "HEAD"), cancellable = true ) - private void moreculling$renderClouds(CloudRenderer.RelativeCameraPos relativeCameraPos, - BufferBuilder bufferBuilder, int i, int j, int k, - int l, int m, int n, long o, CallbackInfo ci) { + private void moreculling$renderClouds( + CloudRenderer.RelativeCameraPos relativeCameraPos, + BufferBuilder bufferBuilder, + int i, + int j, + int k, + int l, + int m, + int n, + long o, CallbackInfo ci) { if (!MoreCulling.CONFIG.cloudCulling) { return; } @@ -58,10 +76,10 @@ private static boolean isEastEmpty(long l) { float q = (float)n * 12.0F; float r = q + 12.0F; if (relativeCameraPos != CloudRenderer.RelativeCameraPos.BELOW_CLOUDS) { - bufferBuilder.addVertex(g, 4.0F, q).setColor(j); bufferBuilder.addVertex(g, 4.0F, r).setColor(j); - bufferBuilder.addVertex(f, 4.0F, r).setColor(j); + bufferBuilder.addVertex(g, 4.0F, q).setColor(j); bufferBuilder.addVertex(f, 4.0F, q).setColor(j); + bufferBuilder.addVertex(f, 4.0F, r).setColor(j); } if (relativeCameraPos != CloudRenderer.RelativeCameraPos.ABOVE_CLOUDS) { @@ -79,10 +97,10 @@ private static boolean isEastEmpty(long l) { } if (isSouthEmpty(o) && n < 0) { - bufferBuilder.addVertex(f, 0.0F, r).setColor(l); bufferBuilder.addVertex(f, 4.0F, r).setColor(l); - bufferBuilder.addVertex(g, 4.0F, r).setColor(l); + bufferBuilder.addVertex(f, 0.0F, r).setColor(l); bufferBuilder.addVertex(g, 0.0F, r).setColor(l); + bufferBuilder.addVertex(g, 4.0F, r).setColor(l); } if (isWestEmpty(o) && m > 0) { @@ -93,10 +111,10 @@ private static boolean isEastEmpty(long l) { } if (isEastEmpty(o) && m < 0) { - bufferBuilder.addVertex(g, 0.0F, r).setColor(k); bufferBuilder.addVertex(g, 4.0F, r).setColor(k); - bufferBuilder.addVertex(g, 4.0F, q).setColor(k); + bufferBuilder.addVertex(g, 0.0F, r).setColor(k); bufferBuilder.addVertex(g, 0.0F, q).setColor(k); + bufferBuilder.addVertex(g, 4.0F, q).setColor(k); } boolean bl = Math.abs(m) <= 1 && Math.abs(n) <= 1;