mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-12 08:58:02 -04:00
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.
This commit is contained in:
parent
0bc7a7bbf6
commit
ceb2561d83
@ -61,7 +61,8 @@ class TintManager(val connection: PlayConnection) {
|
|||||||
fun getParticleTint(state: BlockState, x: Int, y: Int, z: Int): Int? {
|
fun getParticleTint(state: BlockState, x: Int, y: Int, z: Int): Int? {
|
||||||
if (state.block !is TintedBlock) return null
|
if (state.block !is TintedBlock) return null
|
||||||
val tintProvider = state.block.tintProvider ?: 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)
|
val biome = connection.world.biomes.getBiome(x, y, z)
|
||||||
return tintProvider.getParticleColor(state, biome, 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? {
|
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)
|
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? {
|
fun getItemTint(stack: ItemStack): IntArray? {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user