Class BlockTypeMask

All Implemented Interfaces:
Mask

public class BlockTypeMask extends AbstractExtentMask
A mask that checks whether blocks at the given positions are matched by a block in a list.

This mask checks for ONLY the block type. If state should also be checked, use BlockMask.

  • Constructor Details

    • BlockTypeMask

      public BlockTypeMask(Extent extent, @Nonnull Collection<BlockType> blocks)
      Create a new block mask.
      Parameters:
      extent - the extent
      blocks - a list of blocks to match
    • BlockTypeMask

      public BlockTypeMask(Extent extent, @Nonnull BlockType... block)
      Create a new block mask.
      Parameters:
      extent - the extent
      block - an array of blocks to match
  • Method Details

    • add

      public void add(@Nonnull Collection<BlockType> blocks)
      Add the given blocks to the list of criteria.
      Parameters:
      blocks - a list of blocks
    • add

      public void add(@Nonnull BlockType... block)
      Add the given blocks to the list of criteria.
      Parameters:
      block - an array of blocks
    • getBlocks

      public Collection<BlockType> getBlocks()
      Get the list of blocks that are tested with.
      Returns:
      a list of blocks
    • test

      public boolean test(BlockVector3 vector)
      Description copied from interface: Mask
      Returns true if the criteria is met.
      Parameters:
      vector - the vector to test
      Returns:
      true if the criteria is met
    • test

      public boolean test(Extent extent, BlockVector3 vector)
      Specified by:
      test in class AbstractExtentMask
    • replacesAir

      public boolean replacesAir()
    • test

      public boolean test(BlockType block)
    • toMask2D

      @Nullable public Mask2D toMask2D()
      Description copied from interface: Mask
      Get the 2D version of this mask if one exists.
      Returns:
      a 2D mask version or null if this mask can't be 2D
    • copy

      public Mask copy()
      Description copied from interface: Mask
      Returns a copy of the mask. Usually for multi-threaded operation
      Returns:
      a clone of the mask