Class BlockMatcher

java.lang.Object
net.minecraft.world.level.blockscan.BlockMatcher
Direct Known Subclasses:
BoxBlockMatcher, OrderedBlockMatcher

public abstract class BlockMatcher extends Object
  • Field Details

  • Constructor Details

    • BlockMatcher

      public BlockMatcher(LevelReader levelReader)
  • Method Details

    • filterState

      public BlockMatcher filterState(Predicate<BlockState> predicate)
    • filterPosition

      public BlockMatcher filterPosition(BiPredicate<BlockState, BlockPos> predicate)

      Neo: Filter against the state and position context, after the states are filtered. This is only called for positions that the block state filter did not reject.

      All filters registered using this method are applied in sequence, so only the intersection of all filters are matched.

      The position passed to this method may be mutable; do not modify it or store it directly without first making it immutable.

      For filtering out states without reference to the position, prefer using filterState(Predicate).

      Parameters:
      predicate - a filter based on state and (mutable) position
      Returns:
      this matcher, for chaining
    • atLeastMatched

      public abstract boolean atLeastMatched(int n)
    • atMostMatched

      public boolean atMostMatched(int n)
    • anyMatched

      public boolean anyMatched()
    • anyMatched

      protected boolean anyMatched(Predicate<BlockState> statePredicate)
    • anyMatched

      protected abstract boolean anyMatched(Predicate<BlockState> statePredicate, BiPredicate<BlockState, BlockPos> predicate)
    • noneMatched

      public boolean noneMatched()
    • allMatched

      public boolean allMatched()
    • forEach

      public abstract void forEach(BiConsumer<BlockPos, BlockState> consumer)
    • forEachUntil

      public abstract boolean forEachUntil(BlockStateConsumer consumer)