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  

    Fields inherited from class alexiil.mc.lib.attributes.AbstractAttributeList

    attribute, list
  • 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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 the searchParam 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 of getSearchDirection(), otherwise this will be null.
    • add

      public void add​(T object)
      Directly adds the given object to this list.
      Parameters:
      object - The object to add.
    • add

      public void add​(T object, @Nullable CacheInfo cacheInfo)
      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

      public void add​(T object, @Nullable net.minecraft.util.shape.VoxelShape shape)
      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 current AbstractAttributeList.attribute (and it cannot be converted into it) then this will not affect this list.
      Parameters:
      object - The object to offer, which may implement Convertible if it can be converted into many different forms.
    • offer

      public void offer​(java.lang.Object object, @Nullable CacheInfo cacheInfo)
      Offers the given object to this list. If the given object is not an instance of the current AbstractAttributeList.attribute (and it cannot be converted into it) then this will not affect this list.
      Parameters:
      object - The object to offer, which may implement Convertible 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 current AbstractAttributeList.attribute (and it cannot be converted into it) then this will not affect this list.
      Parameters:
      object - The object to offer, which may implement Convertible 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 current AbstractAttributeList.attribute (and it cannot be converted into it) then this will not affect this list.
      Parameters:
      object - The object to offer, which may implement Convertible 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 small VoxelShape 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

      public CacheInfo getCacheInfo​(int index)
    • 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 - if getSearchDirection() 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 to add(Object) and it's variants). Note that this doesn't count calls to offer(Object) (and it's variants) that don't add any attributes.
    • combine

      @Nonnull public T combine​(AttributeList<T> after, CombinableAttribute<T> combinable)
      Returns:
      A combined version of this list and then the second given list, or the attribute's default value if both lists are empty.