Package alexiil.mc.lib.attributes
Class AttributeList<T>
java.lang.Object
alexiil.mc.lib.attributes.AbstractAttributeList<T>
alexiil.mc.lib.attributes.AttributeList<T>
public class AttributeList<T> extends AbstractAttributeList<T>
Search result for block attributes.
-
Field Summary
Fields Modifier and Type Field Description SearchOption<? super T>
searchParam
-
Method Summary
Modifier and Type Method Description void
add(T object)
Directly adds the given object to this list.void
add(T object, CacheInfo cacheInfo)
Directly adds the given object to this list.void
add(T object, CacheInfo cacheInfo, net.minecraft.util.shape.VoxelShape shape)
Directly adds the given object to this list.void
add(T object, net.minecraft.util.shape.VoxelShape shape)
Directly adds the given object to this list.T
combine(AttributeList<T> after, CombinableAttribute<T> combinable)
boolean
doesSearchReachEnd()
CacheInfo
getCacheInfo(int index)
int
getOfferedCount()
net.minecraft.util.math.Direction
getSearchDirection()
net.minecraft.util.math.Direction
getTargetSide()
net.minecraft.util.shape.VoxelShape
getVoxelShape(int index)
boolean
hasOfferedAny()
void
obstruct(net.minecraft.util.shape.VoxelShape shape)
Adds an obstruction to the current search.void
offer(java.lang.Object object)
Offers the given object to this list.void
offer(java.lang.Object object, CacheInfo cacheInfo)
Offers the given object to this list.void
offer(java.lang.Object object, CacheInfo cacheInfo, net.minecraft.util.shape.VoxelShape shape)
Offers the given object to this list.void
offer(java.lang.Object object, net.minecraft.util.shape.VoxelShape shape)
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
-
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
public void offer(java.lang.Object object)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
public void offer(java.lang.Object object, @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.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(java.lang.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:
java.lang.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.
-