Skip to content

Commit

Permalink
change COMPRESSION_NONE to 3, per wiki. Fix #8
Browse files Browse the repository at this point in the history
  • Loading branch information
MestreLion committed Oct 8, 2021
1 parent 1b6879f commit 5166634
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mcworldlib/anvil.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@
CHUNK_HEADER = struct.Struct(CHUNK_HEADER_FMT)

# Could be an Enum, but not worth it
COMPRESSION_NONE = 0 # Not in spec
COMPRESSION_GZIP = 1 # GZip (RFC1952) (unused in practice)
COMPRESSION_ZLIB = 2 # Zlib (RFC1950)
COMPRESSION_NONE = 3 # Uncompressed. Mentioned in the wiki, unused in practice
COMPRESSION_TYPES = (
# COMPRESSION_NONE is intentionally not in this list
COMPRESSION_GZIP,
COMPRESSION_ZLIB,
COMPRESSION_NONE,
)

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -353,14 +353,14 @@ class RegionChunk(chunk.Chunk):
'dirty',
)
compress = {
COMPRESSION_NONE: lambda _: _,
COMPRESSION_GZIP: gzip.compress,
COMPRESSION_ZLIB: zlib.compress,
COMPRESSION_NONE: lambda _: _,
}
decompress = {
COMPRESSION_NONE: lambda _: _,
COMPRESSION_GZIP: gzip.decompress,
COMPRESSION_ZLIB: zlib.decompress,
COMPRESSION_NONE: lambda _: _,
}

def __init__(self, *args, **tags):
Expand All @@ -371,7 +371,7 @@ def __init__(self, *args, **tags):
self.offset: int = 0 # Set by AnvilFile.parse()
self.sector_count: int = 0
self.timestamp: int = 0 # Also set by AnvilFile.parse()
self.compression: int = COMPRESSION_NONE # = 0
self.compression: int = COMPRESSION_ZLIB # Minecraft default
self.external: bool = False # MCC files
self.dirty: bool = True # For now

Expand Down

0 comments on commit 5166634

Please sign in to comment.