From a8e95f70c171053ae5ecd9b75e3601d82974270c Mon Sep 17 00:00:00 2001 From: Eclipse-Sol Date: Thu, 1 Oct 2026 23:35:02 -0400 Subject: [PATCH] Improve biome blending and improve compat (#2180) --- .../celeritas/BiomeVertexBlender.java | 57 ++++++++--- .../biome_blending/MixinBlockGrass.java | 3 +- .../biome_blending/MixinBlockLeaves.java | 3 +- .../biome_blending/MixinBlockLiquid.java | 3 +- .../biome_blending/MixinRenderBlocks.java | 96 +++++++++++++++++-- .../cc/client/renderer/MixinRenderBlocks.java | 22 +---- .../ctm_cc/MixinRenderBlocks.java | 3 +- .../ctm_cc/MixinRenderBlocksNoCTM.java | 3 +- .../early/rendering/MixinTessellator.java | 6 +- 9 files changed, 148 insertions(+), 48 deletions(-) diff --git a/src/main/java/com/gtnewhorizons/angelica/rendering/celeritas/BiomeVertexBlender.java b/src/main/java/com/gtnewhorizons/angelica/rendering/celeritas/BiomeVertexBlender.java index a08263a61..18d075a9a 100644 --- a/src/main/java/com/gtnewhorizons/angelica/rendering/celeritas/BiomeVertexBlender.java +++ b/src/main/java/com/gtnewhorizons/angelica/rendering/celeritas/BiomeVertexBlender.java @@ -3,12 +3,20 @@ package com.gtnewhorizons.angelica.rendering.celeritas; import com.gtnewhorizon.gtnhlib.client.renderer.TessellatorManager; import com.gtnewhorizons.angelica.proxy.ClientProxy; import me.jellysquid.mods.sodium.client.gui.options.named.BiomeBlendMode; +import net.minecraft.client.renderer.RenderBlocks; import org.embeddedt.embeddium.api.util.ColorMixer; import java.nio.ByteOrder; public final class BiomeVertexBlender { private static final boolean LITTLE_ENDIAN = ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN; + // Rows: -Y, +Y, -Z, +Z, -X, +X. + // Columns: RenderBlocks top-left, bottom-left, bottom-right, top-right. + // Corner bits: 1 = max X, 2 = max Y, 4 = max Z; unset = min. + private static final int[][] FACE_CORNERS = { + {4, 0, 1, 5}, {7, 3, 2, 6}, {2, 3, 1, 0}, + {6, 4, 5, 7}, {6, 2, 0, 4}, {5, 1, 3, 7} + }; private SmoothBiomeColorCache cache; private SmoothBiomeColorCache.ColorType type; private int blockX, blockY, blockZ; @@ -36,6 +44,10 @@ public final class BiomeVertexBlender { return type == SmoothBiomeColorCache.ColorType.GRASS; } + public boolean isWater() { + return type == SmoothBiomeColorCache.ColorType.WATER; + } + public boolean isActive() { return replacedBlockTint; } @@ -46,20 +58,41 @@ public final class BiomeVertexBlender { return blender != null && blender.isActive(); } - public static int blockColor(SmoothBiomeColorCache cache, SmoothBiomeColorCache.ColorType type, int x, int y, int z) { - if (ClientProxy.options().quality.biomeBlendMode != BiomeBlendMode.FANCY) { - return cache.getColor(type, x, y, z); - } - final BiomeVertexBlender blender = ((BiomeBlendTessellator) TessellatorManager.get()).angelica$getBiomeBlender(); - return blender == null ? cache.getColor(type, x, y, z) : blender.replaceBlockColor(cache, type, x, y, z); + public int deferBlockTint() { + replacedBlockTint = true; + return 0xFFFFFF; } - int replaceBlockColor(SmoothBiomeColorCache cache, SmoothBiomeColorCache.ColorType type, int x, int y, int z) { - if (this.cache == cache && this.type == type && blockX == x && blockY == y && blockZ == z) { - replacedBlockTint = true; - return 0xFFFFFF; - } - return cache.getColor(type, x, y, z); + public void tintFace(RenderBlocks renderer, int face, double x, double y, double z) { + final int[] corners = FACE_CORNERS[face]; + final int tl = faceColor(renderer, face, corners[0], x, y, z); + final int bl = faceColor(renderer, face, corners[1], x, y, z); + final int br = faceColor(renderer, face, corners[2], x, y, z); + final int tr = faceColor(renderer, face, corners[3], x, y, z); + renderer.colorRedTopLeft *= (tl >> 16 & 255) / 255.0f; + renderer.colorGreenTopLeft *= (tl >> 8 & 255) / 255.0f; + renderer.colorBlueTopLeft *= (tl & 255) / 255.0f; + renderer.colorRedBottomLeft *= (bl >> 16 & 255) / 255.0f; + renderer.colorGreenBottomLeft *= (bl >> 8 & 255) / 255.0f; + renderer.colorBlueBottomLeft *= (bl & 255) / 255.0f; + renderer.colorRedBottomRight *= (br >> 16 & 255) / 255.0f; + renderer.colorGreenBottomRight *= (br >> 8 & 255) / 255.0f; + renderer.colorBlueBottomRight *= (br & 255) / 255.0f; + renderer.colorRedTopRight *= (tr >> 16 & 255) / 255.0f; + renderer.colorGreenTopRight *= (tr >> 8 & 255) / 255.0f; + renderer.colorBlueTopRight *= (tr & 255) / 255.0f; + } + + private int faceColor(RenderBlocks renderer, int face, int corner, double x, double y, double z) { + if (renderer.renderFromInside) corner ^= face < 4 ? 1 : 4; + return sampleVertex( + x + ((corner & 1) == 0 ? renderer.renderMinX : renderer.renderMaxX), + y + ((corner & 2) == 0 ? renderer.renderMinY : renderer.renderMaxY), + z + ((corner & 4) == 0 ? renderer.renderMinZ : renderer.renderMaxZ)); + } + + public static int nativeToABGR(int color) { + return LITTLE_ENDIAN ? color : Integer.reverseBytes(color); } public int tint(int nativeColor, double x, double y, double z) { diff --git a/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/celeritas/biome_blending/MixinBlockGrass.java b/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/celeritas/biome_blending/MixinBlockGrass.java index 385543070..8651d66d3 100644 --- a/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/celeritas/biome_blending/MixinBlockGrass.java +++ b/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/celeritas/biome_blending/MixinBlockGrass.java @@ -1,6 +1,5 @@ package com.gtnewhorizons.angelica.mixins.early.celeritas.biome_blending; -import com.gtnewhorizons.angelica.rendering.celeritas.BiomeVertexBlender; import com.gtnewhorizons.angelica.rendering.celeritas.SmoothBiomeColorCache; import com.gtnewhorizons.angelica.rendering.celeritas.WorldClientExtension; import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod; @@ -16,7 +15,7 @@ public class MixinBlockGrass { // Check ThreadLocal first (for worker threads), then fall back to world cache SmoothBiomeColorCache cache = SmoothBiomeColorCache.getActiveCache(); if (cache != null) { - return BiomeVertexBlender.blockColor(cache, SmoothBiomeColorCache.ColorType.GRASS, x, y, z); + return cache.getColor(SmoothBiomeColorCache.ColorType.GRASS, x, y, z); } else if (access instanceof WorldClientExtension ext) { return ext.celeritas$getSmoothBiomeColorCache().getColor(SmoothBiomeColorCache.ColorType.GRASS, x, y, z); } else { diff --git a/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/celeritas/biome_blending/MixinBlockLeaves.java b/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/celeritas/biome_blending/MixinBlockLeaves.java index 5258301de..9e2d7aed1 100644 --- a/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/celeritas/biome_blending/MixinBlockLeaves.java +++ b/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/celeritas/biome_blending/MixinBlockLeaves.java @@ -1,6 +1,5 @@ package com.gtnewhorizons.angelica.mixins.early.celeritas.biome_blending; -import com.gtnewhorizons.angelica.rendering.celeritas.BiomeVertexBlender; import com.gtnewhorizons.angelica.rendering.celeritas.SmoothBiomeColorCache; import com.gtnewhorizons.angelica.rendering.celeritas.WorldClientExtension; import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod; @@ -16,7 +15,7 @@ public class MixinBlockLeaves { // Check ThreadLocal first (for worker threads), then fall back to world cache SmoothBiomeColorCache cache = SmoothBiomeColorCache.getActiveCache(); if (cache != null) { - return BiomeVertexBlender.blockColor(cache, SmoothBiomeColorCache.ColorType.FOLIAGE, x, y, z); + return cache.getColor(SmoothBiomeColorCache.ColorType.FOLIAGE, x, y, z); } else if (access instanceof WorldClientExtension ext) { return ext.celeritas$getSmoothBiomeColorCache().getColor(SmoothBiomeColorCache.ColorType.FOLIAGE, x, y, z); } else { diff --git a/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/celeritas/biome_blending/MixinBlockLiquid.java b/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/celeritas/biome_blending/MixinBlockLiquid.java index dbebd5880..0cdb0668b 100644 --- a/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/celeritas/biome_blending/MixinBlockLiquid.java +++ b/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/celeritas/biome_blending/MixinBlockLiquid.java @@ -1,6 +1,5 @@ package com.gtnewhorizons.angelica.mixins.early.celeritas.biome_blending; -import com.gtnewhorizons.angelica.rendering.celeritas.BiomeVertexBlender; import com.gtnewhorizons.angelica.rendering.celeritas.SmoothBiomeColorCache; import com.gtnewhorizons.angelica.rendering.celeritas.WorldClientExtension; import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod; @@ -25,7 +24,7 @@ public abstract class MixinBlockLiquid extends Block { // Check ThreadLocal first (for worker threads), then fall back to world cache SmoothBiomeColorCache cache = SmoothBiomeColorCache.getActiveCache(); if (cache != null) { - return BiomeVertexBlender.blockColor(cache, SmoothBiomeColorCache.ColorType.WATER, x, y, z); + return cache.getColor(SmoothBiomeColorCache.ColorType.WATER, x, y, z); } else if (access instanceof WorldClientExtension ext) { return ext.celeritas$getSmoothBiomeColorCache().getColor(SmoothBiomeColorCache.ColorType.WATER, x, y, z); } else { diff --git a/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/celeritas/biome_blending/MixinRenderBlocks.java b/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/celeritas/biome_blending/MixinRenderBlocks.java index 7aca27dc8..a51893cf5 100644 --- a/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/celeritas/biome_blending/MixinRenderBlocks.java +++ b/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/celeritas/biome_blending/MixinRenderBlocks.java @@ -7,6 +7,7 @@ import com.gtnewhorizons.angelica.rendering.celeritas.BiomeBlendTessellator; import com.gtnewhorizons.angelica.rendering.celeritas.BiomeVertexBlender; import com.gtnewhorizons.angelica.rendering.celeritas.SmoothBiomeColorCache; import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.prupe.mcpatcher.cc.ColorizeBlock; import com.prupe.mcpatcher.ctm.CTMUtils; @@ -16,12 +17,14 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockGrass; import net.minecraft.client.renderer.EntityRenderer; import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; import net.minecraft.init.Blocks; import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; @Mixin(RenderBlocks.class) public abstract class MixinRenderBlocks { @@ -58,23 +61,98 @@ public abstract class MixinRenderBlocks { return null; } - @WrapMethod(method = {"renderFaceYNeg", "renderFaceYPos", "renderFaceZNeg", "renderFaceZPos", "renderFaceXNeg", "renderFaceXPos"}) - private void angelica$blendFace(Block block, double x, double y, double z, IIcon icon, Operation original) { + @WrapOperation(method = {"renderStandardBlock", "renderBlockLiquid"}, + at = @At(value = "INVOKE", target = "Lnet/minecraft/block/Block;colorMultiplier(Lnet/minecraft/world/IBlockAccess;III)I")) + private int angelica$deferLocalTint(Block block, IBlockAccess access, int x, int y, int z, Operation original) { + return ((BiomeBlendTessellator) TessellatorManager.get()).angelica$getBiomeBlender() == angelica$vertexBlender + ? angelica$vertexBlender.deferBlockTint() : original.call(block, access, x, y, z); + } + + @WrapOperation(method = {"renderStandardBlockWithAmbientOcclusion", "renderStandardBlockWithAmbientOcclusionPartial", "renderStandardBlockWithColorMultiplier"}, + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/RenderBlocks;renderFaceYNeg(Lnet/minecraft/block/Block;DDDLnet/minecraft/util/IIcon;)V")) + private void angelica$blendYNeg(RenderBlocks renderer, Block block, double x, double y, double z, IIcon icon, Operation original) { + angelica$blendFace(renderer, 0, block, x, y, z, icon, original); + } + + @WrapOperation(method = {"renderStandardBlockWithAmbientOcclusion", "renderStandardBlockWithAmbientOcclusionPartial", "renderStandardBlockWithColorMultiplier"}, + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/RenderBlocks;renderFaceYPos(Lnet/minecraft/block/Block;DDDLnet/minecraft/util/IIcon;)V")) + private void angelica$blendYPos(RenderBlocks renderer, Block block, double x, double y, double z, IIcon icon, Operation original) { + angelica$blendFace(renderer, 1, block, x, y, z, icon, original); + } + + @WrapOperation(method = {"renderStandardBlockWithAmbientOcclusion", "renderStandardBlockWithAmbientOcclusionPartial", "renderStandardBlockWithColorMultiplier"}, + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/RenderBlocks;renderFaceZNeg(Lnet/minecraft/block/Block;DDDLnet/minecraft/util/IIcon;)V")) + private void angelica$blendZNeg(RenderBlocks renderer, Block block, double x, double y, double z, IIcon icon, Operation original) { + angelica$blendFace(renderer, 2, block, x, y, z, icon, original); + } + + @WrapOperation(method = {"renderStandardBlockWithAmbientOcclusion", "renderStandardBlockWithAmbientOcclusionPartial", "renderStandardBlockWithColorMultiplier"}, + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/RenderBlocks;renderFaceZPos(Lnet/minecraft/block/Block;DDDLnet/minecraft/util/IIcon;)V")) + private void angelica$blendZPos(RenderBlocks renderer, Block block, double x, double y, double z, IIcon icon, Operation original) { + angelica$blendFace(renderer, 3, block, x, y, z, icon, original); + } + + @WrapOperation(method = {"renderStandardBlockWithAmbientOcclusion", "renderStandardBlockWithAmbientOcclusionPartial", "renderStandardBlockWithColorMultiplier"}, + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/RenderBlocks;renderFaceXNeg(Lnet/minecraft/block/Block;DDDLnet/minecraft/util/IIcon;)V")) + private void angelica$blendXNeg(RenderBlocks renderer, Block block, double x, double y, double z, IIcon icon, Operation original) { + angelica$blendFace(renderer, 4, block, x, y, z, icon, original); + } + + @WrapOperation(method = {"renderStandardBlockWithAmbientOcclusion", "renderStandardBlockWithAmbientOcclusionPartial", "renderStandardBlockWithColorMultiplier"}, + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/RenderBlocks;renderFaceXPos(Lnet/minecraft/block/Block;DDDLnet/minecraft/util/IIcon;)V")) + private void angelica$blendXPos(RenderBlocks renderer, Block block, double x, double y, double z, IIcon icon, Operation original) { + angelica$blendFace(renderer, 5, block, x, y, z, icon, original); + } + + @Unique + private void angelica$blendFace(RenderBlocks renderer, int face, Block block, double x, double y, double z, IIcon icon, Operation original) { if (!angelica$vertexBlender.isActive()) { - original.call(block, x, y, z, icon); + original.call(renderer, block, x, y, z, icon); + return; + } + final Tessellator tessellator = TessellatorManager.get(); + if (((BiomeBlendTessellator) tessellator).angelica$getBiomeBlender() != angelica$vertexBlender) { + original.call(renderer, block, x, y, z, icon); return; } - final BiomeBlendTessellator tessellator = (BiomeBlendTessellator) TessellatorManager.get(); - final BiomeVertexBlender blender = tessellator.angelica$getBiomeBlender(); final IIcon originalIcon = AngelicaConfig.enableMCPatcherForgeFeatures && MCPatcherForgeConfig.ConnectedTextures.enabled ? CTMUtils.getOriginalIcon(icon) : icon; - if (blender != null && blender.isGrass() && icon != Blocks.grass.getIcon(1, 0) && icon != BlockGrass.getIconSideOverlay() + if (angelica$vertexBlender.isGrass() && icon != Blocks.grass.getIcon(1, 0) && icon != BlockGrass.getIconSideOverlay() && originalIcon != Blocks.grass.getIcon(1, 0) && originalIcon != BlockGrass.getIconSideOverlay()) { - tessellator.angelica$setBiomeBlender(null); + original.call(renderer, block, x, y, z, icon); + return; + } + + final float rtl = renderer.colorRedTopLeft, gtl = renderer.colorGreenTopLeft, btl = renderer.colorBlueTopLeft; + final float rbl = renderer.colorRedBottomLeft, gbl = renderer.colorGreenBottomLeft, bbl = renderer.colorBlueBottomLeft; + final float rbr = renderer.colorRedBottomRight, gbr = renderer.colorGreenBottomRight, bbr = renderer.colorBlueBottomRight; + final float rtr = renderer.colorRedTopRight, gtr = renderer.colorGreenTopRight, btr = renderer.colorBlueTopRight; + final boolean ao = renderer.enableAO; + final int ltl = renderer.brightnessTopLeft, lbl = renderer.brightnessBottomLeft; + final int lbr = renderer.brightnessBottomRight, ltr = renderer.brightnessTopRight; + final int color = tessellator.color, brightness = tessellator.brightness; + if (!ao) { + final int abgr = BiomeVertexBlender.nativeToABGR(color); + renderer.colorRedTopLeft = renderer.colorRedBottomLeft = renderer.colorRedBottomRight = renderer.colorRedTopRight = (abgr & 255) / 255.0f; + renderer.colorGreenTopLeft = renderer.colorGreenBottomLeft = renderer.colorGreenBottomRight = renderer.colorGreenTopRight = (abgr >> 8 & 255) / 255.0f; + renderer.colorBlueTopLeft = renderer.colorBlueBottomLeft = renderer.colorBlueBottomRight = renderer.colorBlueTopRight = (abgr >> 16 & 255) / 255.0f; + renderer.brightnessTopLeft = renderer.brightnessBottomLeft = renderer.brightnessBottomRight = renderer.brightnessTopRight = brightness; + renderer.enableAO = true; } try { - original.call(block, x, y, z, icon); + angelica$vertexBlender.tintFace(renderer, face, x, y, z); + original.call(renderer, block, x, y, z, icon); } finally { - tessellator.angelica$setBiomeBlender(blender); + renderer.colorRedTopLeft = rtl; renderer.colorGreenTopLeft = gtl; renderer.colorBlueTopLeft = btl; + renderer.colorRedBottomLeft = rbl; renderer.colorGreenBottomLeft = gbl; renderer.colorBlueBottomLeft = bbl; + renderer.colorRedBottomRight = rbr; renderer.colorGreenBottomRight = gbr; renderer.colorBlueBottomRight = bbr; + renderer.colorRedTopRight = rtr; renderer.colorGreenTopRight = gtr; renderer.colorBlueTopRight = btr; + renderer.enableAO = ao; + if (!ao) { + renderer.brightnessTopLeft = ltl; renderer.brightnessBottomLeft = lbl; + renderer.brightnessBottomRight = lbr; renderer.brightnessTopRight = ltr; + tessellator.color = color; + tessellator.brightness = brightness; + } } } } diff --git a/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/mcpatcherforge/cc/client/renderer/MixinRenderBlocks.java b/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/mcpatcherforge/cc/client/renderer/MixinRenderBlocks.java index 36c1e2118..28bcf2926 100644 --- a/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/mcpatcherforge/cc/client/renderer/MixinRenderBlocks.java +++ b/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/mcpatcherforge/cc/client/renderer/MixinRenderBlocks.java @@ -2,7 +2,6 @@ package com.gtnewhorizons.angelica.mixins.early.mcpatcherforge.cc.client.rendere import net.minecraft.block.Block; import net.minecraft.block.BlockCauldron; -import net.minecraft.client.renderer.EntityRenderer; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.world.IBlockAccess; @@ -24,6 +23,7 @@ import org.spongepowered.asm.mixin.injection.invoke.arg.Args; import com.llamalad7.mixinextras.injector.v2.WrapWithCondition; import com.llamalad7.mixinextras.sugar.Share; import com.llamalad7.mixinextras.sugar.ref.LocalBooleanRef; +import com.llamalad7.mixinextras.sugar.Local; import com.llamalad7.mixinextras.sugar.ref.LocalFloatRef; import com.prupe.mcpatcher.cc.ColorizeBlock; import com.prupe.mcpatcher.cc.Colorizer; @@ -194,24 +194,10 @@ public abstract class MixinRenderBlocks { @Inject( method = "renderStandardBlock(Lnet/minecraft/block/Block;III)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;isAmbientOcclusionEnabled()Z")) - private void modifyRenderStandardBlock(Block block, int x, int y, int z, CallbackInfoReturnable cir) { - - // TODO: capture local variables to prevent double math - int l = block.colorMultiplier(this.blockAccess, x, y, z); - float f = (float) (l >> 16 & 255) / 255.0F; - float f1 = (float) (l >> 8 & 255) / 255.0F; - float f2 = (float) (l & 255) / 255.0F; - - if (EntityRenderer.anaglyphEnable) { - float f3 = (f * 30.0F + f1 * 59.0F + f2 * 11.0F) / 100.0F; - float f4 = (f * 30.0F + f1 * 70.0F) / 100.0F; - float f5 = (f * 30.0F + f2 * 70.0F) / 100.0F; - f = f3; - f1 = f4; - f2 = f5; - } + private void modifyRenderStandardBlock(Block block, int x, int y, int z, CallbackInfoReturnable cir, + @Local(ordinal = 0) float red, @Local(ordinal = 1) float green, @Local(ordinal = 2) float blue) { RenderBlocksUtils - .setupColorMultiplier(block, this.blockAccess, x, y, z, this.hasOverrideBlockTexture(), f, f1, f2); + .setupColorMultiplier(block, this.blockAccess, x, y, z, this.hasOverrideBlockTexture(), red, green, blue); } @ModifyConstant( diff --git a/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/mcpatcherforge/ctm_cc/MixinRenderBlocks.java b/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/mcpatcherforge/ctm_cc/MixinRenderBlocks.java index 68c7d7f9d..c10553ea3 100644 --- a/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/mcpatcherforge/ctm_cc/MixinRenderBlocks.java +++ b/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/mcpatcherforge/ctm_cc/MixinRenderBlocks.java @@ -11,6 +11,7 @@ import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; +import com.gtnewhorizons.angelica.rendering.celeritas.BiomeVertexBlender; import com.llamalad7.mixinextras.sugar.Share; import com.llamalad7.mixinextras.sugar.ref.LocalFloatRef; import com.llamalad7.mixinextras.sugar.ref.LocalIntRef; @@ -43,7 +44,7 @@ public abstract class MixinRenderBlocks { private IIcon mcpatcherforge$obtainFloatsAndRedirectToGetBlockIcon(RenderBlocks instance, Block block, int side, int meta, Block specializedBlock, int x, int y, int z, @Share("red") LocalFloatRef red, @Share("green") LocalFloatRef green, @Share("blue") LocalFloatRef blue) { - int l = block.colorMultiplier(this.blockAccess, x, y, z); + int l = BiomeVertexBlender.isRendering() ? 0xFFFFFF : block.colorMultiplier(this.blockAccess, x, y, z); red.set((float) (l >> 16 & 255) / 255.0F); blue.set((float) (l >> 8 & 255) / 255.0F); green.set((float) (l & 255) / 255.0F); diff --git a/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/mcpatcherforge/ctm_cc/MixinRenderBlocksNoCTM.java b/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/mcpatcherforge/ctm_cc/MixinRenderBlocksNoCTM.java index d05ca1abf..2d2ecb3f9 100644 --- a/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/mcpatcherforge/ctm_cc/MixinRenderBlocksNoCTM.java +++ b/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/mcpatcherforge/ctm_cc/MixinRenderBlocksNoCTM.java @@ -11,6 +11,7 @@ import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; +import com.gtnewhorizons.angelica.rendering.celeritas.BiomeVertexBlender; import com.llamalad7.mixinextras.sugar.Share; import com.llamalad7.mixinextras.sugar.ref.LocalFloatRef; import com.llamalad7.mixinextras.sugar.ref.LocalIntRef; @@ -39,7 +40,7 @@ public abstract class MixinRenderBlocksNoCTM { private IIcon mcpatcherforge$obtainFloatsAndRedirectToGetBlockIcon(RenderBlocks instance, Block block, int side, int meta, Block specializedBlock, int x, int y, int z, @Share("red") LocalFloatRef red, @Share("green") LocalFloatRef green, @Share("blue") LocalFloatRef blue) { - int l = block.colorMultiplier(this.blockAccess, x, y, z); + int l = BiomeVertexBlender.isRendering() ? 0xFFFFFF : block.colorMultiplier(this.blockAccess, x, y, z); red.set((float) (l >> 16 & 255) / 255.0F); blue.set((float) (l >> 8 & 255) / 255.0F); green.set((float) (l & 255) / 255.0F); diff --git a/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/rendering/MixinTessellator.java b/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/rendering/MixinTessellator.java index 4220c3cae..acb82de31 100644 --- a/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/rendering/MixinTessellator.java +++ b/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/rendering/MixinTessellator.java @@ -18,6 +18,9 @@ public class MixinTessellator implements StateAwareTessellator, BiomeBlendTessel @Unique private BiomeVertexBlender angelica$biomeBlender; + @Unique + private BiomeVertexBlender angelica$liquidBlender; + @Override public BiomeVertexBlender angelica$getBiomeBlender() { return angelica$biomeBlender; @@ -26,11 +29,12 @@ public class MixinTessellator implements StateAwareTessellator, BiomeBlendTessel @Override public void angelica$setBiomeBlender(BiomeVertexBlender blender) { angelica$biomeBlender = blender; + angelica$liquidBlender = blender != null && blender.isWater() ? blender : null; } @ModifyExpressionValue(method = "addVertex", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/Tessellator;color:I")) private int angelica$blendVertexColor(int original, @Local(argsOnly = true, ordinal = 0) double x, @Local(argsOnly = true, ordinal = 1) double y, @Local(argsOnly = true, ordinal = 2) double z) { - return angelica$biomeBlender == null ? original : angelica$biomeBlender.tint(original, x, y, z); + return angelica$liquidBlender == null ? original : angelica$liquidBlender.tint(original, x, y, z); } @Unique