Package alexiil.mc.lib.attributes
Class Attribute<T>
java.lang.Object
alexiil.mc.lib.attributes.Attribute<T>
- Direct Known Subclasses:
- DefaultedAttribute
The central holding class for all attribute instances.
 
For convenience there is also a "getAllFromNeighbour" (and getFirstOrNullFromNeighbour) which takes a
 
 
 An Attribute can be of a single Class that should be accessible from blocks or items. Instances can
 be created from the various static factory methods in Attributes. Due to the different subclasses no registry
 is provided, so instances should be stored in a public static final field somewhere near the target class.
 
Usage
All attributes offer "getAll" and "getFirstOrNull" methods.
Blocks
Instances can be obtained from blocks with thegetAll(World, BlockPos, SearchOption) or
 getFirstOrNull(World, BlockPos, SearchOption) methods, although the SearchOption can be omitted (or
 passed as null) if you don't wish to restrict what attributes are returned to you.For convenience there is also a "getAllFromNeighbour" (and getFirstOrNullFromNeighbour) which takes a
BlockEntity to search from, and a Direction to search in.
 
Items
Instances can be obtained from items with thegetAll(Reference, LimitedConsumer, Predicate)
 or getFirstOrNull(Reference, LimitedConsumer, Predicate) methods, however the predicate may be omitted (or
 passed as null) if you f you don't wish to restrict what attributes are returned to you.ItemStacks don't inherently have any information about what they are stored in (unlike blocks) so instead of
 a world and block position we use a Reference for the current stack, and a LimitedConsumer for the
 excess. The Reference may contain an item with any count, although generally only the uppermost item on the
 stack will be used by attributes. Attribute instances which modify the ItemStack are highly encouraged to
 extend AbstractItemBasedAttribute to help manage returning the modified ItemStack to the reference
 and limited consumer.
 
Entities
Currently LBA doesn't offer support for entities, although it is planned.
Subclasses
There are 2 provided subclasses ofAttribute: DefaultedAttribute and
 CombinableAttribute.
 
Custom Adders
If the target block or item doesn't implementAttributeProvider or
 AttributeProviderItem (or those methods don't offer the attribute instance that you need) then you can create
 a custom adder for each block or item that you need. The old (deprecated) method of adding custom attribute adders
 called every single one in the order that they were added. The new method however only matches a single one (per
 attribute), and has the following order:
 - If the block or item implements AttributeProviderorAttributeProviderItemdirectly then is is used first. If that adder didn't add anything then the next steps aren't skipped (so it will exit early if the block/item provided any implementations itself, otherwise it will continue to try to find one).
- If the block state is meant to have a BlockEntity(AbstractBlock.AbstractBlockState.hasBlockEntity()), and aBlockEntityis present in the world, and it implementsAttributeProviderBlockEntitythen it is checked second. If that adder didn't add anything then the next steps aren't skipped (so it will exit early if the block entity provided any implementations itself, otherwise it will continue to try to find one).
- AttributeSourceType.INSTANCEimplementations are considered:- If the block/item has an exact mapping registered in
 setBlockAdder(AttributeSourceType, Block, CustomAttributeAdder)then it is used.
- Next, any predicate adders
 (addBlockPredicateAdder(AttributeSourceType, boolean, Predicate, CustomAttributeAdder)) are considered (if they passed "true" for "specific").
- The exact class mapped by
 (putBlockClassAdder(AttributeSourceType, Class, boolean, CustomAttributeAdder)) is considered (if they passed "false" for "matchSubclasses").
- Any super-classes or interfaces mapped by
 (putBlockClassAdder(AttributeSourceType, Class, boolean, CustomAttributeAdder)) is considered (if they passed "true" for "matchSubclasses").
- Finally, any predicate adders
 (addBlockPredicateAdder(AttributeSourceType, boolean, Predicate, CustomAttributeAdder)) are considered (if they passed "false" for "specific").
 
- If the block/item has an exact mapping registered in
 
- AttributeSourceType.COMPAT_WRAPPERimplementations are considered, in the same order as- AttributeSourceType.INSTANCEabove.
- Finally everything registered to appendBlockAdder(CustomAttributeAdder)is called. (Unlike every other adder above, every single one is called).
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddBlockEntityPredicateAdder(AttributeSourceType sourceType, boolean specific, Predicate<net.minecraft.block.entity.BlockEntityType<?>> filter, BlockEntityAttributeAdder.BlockEntityAttributeAdderFN<T,net.minecraft.block.entity.BlockEntity> adder)Predicate-based block entity attribute adder.voidaddBlockPredicateAdder(AttributeSourceType sourceType, boolean specific, Predicate<net.minecraft.block.Block> filter, CustomAttributeAdder<T> adder)Predicate-based block attribute adder.voidaddItemPredicateAdder(AttributeSourceType sourceType, boolean specific, Predicate<net.minecraft.item.Item> filter, ItemAttributeAdder<T> adder)Predicate-based item attribute adder.appendBlockAdder(CustomAttributeAdder<T> blockAdder)Appends a singleCustomAttributeAdderto the list of custom block adders.voidappendCustomAdder(CustomAttributeAdder<T> customAdder)Deprecated, for removal: This API element is subject to removal in a future version.Provided for backwards compatibility - instead you should useappendBlockAdder(CustomAttributeAdder).appendItemAdder(ItemAttributeAdder<T> itemAdder)Appends a singleItemAttributeAdderto the list of custom item adders.CastsThe given object to type of this attribute.booleanObtains all instances of this attribute in the givenItemStackReference.getAll(Reference<net.minecraft.item.ItemStack> stackRef, LimitedConsumer<net.minecraft.item.ItemStack> excess)Obtains all instances of this attribute in the givenItemStackReference.getAll(Reference<net.minecraft.item.ItemStack> stackRef, LimitedConsumer<net.minecraft.item.ItemStack> excess, Predicate<T> filter)Obtains all instances of this attribute in the givenItemStackReference.Obtains all instances of this attribute in the givenItemStackReference.getAll(net.minecraft.item.ItemStack unmodifiableStack)Obtains all instances of this attribute in the givenItemStackReference.getAll(net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos)getAll(net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos, SearchOption<? super T> searchParam)getAllFromNeighbour(net.minecraft.block.entity.BlockEntity be, net.minecraft.util.math.Direction dir)Shorter method call for the common case of: BlockEntity be = ...; Direction dir = ...; Attribute<T> attr = ...; AttributeList<T> list = attr.getAll(be.getWorld(), be.getPos().offset(dir),SearchOptions.inDirection(dir));getFirstOrNull(Reference<net.minecraft.item.ItemStack> stackRef)Obtains the first instance of this attribute in the givenItemStackReference, or null if none were found.getFirstOrNull(Reference<net.minecraft.item.ItemStack> stackRef, LimitedConsumer<net.minecraft.item.ItemStack> excess)Obtains the first instance of this attribute in the givenItemStackReference, or null if none were found.getFirstOrNull(Reference<net.minecraft.item.ItemStack> stackRef, LimitedConsumer<net.minecraft.item.ItemStack> excess, Predicate<T> filter)Obtains the first instance of this attribute in the givenItemStackReference, or null if none were found.getFirstOrNull(Reference<net.minecraft.item.ItemStack> stackRef, Predicate<T> filter)Obtains the first instance of this attribute in the givenItemStackReference, or null if none were found.getFirstOrNull(net.minecraft.item.ItemStack unmodifiableStack)Obtains the first instance of this attribute in the givenItemStackReference, or null if none were found.getFirstOrNull(net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos)getFirstOrNull(net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos, SearchOption<? super T> searchParam)getFirstOrNullFromNeighbour(net.minecraft.block.entity.BlockEntity be, net.minecraft.util.math.Direction dir)Shorter method call for the common case of: BlockEntity be = ...; Direction dir = ...; Attribute<T> attr = ...; AttributeList<T> list = attr.getAll(be.getWorld(), be.getPos().offset(dir),SearchOptions.inDirection(dir));inthashCode()booleanisInstance(Object obj)Checks to see if the given object is anClass.isInstance(Object)of this attribute.voidputBlockClassAdder(AttributeSourceType sourceType, Class<?> clazz, boolean matchSubclasses, CustomAttributeAdder<T> adder)Class-based block attribute adder.<BE> voidputBlockEntityClassAdder(AttributeSourceType sourceType, Class<BE> clazz, boolean matchSubclasses, BlockEntityAttributeAdder.BlockEntityAttributeAdderFN<T,BE> adder)Class-based block entity attribute adder.voidputItemClassAdder(AttributeSourceType sourceType, Class<?> clazz, boolean matchSubclasses, ItemAttributeAdder<T> adder)Class-based item attribute adder.voidsetBlockAdder(AttributeSourceType sourceType, net.minecraft.block.Block block, CustomAttributeAdder<T> adder)Sets theCustomAttributeAdderfor the given block, which is only used if the block in question doesn't implementAttributeProvider.<BE extends net.minecraft.block.entity.BlockEntity>
 voidsetBlockEntityAdder(AttributeSourceType sourceType, net.minecraft.block.entity.BlockEntityType<BE> type, BlockEntityAttributeAdder<T,BE> adder)Sets theBlockEntityAttributeAdderfor the given block entity type, which is only used if the block entity in question doesn't implementAttributeProviderBlockEntity.<BE extends net.minecraft.block.entity.BlockEntity>
 voidsetBlockEntityAdder(AttributeSourceType sourceType, net.minecraft.block.entity.BlockEntityType<BE> type, Class<BE> clazz, BlockEntityAttributeAdder.BlockEntityAttributeAdderFN<T,BE> adder)Sets theBlockEntityAttributeAdderfor the given block entity type, which is only used if the block entity in question doesn't implementAttributeProviderBlockEntity.voidsetBlockEntityAdderFN(AttributeSourceType sourceType, net.minecraft.block.entity.BlockEntityType<?> type, BlockEntityAttributeAdder.BlockEntityAttributeAdderFN<T,net.minecraft.block.entity.BlockEntity> adder)Sets theBlockEntityAttributeAdderfor the given block entity type, which is only used if the block entity in question doesn't implementAttributeProviderBlockEntity.voidsetItemAdder(AttributeSourceType sourceType, net.minecraft.item.Item item, ItemAttributeAdder<T> adder)Sets theItemAttributeAdderfor the given item, which is only used if the item in question doesn't implementAttributeProviderItem.
- 
Field Details- 
clazz
 
- 
- 
Constructor Details- 
Attribute
- 
Attribute@Deprecated(since="0.5.0", forRemoval=true) protected Attribute(Class<T> clazz, CustomAttributeAdder<T> customAdder)Deprecated, for removal: This API element is subject to removal in a future version.Kept for backwards compatibility, instead you should callAttribute(Class)followed byappendBlockAdder(CustomAttributeAdder).
 
- 
- 
Method Details- 
isInstanceChecks to see if the given object is anClass.isInstance(Object)of this attribute.
- 
castCastsThe given object to type of this attribute.
- 
equals
- 
hashCodepublic final int hashCode()
- 
setBlockAdderpublic final void setBlockAdder(AttributeSourceType sourceType, net.minecraft.block.Block block, CustomAttributeAdder<T> adder)Sets theCustomAttributeAdderfor the given block, which is only used if the block in question doesn't implementAttributeProvider. Only oneCustomAttributeAddermay respond to a singular block.
- 
setBlockEntityAdderpublic final <BE extends net.minecraft.block.entity.BlockEntity> void setBlockEntityAdder(AttributeSourceType sourceType, net.minecraft.block.entity.BlockEntityType<BE> type, BlockEntityAttributeAdder<T,BE> adder)Sets theBlockEntityAttributeAdderfor the given block entity type, which is only used if the block entity in question doesn't implementAttributeProviderBlockEntity. Only oneBlockEntityAttributeAddermay respond to a singular block.
- 
setBlockEntityAdderpublic final <BE extends net.minecraft.block.entity.BlockEntity> void setBlockEntityAdder(AttributeSourceType sourceType, net.minecraft.block.entity.BlockEntityType<BE> type, Class<BE> clazz, BlockEntityAttributeAdder.BlockEntityAttributeAdderFN<T,BE> adder)Sets theBlockEntityAttributeAdderfor the given block entity type, which is only used if the block entity in question doesn't implementAttributeProviderBlockEntity. Only oneBlockEntityAttributeAddermay respond to a singular block.
- 
setBlockEntityAdderFNpublic final void setBlockEntityAdderFN(AttributeSourceType sourceType, net.minecraft.block.entity.BlockEntityType<?> type, BlockEntityAttributeAdder.BlockEntityAttributeAdderFN<T,net.minecraft.block.entity.BlockEntity> adder)Sets theBlockEntityAttributeAdderfor the given block entity type, which is only used if the block entity in question doesn't implementAttributeProviderBlockEntity. Only oneBlockEntityAttributeAddermay respond to a singular block.
- 
setItemAdderpublic final void setItemAdder(AttributeSourceType sourceType, net.minecraft.item.Item item, ItemAttributeAdder<T> adder)Sets theItemAttributeAdderfor the given item, which is only used if the item in question doesn't implementAttributeProviderItem. Only oneCustomAttributeAddermay respond to a singular item.
- 
addBlockPredicateAdderpublic final void addBlockPredicateAdder(AttributeSourceType sourceType, boolean specific, Predicate<net.minecraft.block.Block> filter, CustomAttributeAdder<T> adder)Predicate-based block attribute adder. If "specific" is true then these are called directly aftersetBlockAdder(AttributeSourceType, Block, CustomAttributeAdder), otherwise they are called after the class-based mappings have been called.
- 
addBlockEntityPredicateAdderpublic final void addBlockEntityPredicateAdder(AttributeSourceType sourceType, boolean specific, Predicate<net.minecraft.block.entity.BlockEntityType<?>> filter, BlockEntityAttributeAdder.BlockEntityAttributeAdderFN<T,net.minecraft.block.entity.BlockEntity> adder)Predicate-based block entity attribute adder. If "specific" is true then these are called directly aftersetBlockEntityAdder(AttributeSourceType, BlockEntityType, BlockEntityAttributeAdder), otherwise they are called after the class-based mappings have been called.
- 
addItemPredicateAdderpublic final void addItemPredicateAdder(AttributeSourceType sourceType, boolean specific, Predicate<net.minecraft.item.Item> filter, ItemAttributeAdder<T> adder)Predicate-based item attribute adder. If "specific" is true then these are called directly aftersetItemAdder(AttributeSourceType, Item, ItemAttributeAdder), otherwise they are called after the class-based mappings have been called.
- 
putBlockClassAdderpublic final void putBlockClassAdder(AttributeSourceType sourceType, Class<?> clazz, boolean matchSubclasses, CustomAttributeAdder<T> adder)Class-based block attribute adder. If no specific predicate adder has been registered then this checks for an exact class match, and then for a super-type match. Only one adder may be present for any given class.
- 
putBlockEntityClassAdderpublic final <BE> void putBlockEntityClassAdder(AttributeSourceType sourceType, Class<BE> clazz, boolean matchSubclasses, BlockEntityAttributeAdder.BlockEntityAttributeAdderFN<T,BE> adder)Class-based block entity attribute adder. If no specific predicate adder has been registered then this checks for an exact class match, and then for a super-type match. Only one adder may be present for any given class.
- 
putItemClassAdderpublic final void putItemClassAdder(AttributeSourceType sourceType, Class<?> clazz, boolean matchSubclasses, ItemAttributeAdder<T> adder)Class-based item attribute adder. If no specific predicate adder has been registered then this checks for an exact class match, and then for a super-type match.
- 
appendCustomAdder@Deprecated(since="0.5.0", forRemoval=true) public final void appendCustomAdder(CustomAttributeAdder<T> customAdder)Deprecated, for removal: This API element is subject to removal in a future version.Provided for backwards compatibility - instead you should useappendBlockAdder(CustomAttributeAdder).
- 
appendBlockAdderAppends a singleCustomAttributeAdderto the list of custom block adders. These are called only for blocks that don't implementAttributeProvider, or have an existing registration in one of the more specific methods above.- Returns:
- This.
 
- 
appendItemAdderAppends a singleItemAttributeAdderto the list of custom item adders. These are called only for items that don't implementAttributeProviderItem, or have an existing registration in one of the more specific methods above.- Returns:
- This.
 
- 
getAllpublic final AttributeList<T> getAll(net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos)- Returns:
- A complete AttributeListof every attribute instance that can be found.
 
- 
getAllpublic final AttributeList<T> getAll(net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos, SearchOption<? super T> searchParam)- Parameters:
- searchParam- The search parameters to use for accessing instances. Many blocks only offer attributes from a certain direction, which should be provided as a- SearchOptionDirectional. A full list of possible- SearchOption's is in- SearchOptions.
- Returns:
- A complete AttributeListof every attribute instance that can be found with the supplied search parameters.
 
- 
getAllFromNeighbourpublic final AttributeList<T> getAllFromNeighbour(net.minecraft.block.entity.BlockEntity be, net.minecraft.util.math.Direction dir)Shorter method call for the common case of: BlockEntity be = ...; Direction dir = ...; Attribute<T> attr = ...; AttributeList<T> list = attr.getAll(be.getWorld(), be.getPos().offset(dir),SearchOptions.inDirection(dir));
- 
getFirstOrNull@Nullable public final T getFirstOrNull(net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos)- Returns:
- The first attribute instance (as obtained by getAll(World, BlockPos)), or null if this didn't find any instances.
 
- 
getFirstOrNull@Nullable public final T getFirstOrNull(net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos, @Nullable SearchOption<? super T> searchParam)- Parameters:
- searchParam- The search parameters to use for accessing instances. Many blocks only offer attributes from a certain direction, which should be provided as a- SearchOptionDirectional. A full list of possible- SearchOption's is in- SearchOptions.
- Returns:
- The first attribute instance (as obtained by getAll(World, BlockPos, SearchOption)), or null if the search didn't find any attribute instances at the specified position.
 
- 
getFirstOrNullFromNeighbour@Nullable public final T getFirstOrNullFromNeighbour(net.minecraft.block.entity.BlockEntity be, net.minecraft.util.math.Direction dir)Shorter method call for the common case of: BlockEntity be = ...; Direction dir = ...; Attribute<T> attr = ...; AttributeList<T> list = attr.getAll(be.getWorld(), be.getPos().offset(dir),SearchOptions.inDirection(dir));
- 
getAllObtains all instances of this attribute in the givenItemStackReference.This method is just a quicker way of calling getAll(Reference)of a singleItemStackwhich cannot be modified. Internally this creates a newUnmodifiableReffor the reference.- Parameters:
- unmodifiableStack- An- ItemStackthat may not be modified by any of the attribute instances returned.
- Returns:
- A complete AttributeListof every attribute instance that can be found in the givenItemStack.
 
- 
getAllObtains all instances of this attribute in the givenItemStackReference.- Parameters:
- stackRef- A- Referenceto the- ItemStackto be searched. This is a full reference, which may allow any of the returned attribute instances to modify it. (For example if it was in an inventory then changes would be correctly reflected in the backing inventory).
- Returns:
- A complete AttributeListof every attribute instance that can be found in the givenItemStack.
 
- 
getAllpublic final ItemAttributeList<T> getAll(Reference<net.minecraft.item.ItemStack> stackRef, @Nullable Predicate<T> filter)Obtains all instances of this attribute in the givenItemStackReference.- Parameters:
- filter- A- Predicateto test all- offeredobjects before accepting them into the list. A null value equals no filter, which will not block any values.
- Returns:
- A complete AttributeListof every attribute instance that can be found in the givenItemStack.
 
- 
getAllpublic final ItemAttributeList<T> getAll(Reference<net.minecraft.item.ItemStack> stackRef, LimitedConsumer<net.minecraft.item.ItemStack> excess)Obtains all instances of this attribute in the givenItemStackReference.- Parameters:
- stackRef- A- Referenceto the- ItemStackto be searched. This is a full reference, which may allow any of the returned attribute instances to modify it. (For example if it was in an inventory then changes would be correctly reflected in the backing inventory).
- excess- A- LimitedConsumerwhich allows any of the returned attribute instances to spit out excess items in addition to changing the main stack. (As this is a LimitedConsumer rather than a normal consumer it is important to note that excess items items are not guaranteed to be accepted). A null value will default to- LimitedConsumer.rejecting().
- Returns:
- A complete AttributeListof every attribute instance that can be found in the givenItemStack.
 
- 
getAllpublic final ItemAttributeList<T> getAll(Reference<net.minecraft.item.ItemStack> stackRef, LimitedConsumer<net.minecraft.item.ItemStack> excess, @Nullable Predicate<T> filter)Obtains all instances of this attribute in the givenItemStackReference.- Parameters:
- stackRef- A- Referenceto the- ItemStackto be searched. This is a full reference, which may allow any of the returned attribute instances to modify it. (For example if it was in an inventory then changes would be correctly reflected in the backing inventory).
- excess- A- LimitedConsumerwhich allows any of the returned attribute instances to spit out excess items in addition to changing the main stack. (As this is a LimitedConsumer rather than a normal consumer it is important to note that excess items items are not guaranteed to be accepted). A null value will default to- LimitedConsumer.rejecting().
- filter- A- Predicateto test all- offeredobjects before accepting them into the list. A null value equals no filter, which will not block any values.
- Returns:
- A complete AttributeListof every attribute instance that can be found in the givenItemStack.
 
- 
getFirstOrNullObtains the first instance of this attribute in the givenItemStackReference, or null if none were found.This method is just a quicker way of calling getAll(Reference)of a singleItemStackwhich cannot be modified. Internally this creates a newUnmodifiableReffor the reference.- Parameters:
- unmodifiableStack- An- ItemStackthat may not be modified by any of the attribute instances returned.
- Returns:
- The first attribute instance found by getAll(ItemStack), or null if none were found in the givenItemStack.
 
- 
getFirstOrNullObtains the first instance of this attribute in the givenItemStackReference, or null if none were found.- Parameters:
- stackRef- A- Referenceto the- ItemStackto be searched. This is a full reference, which may allow any of the returned attribute instances to modify it. (For example if it was in an inventory then changes would be correctly reflected in the backing inventory).
- Returns:
- The first attribute instance found by getAll(Reference), or null if none were found in the givenItemStack.
 
- 
getFirstOrNull@Nullable public final T getFirstOrNull(Reference<net.minecraft.item.ItemStack> stackRef, @Nullable Predicate<T> filter)Obtains the first instance of this attribute in the givenItemStackReference, or null if none were found.- Parameters:
- filter- A- Predicateto test all- offeredobjects before accepting them into the list. A null value equals no filter, which will not block any values.
- Returns:
- The first attribute instance found by getAll(Reference, Predicate), or null if none were found in the givenItemStack.
 
- 
getFirstOrNull@Nullable public final T getFirstOrNull(Reference<net.minecraft.item.ItemStack> stackRef, LimitedConsumer<net.minecraft.item.ItemStack> excess)Obtains the first instance of this attribute in the givenItemStackReference, or null if none were found.- Parameters:
- stackRef- A- Referenceto the- ItemStackto be searched. This is a full reference, which may allow any of the returned attribute instances to modify it. (For example if it was in an inventory then changes would be correctly reflected in the backing inventory).
- excess- A- LimitedConsumerwhich allows any of the returned attribute instances to spit out excess items in addition to changing the main stack. (As this is a LimitedConsumer rather than a normal consumer it is important to note that excess items items are not guaranteed to be accepted). A null value will default to- LimitedConsumer.rejecting().
- Returns:
- The first attribute instance found by getAll(Reference, LimitedConsumer), or null if none were found in the givenItemStack.
 
- 
getFirstOrNull@Nullable public final T getFirstOrNull(Reference<net.minecraft.item.ItemStack> stackRef, LimitedConsumer<net.minecraft.item.ItemStack> excess, @Nullable Predicate<T> filter)Obtains the first instance of this attribute in the givenItemStackReference, or null if none were found.- Parameters:
- stackRef- A- Referenceto the- ItemStackto be searched. This is a full reference, which may allow any of the returned attribute instances to modify it. (For example if it was in an inventory then changes would be correctly reflected in the backing inventory).
- excess- A- LimitedConsumerwhich allows any of the returned attribute instances to spit out excess items in addition to changing the main stack. (As this is a LimitedConsumer rather than a normal consumer it is important to note that excess items items are not guaranteed to be accepted). A null value will default to- LimitedConsumer.rejecting().
- filter- A- Predicateto test all- offeredobjects before accepting them into the list. A null value equals no filter, which will not block any values.
- Returns:
- The first attribute instance found by getAll(Reference, LimitedConsumer, Predicate), or null if none were found in the givenItemStack.
 
 
- 
Attribute(Class)followed byappendBlockAdder(CustomAttributeAdder).