Class CapabilityConstructorRegistry
java.lang.Object
org.cyclops.cyclopscore.modcompat.capabilities.CapabilityConstructorRegistry
Registry for capabilities created by this mod.
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
class
class
class
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected final ModBase
protected boolean
protected boolean
protected boolean
protected boolean
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected <CK> void
addLoadedCapabilityProvider
(net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent event, CK capabilityKey, ICapabilityTypeGetter<?, ?> constructor) void
bake()
Bakes the registry so that it becomes immutable.protected <CK> void
bakeCapabilityConstructorsSuper
(Collection<org.apache.commons.lang3.tuple.Pair<Class<?>, ICapabilityConstructor<?, ?, ?, CK>>> allInheritableConstructors, List<org.apache.commons.lang3.tuple.Pair<Supplier<CK>, ICapabilityConstructor<?, ?, ?, CK>>> allConstructors) protected void
protected <CK> net.neoforged.neoforge.capabilities.ICapabilityProvider
<?, ?, ?> createProvider
(CK capabilityKey, ICapabilityConstructor<?, ?, ?, CK> capabilityConstructor) protected <CK> net.neoforged.neoforge.capabilities.IBlockCapabilityProvider
<?, ?> createProviderBlock
(CK capabilityKey, IBlockCapabilityConstructor<?, ?, ?, CK> capabilityConstructor) protected ModBase
getMod()
protected <CK> void
onLoad
(List<org.apache.commons.lang3.tuple.Pair<Supplier<CK>, ICapabilityConstructor<?, ?, ?, CK>>> allConstructors, net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent event) <T extends net.minecraft.world.level.block.Block>
voidregisterBlock
(Supplier<T> block, IBlockCapabilityConstructor<?, ?, ?, T> constructor) Register a tile capability constructor.<T extends net.minecraft.world.level.block.entity.BlockEntity>
voidregisterBlockEntity
(Supplier<net.minecraft.world.level.block.entity.BlockEntityType<T>> blockEntityType, ICapabilityConstructor<?, ?, ?, net.minecraft.world.level.block.entity.BlockEntityType<T>> constructor) Register a block entity capability constructor.<T extends net.minecraft.world.entity.Entity>
voidregisterEntity
(Supplier<net.minecraft.world.entity.EntityType<T>> entityType, ICapabilityConstructor<?, ?, ?, ? extends net.minecraft.world.entity.EntityType<T>> constructor) Register an entity capability constructor.void
registerInheritableBlock
(Class<?> clazz, IBlockCapabilityConstructor<?, ?, ?, ?> constructor) Register a block capability constructor with subtype checking.void
registerInheritableBlockEntity
(Class<?> clazz, ICapabilityConstructor<?, ?, ?, ?> constructor) Register a block entity capability constructor with subtype checking.void
registerInheritableItem
(Class<?> clazz, ICapabilityConstructor<?, ?, ?, ?> constructor) Register an item capability constructor with subtype checking.void
registerItem
(Supplier<net.minecraft.world.level.ItemLike> item, ICapabilityConstructor<?, ?, ?, ? extends net.minecraft.world.level.ItemLike> constructor) Register an item capability constructor.void
registerMobCategoryEntity
(net.minecraft.world.entity.MobCategory mobCategory, ICapabilityConstructor<?, ?, ?, ? extends net.minecraft.world.entity.EntityType<? extends net.minecraft.world.entity.Entity>> constructor) Register an entity capability constructor for the given category.
-
Field Details
-
mod
-
baked
protected boolean baked -
registeredBlockEntityEventListener
protected boolean registeredBlockEntityEventListener -
registeredBlockEventListener
protected boolean registeredBlockEventListener -
registeredEntityEventListener
protected boolean registeredEntityEventListener -
registeredItemStackEventListener
protected boolean registeredItemStackEventListener
-
-
Constructor Details
-
CapabilityConstructorRegistry
-
-
Method Details
-
getMod
-
checkNotBaked
protected void checkNotBaked() -
registerBlockEntity
public <T extends net.minecraft.world.level.block.entity.BlockEntity> void registerBlockEntity(Supplier<net.minecraft.world.level.block.entity.BlockEntityType<T>> blockEntityType, ICapabilityConstructor<?, ?, ?, net.minecraft.world.level.block.entity.BlockEntityType<T>> constructor) Register a block entity capability constructor.- Type Parameters:
T
- The tile type.- Parameters:
blockEntityType
- The block entity class.constructor
- The capability constructor.
-
registerBlock
public <T extends net.minecraft.world.level.block.Block> void registerBlock(Supplier<T> block, IBlockCapabilityConstructor<?, ?, ?, T> constructor) Register a tile capability constructor.- Type Parameters:
T
- The tile type.- Parameters:
block
- The block.constructor
- The capability constructor.
-
registerEntity
public <T extends net.minecraft.world.entity.Entity> void registerEntity(Supplier<net.minecraft.world.entity.EntityType<T>> entityType, ICapabilityConstructor<?, ?, ?, ? extends net.minecraft.world.entity.EntityType<T>> constructor) Register an entity capability constructor.- Type Parameters:
T
- The entity type.- Parameters:
entityType
- The entity class.constructor
- The capability constructor.
-
registerItem
public void registerItem(Supplier<net.minecraft.world.level.ItemLike> item, ICapabilityConstructor<?, ?, ?, ? extends net.minecraft.world.level.ItemLike> constructor) Register an item capability constructor.- Parameters:
item
- The item class.constructor
- The capability constructor.
-
registerInheritableBlockEntity
public void registerInheritableBlockEntity(Class<?> clazz, ICapabilityConstructor<?, ?, ?, ?> constructor) Register a block entity capability constructor with subtype checking. Only call this when absolutely required, this will is less efficient than its non-inheritable counterpart.- Parameters:
clazz
- The block entity class, all subtypes will be checked.constructor
- The capability constructor.
-
registerInheritableBlock
public void registerInheritableBlock(Class<?> clazz, IBlockCapabilityConstructor<?, ?, ?, ?> constructor) Register a block capability constructor with subtype checking. Only call this when absolutely required, this will is less efficient than its non-inheritable counterpart.- Parameters:
clazz
- The block class, all subtypes will be checked.constructor
- The capability constructor.
-
registerMobCategoryEntity
public void registerMobCategoryEntity(net.minecraft.world.entity.MobCategory mobCategory, ICapabilityConstructor<?, ?, ?, ? extends net.minecraft.world.entity.EntityType<? extends net.minecraft.world.entity.Entity>> constructor) Register an entity capability constructor for the given category.- Parameters:
mobCategory
- The mob category.constructor
- The capability constructor.
-
registerInheritableItem
Register an item capability constructor with subtype checking. Only call this when absolutely required, this will is less efficient than its non-inheritable counterpart.- Parameters:
clazz
- The tile class, all subtypes will be checked.constructor
- The capability constructor.
-
createProvider
protected <CK> net.neoforged.neoforge.capabilities.ICapabilityProvider<?,?, createProvider?> (CK capabilityKey, ICapabilityConstructor<?, ?, ?, CK> capabilityConstructor) -
createProviderBlock
protected <CK> net.neoforged.neoforge.capabilities.IBlockCapabilityProvider<?,?> createProviderBlock(CK capabilityKey, IBlockCapabilityConstructor<?, ?, ?, CK> capabilityConstructor) -
onLoad
protected <CK> void onLoad(List<org.apache.commons.lang3.tuple.Pair<Supplier<CK>, ICapabilityConstructor<?, ?, ?, CK>>> allConstructors, net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent event) -
addLoadedCapabilityProvider
protected <CK> void addLoadedCapabilityProvider(net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent event, CK capabilityKey, ICapabilityTypeGetter<?, ?> constructor) -
bake
public void bake()Bakes the registry so that it becomes immutable. -
bakeCapabilityConstructorsSuper
protected <CK> void bakeCapabilityConstructorsSuper(Collection<org.apache.commons.lang3.tuple.Pair<Class<?>, ICapabilityConstructor<?, ?, ?, CK>>> allInheritableConstructors, List<org.apache.commons.lang3.tuple.Pair<Supplier<CK>, ICapabilityConstructor<?, ?, ?, CK>>> allConstructors)
-