Interface IAbilityHandler


  • public interface IAbilityHandler
    Handler for ability registration and creation. Use this to register custom ability types from external mods.
    • Method Detail

      • registerType

        void registerType​(String typeId,
                          Class<? extends IAbility> abilityClass)
        Register a custom ability type. Call during FMLInitializationEvent.
        Parameters:
        typeId - The unique type ID (e.g., "mymod:custom_ability")
        abilityClass - The class that implements the ability
      • hasType

        boolean hasType​(String typeId)
        Check if an ability type is registered.
        Parameters:
        typeId - the type ID to check
        Returns:
        true if registered
      • getTypes

        String[] getTypes()
        Get all registered ability type IDs.
        Returns:
        array of registered type IDs
      • create

        IAbility create​(String typeId)
        Create a new ability of the given type. Returns null if the type is not registered.
        Parameters:
        typeId - the type ID
        Returns:
        the new ability, or null
      • registerAbility

        void registerAbility​(String name,
                             IAbility ability)
        Register a pre-configured ability by name. These abilities are resolved by name and can be referenced by NPCs and players. Call during FMLInitializationEvent.
        Parameters:
        name - The unique name for the ability
        ability - The ability instance
      • hasAbility

        boolean hasAbility​(String name)
        Check if a registered ability exists by name.
        Parameters:
        name - The ability name
        Returns:
        true if the ability exists