Skip to content

Add a way to filter blocks #4

@inxomnyaa

Description

@inxomnyaa

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions