Class CapabilityConstructorRegistry

java.lang.Object
org.cyclops.cyclopscore.modcompat.capabilities.CapabilityConstructorRegistry

public class CapabilityConstructorRegistry extends Object
Registry for capabilities created by this mod.
  • Field Details

    • mod

      protected final ModBase mod
    • baked

      protected boolean baked
    • registeredBlockEntityEventListener

      protected boolean registeredBlockEntityEventListener
    • registeredBlockEventListener

      protected boolean registeredBlockEventListener
    • registeredEntityEventListener

      protected boolean registeredEntityEventListener
    • registeredItemStackEventListener

      protected boolean registeredItemStackEventListener
  • Constructor Details

    • CapabilityConstructorRegistry

      public CapabilityConstructorRegistry(ModBase mod)
  • Method Details

    • getMod

      protected ModBase 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

      public void registerInheritableItem(Class<?> clazz, ICapabilityConstructor<?,?,?,?> 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.
      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)