Пример #1
0
    def save_to_packet(self):
        """
        Generate a chunk packet.
        """

        array = [chr(i) for i in self.blocks]
        array += pack_nibbles(self.metadata)
        array += pack_nibbles(self.lightmap)
        array += pack_nibbles(self.skylight)
        packet = make_packet("chunk", x=self.x * 16, y=0, z=self.z * 16,
            x_size=15, y_size=127, z_size=15, data="".join(array))
        return packet
Пример #2
0
    def save_to_tag(self):
        level = TAG_Compound()

        level["Blocks"] = TAG_Byte_Array()
        level["HeightMap"] = TAG_Byte_Array()
        level["BlockLight"] = TAG_Byte_Array()
        level["Data"] = TAG_Byte_Array()
        level["SkyLight"] = TAG_Byte_Array()

        level["Blocks"].value = "".join(chr(i) for i in self.blocks)
        level["HeightMap"].value = "".join(chr(i) for i in self.heightmap)
        level["BlockLight"].value = "".join(pack_nibbles(self.lightmap))
        level["Data"].value = "".join(pack_nibbles(self.metadata))
        level["SkyLight"].value = "".join(pack_nibbles(self.skylight))

        level["TerrainPopulated"] = TAG_Byte(self.populated)

        self.tag["Level"] = level