Skip to content

Commit

Permalink
Change nbt parser to use first class classes
Browse files Browse the repository at this point in the history
  • Loading branch information
DonoA committed Aug 8, 2018
1 parent 69ec49b commit e17b2b5
Show file tree
Hide file tree
Showing 4 changed files with 265 additions and 152 deletions.
3 changes: 1 addition & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@
datalen = int.from_bytes(region.read(4), byteorder='big', signed=False)
compr = region.read(1)
decompressed = zlib.decompress(region.read(datalen))
with open("workrng.nbt", mode="wb") as wrk:
wrk.write(decompressed)
data = nbt.parse_nbt(stream.Stream(decompressed))
# data.print()
chunk = world.Chunk(
data.get("Level").get("xPos").get(),
data.get("Level").get("zPos").get(),
world.Chunk.unpack(data)
)
print(chunk.xpos, chunk.zpos, chunk.get(8, 12, 4).name)
sys.exit(0)
Loading

0 comments on commit e17b2b5

Please sign in to comment.