Package alexiil.mc.lib.attributes
Interface BlockEntityAttributeAdder<AT,BE>
- Type Parameters:
AT
- The attribute type.BE
- The BlockEntity target type. (This doesn't extendBlockEntity
so 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
BlockEntity
s 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 class
BlockEntityAttributeAdder.BeAdderBase<AT,BE>
Base class forBlockEntityAttributeAdder.BlockEntityAttributeAdderFN
conversions.static interface
BlockEntityAttributeAdder.BlockEntityAttributeAdderFN<AT,BE>
FunctionalInterface
version ofBlockEntityAttributeAdder
. -
Method Summary
Modifier and Type Method Description void
addAll(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 fullBlockEntityAttributeAdder
from theFunctionalInterface
variant, but only allows targetingBlockEntity
directly.static <AT, BE> BlockEntityAttributeAdder<AT,BE>
ofTyped(java.lang.Class<BE> clazz, BlockEntityAttributeAdder.BlockEntityAttributeAdderFN<AT,BE> fn)
Creates a fullBlockEntityAttributeAdder
from theFunctionalInterface
variant, and aClass
to 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
Class
for theBlockEntity
. This doesn't extendBlockEntity
so 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 fullBlockEntityAttributeAdder
from theFunctionalInterface
variant, but only allows targetingBlockEntity
directly. -
ofTyped
static <AT, BE> BlockEntityAttributeAdder<AT,BE> ofTyped(java.lang.Class<BE> clazz, BlockEntityAttributeAdder.BlockEntityAttributeAdderFN<AT,BE> fn)Creates a fullBlockEntityAttributeAdder
from theFunctionalInterface
variant, and aClass
to target.
-