mirror of
https://github.com/KAMKEEL/CustomNPC-Plus-API.git
synced 2026-11-19 17:39:45 +00:00
Ability Push
This commit is contained in:
1 parent
ed5640d238
commit
3ac76848d3
7 files changed
+448
-2
No files matched your search
@@ -0,0 +1,166 @@
|
||||
package noppes.npcs.api.ability;
|
||||
|
||||
import noppes.npcs.api.INbt;
|
||||
|
||||
/**
|
||||
* Interface for NPC abilities.
|
||||
* Abilities are special attacks or actions that NPCs can perform during combat.
|
||||
*/
|
||||
public interface IAbility {
|
||||
|
||||
/**
|
||||
* Get the unique ID of this ability instance.
|
||||
*/
|
||||
String getId();
|
||||
|
||||
/**
|
||||
* Set the unique ID of this ability instance.
|
||||
*/
|
||||
void setId(String id);
|
||||
|
||||
/**
|
||||
* Get the display name of this ability.
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Set the display name of this ability.
|
||||
*/
|
||||
void setName(String name);
|
||||
|
||||
/**
|
||||
* Get the type ID of this ability (e.g., "cnpc:slam", "cnpc:beam").
|
||||
*/
|
||||
String getTypeId();
|
||||
|
||||
/**
|
||||
* Check if this ability is enabled.
|
||||
*/
|
||||
boolean isEnabled();
|
||||
|
||||
/**
|
||||
* Enable or disable this ability.
|
||||
*/
|
||||
void setEnabled(boolean enabled);
|
||||
|
||||
/**
|
||||
* Get the selection weight for random ability selection.
|
||||
* Higher weight = more likely to be selected.
|
||||
*/
|
||||
int getWeight();
|
||||
|
||||
/**
|
||||
* Set the selection weight.
|
||||
*/
|
||||
void setWeight(int weight);
|
||||
|
||||
/**
|
||||
* Get the minimum range at which this ability can be used.
|
||||
*/
|
||||
float getMinRange();
|
||||
|
||||
/**
|
||||
* Set the minimum range.
|
||||
*/
|
||||
void setMinRange(float range);
|
||||
|
||||
/**
|
||||
* Get the maximum range at which this ability can be used.
|
||||
*/
|
||||
float getMaxRange();
|
||||
|
||||
/**
|
||||
* Set the maximum range.
|
||||
*/
|
||||
void setMaxRange(float range);
|
||||
|
||||
/**
|
||||
* Get the cooldown time in ticks.
|
||||
*/
|
||||
int getCooldownTicks();
|
||||
|
||||
/**
|
||||
* Set the cooldown time in ticks.
|
||||
*/
|
||||
void setCooldownTicks(int ticks);
|
||||
|
||||
/**
|
||||
* Get the wind-up time in ticks (telegraph phase).
|
||||
*/
|
||||
int getWindUpTicks();
|
||||
|
||||
/**
|
||||
* Set the wind-up time in ticks.
|
||||
*/
|
||||
void setWindUpTicks(int ticks);
|
||||
|
||||
/**
|
||||
* Get the active duration in ticks.
|
||||
*/
|
||||
int getActiveTicks();
|
||||
|
||||
/**
|
||||
* Set the active duration in ticks.
|
||||
*/
|
||||
void setActiveTicks(int ticks);
|
||||
|
||||
/**
|
||||
* Get the recovery time in ticks.
|
||||
*/
|
||||
int getRecoveryTicks();
|
||||
|
||||
/**
|
||||
* Set the recovery time in ticks.
|
||||
*/
|
||||
void setRecoveryTicks(int ticks);
|
||||
|
||||
/**
|
||||
* Check if this ability can be interrupted by damage.
|
||||
*/
|
||||
boolean isInterruptible();
|
||||
|
||||
/**
|
||||
* Set whether this ability can be interrupted.
|
||||
*/
|
||||
void setInterruptible(boolean interruptible);
|
||||
|
||||
/**
|
||||
* Get the damage threshold for interruption.
|
||||
*/
|
||||
float getInterruptThreshold();
|
||||
|
||||
/**
|
||||
* Set the damage threshold for interruption.
|
||||
*/
|
||||
void setInterruptThreshold(float threshold);
|
||||
|
||||
/**
|
||||
* Check if this ability is currently being executed.
|
||||
*/
|
||||
boolean isExecuting();
|
||||
|
||||
/**
|
||||
* Check if this ability is on cooldown.
|
||||
*/
|
||||
boolean isOnCooldown();
|
||||
|
||||
/**
|
||||
* Get the current execution phase (0=IDLE, 1=WINDUP, 2=ACTIVE, 3=RECOVERY).
|
||||
*/
|
||||
int getPhaseInt();
|
||||
|
||||
/**
|
||||
* Get the current tick within the current phase.
|
||||
*/
|
||||
int getCurrentTick();
|
||||
|
||||
/**
|
||||
* Get this ability's data as NBT.
|
||||
*/
|
||||
INbt getNbt();
|
||||
|
||||
/**
|
||||
* Set this ability's data from NBT.
|
||||
*/
|
||||
void setNbt(INbt nbt);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package noppes.npcs.api.ability;
|
||||
|
||||
/**
|
||||
* Handler for ability registration and creation.
|
||||
* Use this to register custom ability types from external mods.
|
||||
*/
|
||||
public interface IAbilityHandler {
|
||||
|
||||
/**
|
||||
* Register a custom ability type.
|
||||
* Call during FMLInitializationEvent.
|
||||
*
|
||||
* @param typeId The unique type ID (e.g., "mymod:custom_ability")
|
||||
* @param abilityClass The class that implements the ability
|
||||
*/
|
||||
void registerType(String typeId, Class<? extends IAbility> abilityClass);
|
||||
|
||||
/**
|
||||
* Check if an ability type is registered.
|
||||
*/
|
||||
boolean hasType(String typeId);
|
||||
|
||||
/**
|
||||
* Get all registered ability type IDs.
|
||||
*/
|
||||
String[] getTypes();
|
||||
|
||||
/**
|
||||
* Create a new ability of the given type.
|
||||
* Returns null if the type is not registered.
|
||||
*/
|
||||
IAbility create(String typeId);
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package noppes.npcs.api.ability;
|
||||
|
||||
/**
|
||||
* Interface for an NPC's ability data manager.
|
||||
* Provides access to the NPC's abilities and execution state.
|
||||
*/
|
||||
public interface IDataAbilities {
|
||||
|
||||
/**
|
||||
* Check if the ability system is enabled for this NPC.
|
||||
*/
|
||||
boolean isEnabled();
|
||||
|
||||
/**
|
||||
* Enable or disable the ability system for this NPC.
|
||||
*/
|
||||
void setEnabled(boolean enabled);
|
||||
|
||||
/**
|
||||
* Get all abilities assigned to this NPC.
|
||||
*/
|
||||
IAbility[] getAbilities();
|
||||
|
||||
/**
|
||||
* Add an ability to this NPC.
|
||||
*/
|
||||
void addAbility(IAbility ability);
|
||||
|
||||
/**
|
||||
* Remove an ability by ID.
|
||||
*/
|
||||
void removeAbility(String abilityId);
|
||||
|
||||
/**
|
||||
* Get an ability by ID.
|
||||
*/
|
||||
IAbility getAbility(String abilityId);
|
||||
|
||||
/**
|
||||
* Check if the NPC has an ability with the given ID.
|
||||
*/
|
||||
boolean hasAbility(String abilityId);
|
||||
|
||||
/**
|
||||
* Clear all abilities from this NPC.
|
||||
*/
|
||||
void clearAbilities();
|
||||
|
||||
/**
|
||||
* Get the currently executing ability, or null if none.
|
||||
*/
|
||||
IAbility getCurrentAbility();
|
||||
|
||||
/**
|
||||
* Check if any ability is currently executing.
|
||||
*/
|
||||
boolean isExecutingAbility();
|
||||
|
||||
/**
|
||||
* Interrupt the current ability if one is executing.
|
||||
*/
|
||||
void interruptCurrentAbility();
|
||||
|
||||
/**
|
||||
* Get the global cooldown timer in ticks.
|
||||
*/
|
||||
int getGlobalCooldown();
|
||||
|
||||
/**
|
||||
* Set the global cooldown timer in ticks.
|
||||
*/
|
||||
void setGlobalCooldown(int ticks);
|
||||
|
||||
/**
|
||||
* Reset all ability cooldowns.
|
||||
*/
|
||||
void resetCooldowns();
|
||||
}
|
||||
Reference in new issue
Block a user