Fix birch and spruce leaves showing the oak biome color with fancy biome blending (#2273)

This commit is contained in:
Jason Mitchell authored and GitHub committed 2026-10-18 17:06:35 -07:00
1 parent 69019b9a62
commit fa8842a64b
3 files changed
+30 -10

No files matched your search

@@ -71,9 +71,18 @@ public final class BiomeVertexBlender {
return blender != null && blender.isActive();
}
public int deferBlockTint() {
public void arm() {
cache.armedBlender = this;
}
public void disarm() {
cache.armedBlender = null;
}
private boolean tryDefer(SmoothBiomeColorCache.ColorType type, int x, int y, int z) {
if (this.type != type || blockX != x || blockY != y || blockZ != z) return false;
replacedBlockTint = true;
return 0xFFFFFF;
return true;
}
public boolean beginFace(RenderBlocks renderer, int face, double x, double y, double z, IIcon icon) {
@@ -129,7 +138,11 @@ public final class BiomeVertexBlender {
public static long smoothColor(IBlockAccess access, SmoothBiomeColorCache.ColorType type, int x, int y, int z) {
final SmoothBiomeColorCache cache = SmoothBiomeColorCache.getActiveCache();
if (cache != null) return cache.getColor(type, x, y, z) & 0xFFFFFFFFL;
if (cache != null) {
final BiomeVertexBlender armed = cache.armedBlender;
if (armed != null && armed.tryDefer(type, x, y, z)) return 0xFFFFFFL;
return cache.getColor(type, x, y, z) & 0xFFFFFFFFL;
}
if (access instanceof WorldClientExtension ext) return ext.celeritas$getSmoothBiomeColorCache().getColor(type, x, y, z) & 0xFFFFFFFFL;
return -1L;
}
@@ -28,6 +28,7 @@ public class SmoothBiomeColorCache extends BiomeColorCache<BiomeGenBase, SmoothB
private final double[] temperatureNoise;
private NoiseGeneratorPerlin noiseSource;
private int minX, minZ, waterY;
BiomeVertexBlender armedBlender;
private static final ThreadLocal<SmoothBiomeColorCache> activeCache = new ThreadLocal<>();
private static final class Slice extends BoxBlur.ColorBuffer {
@@ -26,6 +26,7 @@ public abstract class MixinRenderBlocks {
@Shadow public IBlockAccess blockAccess;
@Shadow public abstract boolean hasOverrideBlockTexture();
@Unique private final BiomeVertexBlender angelica$vertexBlender = new BiomeVertexBlender();
@Unique private boolean angelica$blending;
@Surround(method = {"renderStandardBlock", "renderBlockLiquid"}, id = "blendBlock")
private void angelica$blendBlock(Block block, int x, int y, int z) {
@@ -34,8 +35,10 @@ public abstract class MixinRenderBlocks {
BiomeBlendTessellator tessellator = null;
@Surround.Carry("previous")
BiomeVertexBlender previous = null;
@Surround.Carry
@Surround.Carry("blend")
boolean blend = false;
@Surround.Carry("wasBlending")
final boolean wasBlending = angelica$blending;
if (cache != null && ClientProxy.options().quality.biomeBlendMode == BiomeBlendMode.FANCY && SmoothBiomeColorCache.configuredRadius() != 0) {
tessellator = (BiomeBlendTessellator) TessellatorManager.get();
previous = tessellator.angelica$getBiomeBlender();
@@ -45,11 +48,13 @@ public abstract class MixinRenderBlocks {
if (blend) angelica$vertexBlender.setup(cache, type, x, y, z);
tessellator.angelica$setBiomeBlender(blend ? angelica$vertexBlender : null);
}
angelica$blending = blend;
}
@Surround.Finally("blendBlock")
private void angelica$endBlendBlock(@Surround.Carry("tessellator") BiomeBlendTessellator tessellator, @Surround.Carry("previous") BiomeVertexBlender previous,
@Surround.Carry boolean blend) {
@Surround.Carry("blend") boolean blend, @Surround.Carry("wasBlending") boolean wasBlending) {
angelica$blending = wasBlending;
if (tessellator == null) return;
tessellator.angelica$setBiomeBlender(previous);
if (blend) angelica$vertexBlender.clear();
@@ -66,13 +71,14 @@ public abstract class MixinRenderBlocks {
@Surround(method = {"renderStandardBlock", "renderBlockLiquid"}, id = "deferTint",
at = @At(value = "INVOKE", target = "Lnet/minecraft/block/Block;colorMultiplier(Lnet/minecraft/world/IBlockAccess;III)I"))
private void angelica$deferTintEnter() {
@Surround.Skip
final boolean defer = ((BiomeBlendTessellator) TessellatorManager.get()).angelica$getBiomeBlender() == angelica$vertexBlender;
@Surround.Carry
final boolean armed = angelica$blending;
if (armed) angelica$vertexBlender.arm();
}
@Surround.Skipped("deferTint")
private int angelica$deferTint() {
return angelica$vertexBlender.deferBlockTint();
@Surround.Finally("deferTint")
private void angelica$deferTintExit(@Surround.Carry boolean armed) {
if (armed) angelica$vertexBlender.disarm();
}
@Surround(method = {"renderStandardBlockWithAmbientOcclusion", "renderStandardBlockWithAmbientOcclusionPartial", "renderStandardBlockWithColorMultiplier"}, id = "faceYNeg",