From e7c9a2c49e332fa185aea1fb77a5afeaba2ef511 Mon Sep 17 00:00:00 2001 From: Nicolas F Date: Mon, 23 Dec 2019 18:31:30 +0100 Subject: [PATCH] biome: fix biome reading code Fixes #1696. --- overviewer_core/biome.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/overviewer_core/biome.py b/overviewer_core/biome.py index 62bdeed..7a900ed 100644 --- a/overviewer_core/biome.py +++ b/overviewer_core/biome.py @@ -26,10 +26,13 @@ class BiomeDispensary: self.biomes = [biome_array.reshape((16, 16))] elif self.biome_len == 1024: self.biomes = [None] * 4 + # Each value in the biome array actually stands for 4 blocks, so we take the + # Kronecker product of it to "scale" it into its full size of 4096 entries + krond = numpy.kron(biome_array, numpy.ones((4))) for i in range(0, 4): - # Map 256 values of the array to each self.biomes entry, resulting - # in 4 entries - self.biomes[i] = biome_array[i * 256:(i + 1) * 256].reshape((16, 16)) + # Now we can divide it into 16x16 slices + self.biomes[i] = krond[i * 256:(i + 1) * 256].reshape((16, 16)) + def get_biome(self, y_level): if self.biome_len == 256 or y_level < 0: