Package alexiil.mc.lib.attributes
Class SearchOptions
java.lang.Object
alexiil.mc.lib.attributes.SearchOptions
public final class SearchOptions
extends java.lang.Object
Various methods for creating
SearchOption
instances.-
Field Summary
Fields Modifier and Type Field Description static SearchOption<java.lang.Object>
ALL
ASearchOption
that has no constraints, and will get every attribute instance that is obtainable without a direction. -
Method Summary
Modifier and Type Method Description static SearchOptionDirectional<java.lang.Object>
inDirection(net.minecraft.util.math.Direction direction)
static SearchOptionDirectionalVoxel<java.lang.Object>
inDirectionalVoxel(net.minecraft.util.math.Direction direction, net.minecraft.util.shape.VoxelShape shape)
static <T> SearchOptionDirectionalVoxel<T>
inDirectionalVoxelMatching(net.minecraft.util.math.Direction direction, net.minecraft.util.shape.VoxelShape shape, java.util.function.Predicate<T> matcher)
static <T> SearchOptionDirectional<T>
inDirectionMatching(net.minecraft.util.math.Direction direction, java.util.function.Predicate<T> matcher)
static SearchOptionDirectionalVoxel<java.lang.Object>
inOrderedDirectionalVoxel(net.minecraft.util.math.Direction direction, net.minecraft.util.shape.VoxelShape shape)
static <T> SearchOptionDirectionalVoxel<T>
inOrderedDirectionalVoxelMatching(net.minecraft.util.math.Direction direction, net.minecraft.util.shape.VoxelShape shape, java.util.function.Predicate<T> matcher)
static SearchOptionInVoxel<java.lang.Object>
inVoxel(net.minecraft.util.shape.VoxelShape shape)
static <T> SearchOptionInVoxel<T>
inVoxelMatching(net.minecraft.util.shape.VoxelShape shape, java.util.function.Predicate<T> matcher)
static <T> SearchOption<T>
matching(java.util.function.Predicate<T> matcher)
-
Field Details
-
ALL
ASearchOption
that has no constraints, and will get every attribute instance that is obtainable without a direction. Note that you should never need to use this directly as every attribute getter method (likeAttribute.getAll(World, BlockPos, SearchOption)
) will use this if null is passed.
-
-
Method Details
-
matching
- Returns:
- A
SearchOption
that will only match attribute instances that pass the givenPredicate
test
.
-
inDirection
public static SearchOptionDirectional<java.lang.Object> inDirection(net.minecraft.util.math.Direction direction)- Parameters:
direction
- The direction to search in - in other words the direction from the block that is searching to the block that is being searched.- Returns:
- A
SearchOption
that will only match attribute instances that offer themselves in the specified direction.
-
inDirectionMatching
public static <T> SearchOptionDirectional<T> inDirectionMatching(net.minecraft.util.math.Direction direction, java.util.function.Predicate<T> matcher)- Parameters:
direction
- The direction to search in - in other words the direction from the block that is searching to the block that is being searched.- Returns:
- A
SearchOption
that will only match attribute instances that offer themselves in the specified direction, and which pass the givenPredicate
test
.
-
inVoxel
public static SearchOptionInVoxel<java.lang.Object> inVoxel(net.minecraft.util.shape.VoxelShape shape)- Returns:
- A
SearchOption
that will only match attribute instances thatintersect
with the givenVoxelShape
.
-
inVoxelMatching
public static <T> SearchOptionInVoxel<T> inVoxelMatching(net.minecraft.util.shape.VoxelShape shape, java.util.function.Predicate<T> matcher)- Returns:
- A
SearchOption
that will only match attribute instances thatintersect
with the givenVoxelShape
, and and which pass the givenPredicate
test
.
-
inDirectionalVoxel
public static SearchOptionDirectionalVoxel<java.lang.Object> inDirectionalVoxel(net.minecraft.util.math.Direction direction, net.minecraft.util.shape.VoxelShape shape)- Parameters:
direction
- The direction to search in - in other words the direction from the block that is searching to the block that is being searched.- Returns:
- A
SearchOption
that will only match attribute instances that offer themselves in the specified direction, and whichintersect
with the givenVoxelShape
, and and which pass the givenPredicate
test
.
-
inDirectionalVoxelMatching
public static <T> SearchOptionDirectionalVoxel<T> inDirectionalVoxelMatching(net.minecraft.util.math.Direction direction, net.minecraft.util.shape.VoxelShape shape, java.util.function.Predicate<T> matcher)- Parameters:
direction
- The direction to search in - in other words the direction from the block that is searching to the block that is being searched.- Returns:
- A
SearchOption
that will only match attribute instances that:- Offer themselves in the specified direction
Intersect
with the givenVoxelShape
- Pass the given
Predicate
test
, and which
-
inOrderedDirectionalVoxel
public static SearchOptionDirectionalVoxel<java.lang.Object> inOrderedDirectionalVoxel(net.minecraft.util.math.Direction direction, net.minecraft.util.shape.VoxelShape shape)- Parameters:
direction
- The direction to search in - in other words the direction from the block that is searching to the block that is being searched.- Returns:
- A
SearchOption
that will only match attribute instances that offer themselves in the specified direction, and whichintersect
with the givenVoxelShape
, and and which pass the givenPredicate
test
.In addition this will sort the resulting
AttributeList
that are returned from methods likeAttribute.getAll(World, BlockPos, SearchOption)
in the order that theirVoxelShape
will be encountered by the directional search.
-
inOrderedDirectionalVoxelMatching
public static <T> SearchOptionDirectionalVoxel<T> inOrderedDirectionalVoxelMatching(net.minecraft.util.math.Direction direction, net.minecraft.util.shape.VoxelShape shape, java.util.function.Predicate<T> matcher)- Parameters:
direction
- The direction to search in - in other words the direction from the block that is searching to the block that is being searched.- Returns:
- A
SearchOption
that will only match attribute instances that:- Offer themselves in the specified direction
Intersect
with the givenVoxelShape
- Pass the given
Predicate
test
, and which
AttributeList
that are returned from methods likeAttribute.getAll(World, BlockPos, SearchOption)
in the order that theirVoxelShape
will be encountered by the search.
-