From b430f922b65f8467ea7fff3b8db0f9a2126fb24f Mon Sep 17 00:00:00 2001 From: Hanke Chen Date: Sat, 12 Jul 2025 20:44:05 -0400 Subject: [PATCH] :bug: fix waterlogged z-fighting --- src/render/SpecialRenderer.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/render/SpecialRenderer.ts b/src/render/SpecialRenderer.ts index 5e0fec9a..5159feae 100644 --- a/src/render/SpecialRenderer.ts +++ b/src/render/SpecialRenderer.ts @@ -11,6 +11,11 @@ import { Mesh } from './Mesh.js' import type { TextureAtlasProvider } from './TextureAtlas.js' function liquidRenderer(type: string, level: number, atlas: TextureAtlasProvider, cull: Cull, tintindex?: number) { + const transformation = mat4.create() + mat4.translate(transformation, transformation, [8, 8, 8]) + mat4.scale(transformation, transformation, [0.999, 0.999, 0.999]) + mat4.translate(transformation, transformation, [-8, -8, -8]) + const y = cull['up'] ? 16 : [14.2, 12.5, 10.5, 9, 7, 5.3, 3.7, 1.9, 16, 16, 16, 16, 16, 16, 16, 16][level] return new BlockModel(undefined, { still: `block/${type}_still`, @@ -26,7 +31,7 @@ function liquidRenderer(type: string, level: number, atlas: TextureAtlasProvider south: { texture: '#flow', tintindex, cullface: Direction.SOUTH }, west: { texture: '#flow', tintindex, cullface: Direction.WEST }, }, - }]).getMesh(atlas, cull, BlockColors[type]?.({})) + }]).getMesh(atlas, cull, BlockColors[type]?.({})).transform(transformation) } const DyeColors: Record = {