fix ArrayOutOufBoundsException when 3d biomes are supported in 19w36a+

This commit is contained in:
Bixilon 2021-04-09 01:02:10 +02:00
parent b72f40e01a
commit e5e71bf1cb
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -20,7 +20,7 @@ import glm_.vec3.Vec3i
class SpatialBiomeArray(private val data: Array<Biome>) : BiomeSource {
override fun getBiome(position: Vec3i): Biome {
val index = (MMath.clamp(position.y, 0, Y_BIT_MASK)) shl 2 * X_SECTION_COUNT + X_SECTION_COUNT or
val index = (MMath.clamp(position.y, 0, Y_BIT_MASK)) shl X_SECTION_COUNT + X_SECTION_COUNT or
((position.z and X_BIT_MASK) shl X_SECTION_COUNT) or
(position.x and X_BIT_MASK)