Class BlockMask

All Implemented Interfaces:
Mask
Direct Known Subclasses:
AirMask, LiquidMask, SolidBlockMask

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

This mask checks for both an exact block type and state value match, respecting fuzzy status of the BlockState.

  • Constructor Details

    • BlockMask

      public BlockMask()
    • BlockMask

      public BlockMask(Extent extent)
    • BlockMask

      public BlockMask(Extent extent, boolean[] ordinals)
    • BlockMask

      @Deprecated public BlockMask(Extent extent, Collection<BaseBlock> blocks)
      Deprecated.
      NBT not supported by this mask
      Create a new block mask.
      Parameters:
      extent - the extent
      blocks - a list of blocks to match
    • BlockMask

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

    • add

      public BlockMask add(Predicate<BlockState> predicate)
    • add

      public BlockMask add(BlockState... states)
    • remove

      public BlockMask remove(BlockState... states)
    • clear

      public BlockMask clear()
    • isEmpty

      public boolean isEmpty()
    • add

      public BlockMask add(BlockType... types)
    • add

      @Deprecated public void add(Collection<BaseBlock> blocks)
      Deprecated.
      NBT not supported by this mask
      Add the given blocks to the list of criteria.
      Parameters:
      blocks - a list of blocks
    • add

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

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

      public boolean test(BlockState state)
      Specified by:
      test in class ABlockMask
    • test

      public boolean test(BlockVector3 vector)
      Description copied from interface: Mask
      Returns true if the criteria is met.
      Specified by:
      test in interface Mask
      Overrides:
      test in class ABlockMask
      Parameters:
      vector - the vector to test
      Returns:
      true if the criteria is met
    • replacesAir

      public boolean replacesAir()
    • tryCombine

      public Mask tryCombine(Mask mask)
      Specified by:
      tryCombine in interface Mask
      Overrides:
      tryCombine in class ABlockMask
    • tryOr

      public Mask tryOr(Mask mask)
      Specified by:
      tryOr in interface Mask
      Overrides:
      tryOr in class ABlockMask
    • 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
    • tryOptimize

      public Mask tryOptimize()
      Description copied from interface: Mask
      Returns null if no optimization took place otherwise a new/same mask
      Returns:
    • inverse

      public Mask inverse()
    • 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