Skip to content

Commit

Permalink
Merge pull request #27 from tildejustin/1.15.2
Browse files Browse the repository at this point in the history
1.15.2 - fix adjState crash, add renderLayer profiler entries, fix c counter, fix mc-4647
  • Loading branch information
tildejustin authored Jul 20, 2024
2 parents 8694e61 + 72f63a2 commit b1f8194
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 2 deletions.
9 changes: 9 additions & 0 deletions 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 "maven-publish"
}

version = "$mod_version+$target_version"
Expand Down Expand Up @@ -32,8 +33,16 @@ tasks.withType(JavaCompile).configureEach {
java {
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
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 @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
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 b1f8194

Please sign in to comment.