0

biome: fix biomes for chunks at Y=16

Okay so you know how you have chunks and they map to 4 levels of biomes?
Logically you'd go hmmmm, let's just map 4 Y levels to one biome level.
Except there aren't 16 chunk heights, there are about 17 if you count
Y=16 (which can contain data), but there's also -1 technically but I've
never seen this have data in an NBT structure I don't think.

Anyway, let's just hope we're doing the right thing by giving Y=16 the
same biome as Y=15. If someone wants to check whether that is actually
correct please feel free to, but for now it's better than crashing at
the very least.

Would be nice if we had a spec for these kinds of things.

Fixes #1685.
This commit is contained in:
Nicolas F
2019-12-11 19:15:56 +01:00
parent 37ad13dba7
commit 64edf65aa5

View File

@@ -35,4 +35,7 @@ class BiomeDispensary:
if self.biome_len == 256 or y_level < 0: if self.biome_len == 256 or y_level < 0:
return self.biomes[0] return self.biomes[0]
else: else:
return self.biomes[y_level // 4] # We clamp the value to a max of 3 here because apparently Y=16
# also exists, and while I don't know what biome level Mojang uses for
# that, the highest one is probably a good bet.
return self.biomes[min(y_level // 4, 3)]