Skip to content

Commit

Permalink
added DirtyColumns array to pocket edition chunks.
Browse files Browse the repository at this point in the history
  • Loading branch information
codewarrior0 committed Dec 3, 2011
1 parent c2f7b93 commit 0a64c23
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions pocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ class PocketChunk(InfdevChunk):
Blocks = Data = SkyLight = BlockLight = None

HeightMap = FakeChunk.HeightMap

Entities = TileEntities = property(lambda self: TAG_List())

dirty = False
Expand All @@ -366,7 +367,8 @@ def __init__(self, cx, cz, data, world):
self.Blocks, data = data[:32768], data[32768:]
self.Data, data = data[:16384], data[16384:]
self.SkyLight, data = data[:16384], data[16384:]
self.BlockLight = data[:16384]
self.BlockLight, data = data[:16384], data[16384:]
self.DirtyColumns = data[:256]

self.unpackChunkData()
self.shapeChunkData()
Expand Down Expand Up @@ -399,7 +401,9 @@ def shapeChunkData(self):
self.SkyLight.shape = (chunkSize, chunkSize, self.world.Height)
self.BlockLight.shape = (chunkSize, chunkSize, self.world.Height)
self.Data.shape = (chunkSize, chunkSize, self.world.Height)

self.DirtyColumns.shape = chunkSize, chunkSize


zeros = "\0" * 256
def _savedData(self):
def packData(dataArray):
Expand All @@ -410,11 +414,13 @@ def packData(dataArray):
data[..., 1] |= data[..., 0]
return array(data[:, :, :, 1])


if self.dirty:
self.DirtyColumns[:] = 16

return "".join([self.Blocks.tostring(),
packData(self.Data).tostring(),
packData(self.SkyLight).tostring(),
packData(self.BlockLight).tostring(),
self.zeros,
self.DirtyColumns.tostring(),
])

0 comments on commit 0a64c23

Please sign in to comment.