Package alexiil.mc.lib.attributes
Interface BlockEntityAttributeAdder<AT,BE>
- Type Parameters:
AT- The attribute type.BE- The BlockEntity target type. (This doesn't extendBlockEntityso you can target interfaces that block entities may implement).
- All Known Implementing Classes:
BlockEntityAttributeAdder.BeAdderBase
public interface BlockEntityAttributeAdder<AT,BE>
Base interface to add attributes for
BlockEntitys that you haven't defined.
There is an additional FunctionalInterface variant of this: BlockEntityAttributeAdder.BlockEntityAttributeAdderFN.
Implementations must be registered to Attribute in order to be used, in any of these methods:
-
Attribute.addBlockEntityPredicateAdder(AttributeSourceType, boolean, Predicate, BlockEntityAttributeAdderFN). Attribute.putBlockEntityClassAdder(AttributeSourceType, Class, boolean, BlockEntityAttributeAdderFN)Attribute.setBlockEntityAdder(AttributeSourceType, BlockEntityType, BlockEntityAttributeAdder)-
Attribute.setBlockEntityAdder(AttributeSourceType, BlockEntityType, Class, BlockEntityAttributeAdderFN) Attribute.setBlockEntityAdderFN(AttributeSourceType, BlockEntityType, BlockEntityAttributeAdderFN)
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classBlockEntityAttributeAdder.BeAdderBase<AT,BE>Base class forBlockEntityAttributeAdder.BlockEntityAttributeAdderFNconversions.static interfaceBlockEntityAttributeAdder.BlockEntityAttributeAdderFN<AT,BE>FunctionalInterfaceversion ofBlockEntityAttributeAdder. -
Method Summary
Modifier and Type Method Description voidaddAll(BE blockEntity, AttributeList<AT> to)Adds every attribute instance to the given list that the block entity itself cannot be expected to add support for.java.lang.Class<BE>getBlockEntityClass()static <AT> BlockEntityAttributeAdder<AT,net.minecraft.block.entity.BlockEntity>ofBasic(BlockEntityAttributeAdder.BlockEntityAttributeAdderFN<AT,net.minecraft.block.entity.BlockEntity> fn)Creates a fullBlockEntityAttributeAdderfrom theFunctionalInterfacevariant, but only allows targetingBlockEntitydirectly.static <AT, BE> BlockEntityAttributeAdder<AT,BE>ofTyped(java.lang.Class<BE> clazz, BlockEntityAttributeAdder.BlockEntityAttributeAdderFN<AT,BE> fn)Creates a fullBlockEntityAttributeAdderfrom theFunctionalInterfacevariant, and aClassto target.
-
Method Details
-
addAll
Adds every attribute instance to the given list that the block entity itself cannot be expected to add support for. -
getBlockEntityClass
java.lang.Class<BE> getBlockEntityClass()- Returns:
- The target
Classfor theBlockEntity. This doesn't extendBlockEntityso you can target interfaces that block entities may implement).
-
ofBasic
static <AT> BlockEntityAttributeAdder<AT,net.minecraft.block.entity.BlockEntity> ofBasic(BlockEntityAttributeAdder.BlockEntityAttributeAdderFN<AT,net.minecraft.block.entity.BlockEntity> fn)Creates a fullBlockEntityAttributeAdderfrom theFunctionalInterfacevariant, but only allows targetingBlockEntitydirectly. -
ofTyped
static <AT, BE> BlockEntityAttributeAdder<AT,BE> ofTyped(java.lang.Class<BE> clazz, BlockEntityAttributeAdder.BlockEntityAttributeAdderFN<AT,BE> fn)Creates a fullBlockEntityAttributeAdderfrom theFunctionalInterfacevariant, and aClassto target.
-