From 64edf65aa58d89f293a78b4df324fee6920ab07f Mon Sep 17 00:00:00 2001 From: Nicolas F Date: Wed, 11 Dec 2019 19:15:56 +0100 Subject: [PATCH] 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. --- overviewer_core/biome.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/overviewer_core/biome.py b/overviewer_core/biome.py index 510b1b3..62bdeed 100644 --- a/overviewer_core/biome.py +++ b/overviewer_core/biome.py @@ -35,4 +35,7 @@ class BiomeDispensary: if self.biome_len == 256 or y_level < 0: return self.biomes[0] 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)]