Ejemplo n.º 1
0
    def put_chunk(self, chunk: Chunk, dimension: Dimension):
        """
        Add a given chunk to the chunk manager.

        :param chunk: The :class:`Chunk` to add to the chunk manager. It will be added at the location stored in :attr:`Chunk.coordinates`
        :param dimension: The dimension to add the chunk to.
        """
        chunk.block_palette = self.level.block_palette
        chunk.biome_palette = self.level.biome_palette
        self._put_entry((dimension, chunk.cx, chunk.cz), chunk)
Ejemplo n.º 2
0
    def _decode_biome_sections(self, chunk: Chunk,
                               chunk_sections: Dict[int, TAG_Compound]):
        biomes: Dict[int, numpy.ndarray] = {}
        palette = BiomeManager()

        for cy, section in chunk_sections.items():
            data = self._decode_biome_section(section)
            if data is not None:
                arr, section_palette = data
                lut = numpy.array([
                    palette.get_add_biome(biome) for biome in section_palette
                ])
                biomes[cy] = lut[arr].astype(numpy.uint32)

        chunk.biomes = biomes
        chunk.biome_palette = palette
Ejemplo n.º 3
0
 def put_chunk(self, chunk: Chunk, dimension: Dimension):
     """Add a chunk to the universal world database"""
     chunk.changed = True
     chunk.block_palette = self._block_palette
     chunk.biome_palette = self._biome_palette
     self._chunk_cache[(dimension, chunk.cx, chunk.cz)] = chunk
Ejemplo n.º 4
0
 def put_chunk(self, chunk: Chunk, dimension: Dimension):
     """Add a chunk to the universal world database"""
     chunk.block_palette = self.world.block_palette
     chunk.biome_palette = self.world.biome_palette
     self._put_entry((dimension, chunk.cx, chunk.cz), chunk)