From ceb2561d83436106e93befe95bbebc3e2be4465a Mon Sep 17 00:00:00 2001 From: Moritz Zwerger Date: Fri, 8 Dec 2023 07:46:31 +0100 Subject: [PATCH] fluid tint: only query biome if needed That should speed up lava rendering a lot, because the biome is on demand and needs to get calculated even though it is never needed. --- .../de/bixilon/minosoft/gui/rendering/tint/TintManager.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/bixilon/minosoft/gui/rendering/tint/TintManager.kt b/src/main/java/de/bixilon/minosoft/gui/rendering/tint/TintManager.kt index 6efc4d921..a1d4d8601 100644 --- a/src/main/java/de/bixilon/minosoft/gui/rendering/tint/TintManager.kt +++ b/src/main/java/de/bixilon/minosoft/gui/rendering/tint/TintManager.kt @@ -61,7 +61,8 @@ class TintManager(val connection: PlayConnection) { fun getParticleTint(state: BlockState, x: Int, y: Int, z: Int): Int? { if (state.block !is TintedBlock) return null val tintProvider = state.block.tintProvider ?: return null - // TODO: cache chunk + + // TODO: cache chunk of particle val biome = connection.world.biomes.getBiome(x, y, z) return tintProvider.getParticleColor(state, biome, x, y, z) } @@ -71,8 +72,9 @@ class TintManager(val connection: PlayConnection) { } fun getFluidTint(chunk: Chunk, fluid: Fluid, height: Float, x: Int, y: Int, z: Int): Int? { + val provider = fluid.model?.tint ?: return null val biome = chunk.getBiome(x and 0x0F, y, z and 0x0F) - return fluid.model?.tint?.getFluidTint(fluid, biome, height, x, y, z) + return provider.getFluidTint(fluid, biome, height, x, y, z) } fun getItemTint(stack: ItemStack): IntArray? {