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
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected final ModBase
protected boolean
protected boolean
protected boolean
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected <K,
V> void addLoadedCapabilityProvider
(net.minecraftforge.event.AttachCapabilitiesEvent<?> event, K keyObject, V valueObject, ICapabilityConstructor<?, ?, ?> constructor) void
bake()
Bakes the registry so that it becomes immutable.protected void
protected <K,
KE, H, HE>
net.minecraftforge.common.capabilities.ICapabilityProvidercreateProvider
(KE hostType, HE host, ICapabilityConstructor<?, K, H> capabilityConstructor) protected ModBase
getMod()
protected <K,
V> void onLoad
(Map<Class<? extends K>, List<ICapabilityConstructor<?, ? extends K, ? extends V>>> allConstructors, Collection<org.apache.commons.lang3.tuple.Pair<Class<?>, ICapabilityConstructor<?, ?, ?>>> allInheritableConstructors, Map<? extends K, List<ICapabilityConstructor<?, ? extends K, ? extends V>>> allInstanceConstructors, K keyObject, V valueObject, net.minecraftforge.event.AttachCapabilitiesEvent<?> event, Class<? extends K> baseClass) protected <T> void
onLoad
(Map<Class<? extends T>, List<ICapabilityConstructor<?, ? extends T, ? extends T>>> allConstructors, Collection<org.apache.commons.lang3.tuple.Pair<Class<?>, ICapabilityConstructor<?, ?, ?>>> allInheritableConstructors, Map<? extends T, List<ICapabilityConstructor<?, ? extends T, ? extends T>>> allInstanceConstructors, T object, net.minecraftforge.event.AttachCapabilitiesEvent<?> event, Class<? extends T> baseClass) <T extends net.minecraft.world.entity.Entity>
voidregisterEntity
(Class<T> clazz, ICapabilityConstructor<?, T, T> constructor) Register an entity capability constructor.<K,
V> void registerInheritableEntity
(Class<K> clazz, ICapabilityConstructor<?, V, V> constructor) Register an entity capability constructor with subtype checking.<T> void
registerInheritableItem
(Class<T> clazz, ICapabilityConstructor<?, ?, ? extends net.minecraft.world.item.ItemStack> constructor) Register an item capability constructor with subtype checking.<K,
V> void registerInheritableTile
(Class<K> clazz, ICapabilityConstructor<?, V, V> constructor) Register a tile capability constructor with subtype checking.<T extends net.minecraft.world.item.Item>
voidregisterItem
(Class<T> clazz, ICapabilityConstructor<?, T, net.minecraft.world.item.ItemStack> constructor) Register an item capability constructor.<T extends net.minecraft.world.item.Item>
voidregisterItem
(Supplier<T> itemSupplier, ICapabilityConstructor<?, T, net.minecraft.world.item.ItemStack> constructor) Register an item capability constructor for the given item instance.protected <T extends net.minecraft.world.item.Item>
voidregisterItemEffective
(Supplier<T> itemSupplier, ICapabilityConstructor<?, T, net.minecraft.world.item.ItemStack> constructor) protected void
<T extends net.minecraft.world.level.block.entity.BlockEntity>
voidregisterTile
(Class<T> clazz, ICapabilityConstructor<?, T, T> constructor) Register a tile capability constructor.protected <K,
V> void removeNullCapabilities
(Map<Class<? extends K>, List<ICapabilityConstructor<?, ? extends K, ? extends V>>> allConstructors, Collection<org.apache.commons.lang3.tuple.Pair<Class<?>, ICapabilityConstructor<?, ?, ?>>> allInheritableConstructors, Map<? extends K, List<ICapabilityConstructor<?, ? extends K, ? extends V>>> allInstanceConstructors)
-
Field Details
-
mod
-
baked
protected boolean baked -
registeredTileEventListener
protected boolean registeredTileEventListener -
registeredEntityEventListener
protected boolean registeredEntityEventListener -
registeredItemStackEventListener
protected boolean registeredItemStackEventListener
-
-
Constructor Details
-
CapabilityConstructorRegistry
-
-
Method Details
-
getMod
-
checkNotBaked
protected void checkNotBaked() -
registerTile
public <T extends net.minecraft.world.level.block.entity.BlockEntity> void registerTile(Class<T> clazz, ICapabilityConstructor<?, T, T> constructor) Register a tile capability constructor.- Type Parameters:
T
- The tile type.- Parameters:
clazz
- The tile class.constructor
- The capability constructor.
-
registerEntity
public <T extends net.minecraft.world.entity.Entity> void registerEntity(Class<T> clazz, ICapabilityConstructor<?, T, T> constructor) Register an entity capability constructor.- Type Parameters:
T
- The entity type.- Parameters:
clazz
- The entity class.constructor
- The capability constructor.
-
registerItem
public <T extends net.minecraft.world.item.Item> void registerItem(Class<T> clazz, ICapabilityConstructor<?, T, net.minecraft.world.item.ItemStack> constructor) Register an item capability constructor.- Type Parameters:
T
- The item type.- Parameters:
clazz
- The item class.constructor
- The capability constructor.
-
registerInheritableTile
public <K,V> void registerInheritableTile(Class<K> clazz, ICapabilityConstructor<?, V, V> constructor) Register a tile capability constructor with subtype checking. Only call this when absolutely required, this will is less efficient than its non-inheritable counterpart.- Type Parameters:
K
- The capability type.V
- The tile type.- Parameters:
clazz
- The tile class, all subtypes will be checked.constructor
- The capability constructor.
-
registerInheritableEntity
public <K,V> void registerInheritableEntity(Class<K> clazz, ICapabilityConstructor<?, V, V> constructor) Register an entity capability constructor with subtype checking. Only call this when absolutely required, this will is less efficient than its non-inheritable counterpart.- Type Parameters:
K
- The capability type.V
- The entity type.- Parameters:
clazz
- The tile class, all subtypes will be checked.constructor
- The capability constructor.
-
registerInheritableItem
public <T> void registerInheritableItem(Class<T> clazz, ICapabilityConstructor<?, ?, ? extends net.minecraft.world.item.ItemStack> constructor) Register an item capability constructor with subtype checking. Only call this when absolutely required, this will is less efficient than its non-inheritable counterpart.- Type Parameters:
T
- The tile type.- Parameters:
clazz
- The tile class, all subtypes will be checked.constructor
- The capability constructor.
-
registerItem
public <T extends net.minecraft.world.item.Item> void registerItem(Supplier<T> itemSupplier, ICapabilityConstructor<?, T, net.minecraft.world.item.ItemStack> constructor) Register an item capability constructor for the given item instance.- Type Parameters:
T
- The tile type.- Parameters:
itemSupplier
- An item supplier.constructor
- The capability constructor.
-
registerItemsEffective
protected void registerItemsEffective() -
registerItemEffective
protected <T extends net.minecraft.world.item.Item> void registerItemEffective(Supplier<T> itemSupplier, ICapabilityConstructor<?, T, net.minecraft.world.item.ItemStack> constructor) -
createProvider
protected <K,KE, net.minecraftforge.common.capabilities.ICapabilityProvider createProviderH, HE> (KE hostType, HE host, ICapabilityConstructor<?, K, H> capabilityConstructor) -
onLoad
protected <T> void onLoad(Map<Class<? extends T>, List<ICapabilityConstructor<?, ? extends T, ? extends T>>> allConstructors, Collection<org.apache.commons.lang3.tuple.Pair<Class<?>, ICapabilityConstructor<?, ?, ?>>> allInheritableConstructors, @Nullable Map<? extends T, List<ICapabilityConstructor<?, ? extends T, ? extends T>>> allInstanceConstructors, T object, net.minecraftforge.event.AttachCapabilitiesEvent<?> event, Class<? extends T> baseClass) -
onLoad
protected <K,V> void onLoad(Map<Class<? extends K>, List<ICapabilityConstructor<?, ? extends K, ? extends V>>> allConstructors, Collection<org.apache.commons.lang3.tuple.Pair<Class<?>, ICapabilityConstructor<?, ?, ?>>> allInheritableConstructors, @Nullable Map<? extends K, List<ICapabilityConstructor<?, ? extends K, ? extends V>>> allInstanceConstructors, K keyObject, V valueObject, net.minecraftforge.event.AttachCapabilitiesEvent<?> event, Class<? extends K> baseClass) -
addLoadedCapabilityProvider
protected <K,V> void addLoadedCapabilityProvider(net.minecraftforge.event.AttachCapabilitiesEvent<?> event, K keyObject, V valueObject, ICapabilityConstructor<?, ?, ?> constructor) -
removeNullCapabilities
protected <K,V> void removeNullCapabilities(Map<Class<? extends K>, List<ICapabilityConstructor<?, ? extends K, ? extends V>>> allConstructors, Collection<org.apache.commons.lang3.tuple.Pair<Class<?>, ICapabilityConstructor<?, ?, ?>>> allInheritableConstructors, @Nullable Map<? extends K, List<ICapabilityConstructor<?, ? extends K, ? extends V>>> allInstanceConstructors) -
bake
public void bake()Bakes the registry so that it becomes immutable.
-