Skip to content
This repository has been archived by the owner on May 8, 2023. It is now read-only.

Commit

Permalink
Chunk.stream_chunk
Browse files Browse the repository at this point in the history
  • Loading branch information
matcool committed Aug 24, 2020
1 parent a59532d commit 9c72566
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions anvil/chunk.py
Expand Up @@ -262,6 +262,20 @@ def stream_blocks(self, index: int=0, section: Union[int, nbt.TAG_Compound]=None
index += 1
data >>= bits
data_len -= bits

def stream_chunk(self, index: int=0, section: Union[int, nbt.TAG_Compound]=None) -> Generator[Block, None, None]:
"""
Returns a generator for all the blocks in the chunk
This is a helper function that runs Chunk.stream_blocks from section 0 to 15
Yields
------
:class:`anvil.Block`
"""
for section in range(16):
for block in self.stream_blocks(section=section):
yield block

@classmethod
def from_region(cls, region: Union[str, Region], chunkX: int, chunkZ: int):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name='anvil-parser',
version='0.6.4',
version='0.7.0',
author='mat',
description='A Minecraft anvil file format parser',
long_description=long_description,
Expand Down

0 comments on commit 9c72566

Please sign in to comment.