Package noppes.npcs.api.ability
Interface IAbilityHandler
-
public interface IAbilityHandlerHandler for ability registration and creation. Use this to register custom ability types from external mods.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IAbilitycreate(String typeId)Create a new ability of the given type.String[]getTypes()Get all registered ability type IDs.booleanhasAbility(String name)Check if a registered ability exists by name.booleanhasType(String typeId)Check if an ability type is registered.voidregisterAbility(String name, IAbility ability)Register a pre-configured ability by name.voidregisterType(String typeId, Class<? extends IAbility> abilityClass)Register a custom ability type.
-
-
-
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 abilityability- 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
-
-