Class BlockPattern
java.lang.Object
net.minecraft.world.level.block.state.pattern.BlockPattern
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
static class
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic com.google.common.cache.LoadingCache
<BlockPos, BlockInWorld> createLevelCache
(LevelReader p_61188_, boolean p_61189_) find
(LevelReader pLevel, BlockPos pPos) Calculates whether the given world position matches the pattern.int
getDepth()
int
Predicate<BlockInWorld>[][][]
int
getWidth()
private BlockPattern.BlockPatternMatch
matches
(BlockPos p_61198_, Direction p_61199_, Direction p_61200_, com.google.common.cache.LoadingCache<BlockPos, BlockInWorld> p_61201_) matches
(LevelReader pLevel, BlockPos pPos, Direction pFinger, Direction pThumb) protected static BlockPos
translateAndRotate
(BlockPos pPos, Direction pFinger, Direction pThumb, int pPalmOffset, int pThumbOffset, int pFingerOffset) Offsets the position of pos in the direction of finger and thumb facing by offset amounts, follows the right-hand rule for cross products (finger, thumb, palm)
-
Field Details
-
pattern
-
depth
private final int depth -
height
private final int height -
width
private final int width
-
-
Constructor Details
-
BlockPattern
-
-
Method Details
-
getDepth
public int getDepth() -
getHeight
public int getHeight() -
getWidth
public int getWidth() -
getPattern
-
matches
@Nullable public BlockPattern.BlockPatternMatch matches(LevelReader pLevel, BlockPos pPos, Direction pFinger, Direction pThumb) -
matches
@Nullable private BlockPattern.BlockPatternMatch matches(BlockPos p_61198_, Direction p_61199_, Direction p_61200_, com.google.common.cache.LoadingCache<BlockPos, BlockInWorld> p_61201_) -
find
Calculates whether the given world position matches the pattern. Warning, fairly heavy function.- Returns:
- a BlockPatternMatch if found, null otherwise.
-
createLevelCache
public static com.google.common.cache.LoadingCache<BlockPos,BlockInWorld> createLevelCache(LevelReader p_61188_, boolean p_61189_) -
translateAndRotate
protected static BlockPos translateAndRotate(BlockPos pPos, Direction pFinger, Direction pThumb, int pPalmOffset, int pThumbOffset, int pFingerOffset) Offsets the position of pos in the direction of finger and thumb facing by offset amounts, follows the right-hand rule for cross products (finger, thumb, palm)- Returns:
- a new BlockPos offset in the facing directions
-