From 2ae4c31b2d0fc0dc90f64b19b93646064547d7e0 Mon Sep 17 00:00:00 2001 From: tildejustin Date: Tue, 2 Jul 2024 13:04:05 -0400 Subject: [PATCH 1/7] add null check to adjState --- .../sodium/client/render/occlusion/BlockOcclusionCache.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/me/jellysquid/mods/sodium/client/render/occlusion/BlockOcclusionCache.java b/src/main/java/me/jellysquid/mods/sodium/client/render/occlusion/BlockOcclusionCache.java index bb77cf64..dd9503a6 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/render/occlusion/BlockOcclusionCache.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/render/occlusion/BlockOcclusionCache.java @@ -33,6 +33,9 @@ public boolean shouldDrawSide(BlockState selfState, BlockView view, BlockPos pos adjPos.set(pos.getX() + facing.getOffsetX(), pos.getY() + facing.getOffsetY(), pos.getZ() + facing.getOffsetZ()); BlockState adjState = view.getBlockState(adjPos); + if (adjState == null) { + return false; + } if (selfState.isSideInvisible(adjState, facing)) { return false; From a6aaf7fec7de44d726173c40c7e7482d4e644046 Mon Sep 17 00:00:00 2001 From: tildejustin Date: Tue, 2 Jul 2024 13:04:47 -0400 Subject: [PATCH 2/7] profile renderLayers as vanilla does --- .../mods/sodium/client/render/SodiumWorldRenderer.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/me/jellysquid/mods/sodium/client/render/SodiumWorldRenderer.java b/src/main/java/me/jellysquid/mods/sodium/client/render/SodiumWorldRenderer.java index b99bd33e..31d496b9 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/render/SodiumWorldRenderer.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/render/SodiumWorldRenderer.java @@ -184,9 +184,12 @@ public void updateChunks(Camera camera, Frustum frustum, boolean hasForcedFrustu public void drawChunkLayer(RenderLayer renderLayer, MatrixStack matrixStack, double x, double y, double z) { BlockRenderPass pass = this.renderPassManager.getRenderPassForLayer(renderLayer); pass.startDrawing(); + this.client.getProfiler().push("filterempty"); + this.client.getProfiler().swap(() -> "render_" + renderLayer); this.chunkRenderManager.renderLayer(matrixStack, pass, x, y, z); + this.client.getProfiler().pop(); pass.endDrawing(); RenderSystem.clearCurrentColor(); From a1d51b3e4722b658b6ed30fb30d3017b5ce3ff71 Mon Sep 17 00:00:00 2001 From: tildejustin Date: Tue, 2 Jul 2024 13:04:56 -0400 Subject: [PATCH 3/7] bump version to 1.3.1 --- gradle.properties | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 59f96a1c..ef52c59d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,8 @@ org.gradle.jvmargs = -Xmx2G org.gradle.parallel = true org.gradle.caching = true -mod_version = 1.3.0 +mod_version = 1.3.1 + minecraft_version = 1.15.2 yarn_mappings = 1.15.2+build.17 loader_version = 0.15.6 From d61ac0d503b3c333f4fd8cbff0ef93118140c6a7 Mon Sep 17 00:00:00 2001 From: tildejustin Date: Thu, 18 Jul 2024 01:08:55 -0400 Subject: [PATCH 4/7] add maven plugin for jitpack support --- build.gradle | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build.gradle b/build.gradle index 5353bae3..112c4f47 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,6 @@ plugins { id "fabric-loom" version "1.5-SNAPSHOT" + id "maven-publish" } version = "$mod_version+$target_version" @@ -37,3 +38,10 @@ java { jar { from "LICENSE.txt" } + +publishing { + publications.create("mavenJava", MavenPublication) { + from components.java + } + repositories {} +} From f1551e84d41ec53b10b439dac035fe30b7379565 Mon Sep 17 00:00:00 2001 From: tildejustin Date: Thu, 18 Jul 2024 01:11:05 -0400 Subject: [PATCH 5/7] gen sources jar --- build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle b/build.gradle index 112c4f47..106ac879 100644 --- a/build.gradle +++ b/build.gradle @@ -33,6 +33,7 @@ tasks.withType(JavaCompile).configureEach { java { sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8 toolchain { languageVersion = JavaLanguageVersion.of(8) } + withSourcesJar() } jar { From 15aeb78e2bc981f33c82f9e9fc78658329bbb9ce Mon Sep 17 00:00:00 2001 From: tildejustin Date: Thu, 18 Jul 2024 20:51:19 -0400 Subject: [PATCH 6/7] sanitize NaN values in fog colors, fixing MC-4647 credit to crazysmc for looking into this https://github.com/crazysmc/mc-4647-fix --- .../MixinBackgroundRenderer.java | 33 +++++++++++++++++++ src/main/resources/sodium.mixins.json | 1 + 2 files changed, 34 insertions(+) create mode 100644 src/main/java/me/jellysquid/mods/sodium/mixin/features/chunk_rendering/MixinBackgroundRenderer.java diff --git a/src/main/java/me/jellysquid/mods/sodium/mixin/features/chunk_rendering/MixinBackgroundRenderer.java b/src/main/java/me/jellysquid/mods/sodium/mixin/features/chunk_rendering/MixinBackgroundRenderer.java new file mode 100644 index 00000000..bd649df0 --- /dev/null +++ b/src/main/java/me/jellysquid/mods/sodium/mixin/features/chunk_rendering/MixinBackgroundRenderer.java @@ -0,0 +1,33 @@ +package me.jellysquid.mods.sodium.mixin.features.chunk_rendering; + +import net.minecraft.client.render.BackgroundRenderer; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(BackgroundRenderer.class) +public abstract class MixinBackgroundRenderer { + @Shadow + private static float red; + + @Shadow + private static float blue; + + @Shadow + private static float green; + + @Inject(method = "render", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;clearColor(FFFF)V")) + private static void handleNaNIntensity(CallbackInfo ci) { + if (Float.isNaN(red)) { + red = 0; + } + if (Float.isNaN(green)) { + green = 0; + } + if (Float.isNaN(blue)) { + blue = 0; + } + } +} diff --git a/src/main/resources/sodium.mixins.json b/src/main/resources/sodium.mixins.json index 90e3fec6..c8b21963 100644 --- a/src/main/resources/sodium.mixins.json +++ b/src/main/resources/sodium.mixins.json @@ -23,6 +23,7 @@ "features.buffer_builder.intrinsics.MixinBufferBuilder", "features.buffer_builder.intrinsics.MixinSpriteTexturedVertexConsumer", "features.buffer_builder.intrinsics.MixinWorldRenderer", + "features.chunk_rendering.MixinBackgroundRenderer", "features.chunk_rendering.MixinChunkBuilder", "features.chunk_rendering.MixinClientChunkManager", "features.chunk_rendering.MixinClientChunkManager$MixinClientChunkMap", From 72f63a2b1759d9ca39a7023ef8e75823a6cfd72c Mon Sep 17 00:00:00 2001 From: tildejustin Date: Fri, 19 Jul 2024 12:37:56 -0400 Subject: [PATCH 7/7] vanilla parity for the second C counter (total section count) --- .../mods/sodium/client/render/chunk/ChunkRenderManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/ChunkRenderManager.java b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/ChunkRenderManager.java index a164fd56..139ad6f7 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/ChunkRenderManager.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/ChunkRenderManager.java @@ -503,7 +503,8 @@ public void destroy() { } public int getTotalSections() { - return this.renders.size(); + int renderDistance = MinecraftClient.getInstance().options.viewDistance * 2 + 1; + return renderDistance * 16 * renderDistance; } public void scheduleRebuild(int x, int y, int z, boolean important) {