Skip to content

Instantly share code, notes, and snippets.

@MostAwesomeDude
Created January 6, 2011 01:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MostAwesomeDude/767337 to your computer and use it in GitHub Desktop.
Save MostAwesomeDude/767337 to your computer and use it in GitHub Desktop.
def save_to_packet(self):
"""
Generate a chunk packet.
"""
array = [chr(i) for i in self.blocks.ravel()]
array += pack_nibbles(self.metadata)
array += pack_nibbles(self.skylight)
array += pack_nibbles(self.lightmap)
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment