As of now, the blocks() iterator method takes in one parameter: layer (for i.e. waterlogged blocks)
It will always return all blocks in a layer, but one may desire to only get all planks or stone blocks, or even all liquids (still and flowing lava & water). There can also be the opposite case where you want to ignore specific blocks, i.e. air or structure_void.
There are multiple ways to face this:
- Add an additional
filter parameter, taking in a BlockPalette, and another parameter for ignoring unwanted blocks
- A parameter taking in a string. This would allow for having wildcards for metadata. The strings might break due to block or property renames though.
- A parameter taking in a Filter object. This is likely a flexible solution, whilst still easy to use.
- A parameter taking in a
Closure or callable to allow the developer to write their own filters
As of now, the
blocks()iterator method takes in one parameter:layer(for i.e. waterlogged blocks)It will always return all blocks in a layer, but one may desire to only get all
planksorstoneblocks, or even all liquids (still and flowing lava & water). There can also be the opposite case where you want to ignore specific blocks, i.e.airorstructure_void.There are multiple ways to face this:
filterparameter, taking in a BlockPalette, and another parameter for ignoring unwanted blocksClosureorcallableto allow the developer to write their own filters