Package alexiil.mc.lib.attributes
Class AttributeList<T>
java.lang.Object
alexiil.mc.lib.attributes.AbstractAttributeList<T>
alexiil.mc.lib.attributes.AttributeList<T>
Search result for block attributes.
-
Field Summary
Fields inherited from class alexiil.mc.lib.attributes.AbstractAttributeList
attribute, list
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Directly adds the given object to this list.void
Directly adds the given object to this list.void
Directly adds the given object to this list.void
Directly adds the given object to this list.combine(AttributeList<T> after, CombinableAttribute<T> combinable)
boolean
getCacheInfo(int index)
int
net.minecraft.util.math.Direction
net.minecraft.util.math.Direction
net.minecraft.util.shape.VoxelShape
getVoxelShape(int index)
boolean
void
obstruct(net.minecraft.util.shape.VoxelShape shape)
Adds an obstruction to the current search.void
Offers the given object to this list.void
Offers the given object to this list.void
Offers the given object to this list.void
Offers the given object to this list.Methods inherited from class alexiil.mc.lib.attributes.AbstractAttributeList
assertAdding, assertUsing, combine, get, getCount, getFirst, getFirstOrNull
-
Field Details
-
searchParam
-
-
Method Details
-
getSearchDirection
@Nullable public net.minecraft.util.math.Direction getSearchDirection()- Returns:
- The
Direction
that the search is moving in, or null if thesearchParam
doesn't supply one.
-
getTargetSide
@Nullable public net.minecraft.util.math.Direction getTargetSide()- Returns:
- The side of the target block that the search is approaching. If the search option is directional then
this will be
opposite
ofgetSearchDirection()
, otherwise this will be null.
-
add
Directly adds the given object to this list.- Parameters:
object
- The object to add.
-
add
Directly adds the given object to this list.- Parameters:
object
- The object to add.cacheInfo
- The caching information associated with the given object. (As caching hasn't been implemented yet this can always be null).
-
add
Directly adds the given object to this list.- Parameters:
object
- The object to add.shape
- The shape of the given object. If null (or empty) then this will default to the shape of the block that is being checked.
-
add
public void add(T object, @Nullable CacheInfo cacheInfo, @Nullable net.minecraft.util.shape.VoxelShape shape)Directly adds the given object to this list.- Parameters:
object
- The object to add.cacheInfo
- The caching information associated with the given object. (As caching hasn't been implemented yet this can always be null).shape
- The shape of the given object. If null (or empty) then this will default to the shape of the block that is being checked.
-
offer
Offers the given object to this list. If the given object is not an instance of the currentAbstractAttributeList.attribute
(and it cannot beconverted
into it) then this will not affect this list.- Parameters:
object
- The object to offer, which may implementConvertible
if it can be converted into many different forms.
-
offer
Offers the given object to this list. If the given object is not an instance of the currentAbstractAttributeList.attribute
(and it cannot beconverted
into it) then this will not affect this list.- Parameters:
object
- The object to offer, which may implementConvertible
if it can be converted into many different forms.cacheInfo
- The caching information associated with the given object. (As caching hasn't been implemented yet this can always be null).
-
offer
Offers the given object to this list. If the given object is not an instance of the currentAbstractAttributeList.attribute
(and it cannot beconverted
into it) then this will not affect this list.- Parameters:
object
- The object to offer, which may implementConvertible
if it can be converted into many different forms.shape
- The shape of the given object. If null (or empty) then this will default to the shape of the block that is being checked.
-
offer
public void offer(Object object, @Nullable CacheInfo cacheInfo, @Nullable net.minecraft.util.shape.VoxelShape shape)Offers the given object to this list. If the given object is not an instance of the currentAbstractAttributeList.attribute
(and it cannot beconverted
into it) then this will not affect this list.- Parameters:
object
- The object to offer, which may implementConvertible
if it can be converted into many different forms.cacheInfo
- The caching information associated with the given object. (As caching hasn't been implemented yet this can always be null).shape
- The shape of the given object. If null (or empty) then this will default to the shape of the block that is being checked.
-
obstruct
public void obstruct(net.minecraft.util.shape.VoxelShape shape)Adds an obstruction to the current search. For example a buildcraft pipe plug would add a smallVoxelShape
to prevent the neighbouring pipe connecting through it.This only has an effect on the current search if
getSearchDirection()
returns a non-null value. (as otherwise it won't obstruct anything). -
getCacheInfo
-
getVoxelShape
@Nullable public net.minecraft.util.shape.VoxelShape getVoxelShape(int index) -
doesSearchReachEnd
public boolean doesSearchReachEnd()- Returns:
- True if the
obstructions
completely block the search shape at the end of the search. - Throws:
IllegalStateException
- ifgetSearchDirection()
is null.
-
hasOfferedAny
public boolean hasOfferedAny()- Returns:
- True if
getOfferedCount()
is greater than 0.
-
getOfferedCount
public int getOfferedCount()- Returns:
- The number of calls to
add(Object, CacheInfo, VoxelShape)
(including calls toadd(Object)
and it's variants). Note that this doesn't count calls tooffer(Object)
(and it's variants) that don't add any attributes.
-
combine
- Returns:
- A combined version of this list and then the second given list, or the attribute's default value if both lists are empty.
-