Skip to content

Commit

Permalink
Merge pull request #28 from tildejustin/mac/1.16.1
Browse files Browse the repository at this point in the history
mac-1.16.1 - fix adjState crash, add renderLayer profiler entries, fix c counter, fix mc-4647
  • Loading branch information
tildejustin authored Jul 20, 2024
2 parents 5ae4076 + 37327d4 commit a6fc271
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 3 deletions.
11 changes: 10 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id 'fabric-loom' version '1.5-SNAPSHOT'
id "fabric-loom" version "1.5-SNAPSHOT"
id "maven-publish"
}

archivesBaseName = project.mod_id
Expand Down Expand Up @@ -38,8 +39,16 @@ java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
withSourcesJar()
}

jar {
from "LICENSE.txt"
}

publishing {
publications.create("mavenJava", MavenPublication) {
from components.java
}
repositories {}
}
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ yarn_mappings=1.16.1+build.21
loader_version=0.15.7

# Mod Properties
mod_version=3.2.0
mod_version=3.2.1

maven_group=me.jellysquid.mods
archives_base_name=sodium-fabric
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
}
}
1 change: 1 addition & 0 deletions src/main/resources/sodium.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit a6fc271

Please sign in to comment.