mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 14:59:05 +00:00
IAbilityAction interface, AbilityAction unified slot, and bug fixes
- Added IAbilityAction interface (internal + API) for unified Ability/ChainedAbility handling - Created AbilityAction (replaces AbilitySlot) with 3 modes: INLINE_ABILITY, ABILITY_REFERENCE, CHAIN_REFERENCE - Unified DataAbilities storage from dual lists to single List<AbilityAction> - Added ChainedAbility, ChainedAbilityEntry, ChainedAbilityController - Updated PlayerAbilityData with resolveActionKey() for chain: prefix resolution - Added resolveAction/canResolveAction to AbilityController - Fixed unsafe cast in DataAbilities.onDamage() - Fixed NPE in GuiNPCAbilities for chain reference slots - Fixed NPC chain interrupt double cooldown - Fixed removeAbility() incorrectly removing chain references Co-Authored-By: Claude Opus 4.6 <[email protected]>
This commit is contained in:
1 parent
f39d843c70
commit
2f814c1903
17 files changed
+1482
-144
No files matched your search
@@ -0,0 +1,50 @@
|
||||
package kamkeel.npcs.controllers.data.ability;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Common interface for all combat actions that can be assigned to NPCs or players.
|
||||
* Implemented by {@link Ability} (individual ability) and {@link ChainedAbility} (sequence).
|
||||
* <p>
|
||||
* This enables unified storage via {@link AbilityAction}, unified weighted random selection,
|
||||
* and unified eligibility checking without instanceof or separate codepaths.
|
||||
*/
|
||||
public interface IAbilityAction {
|
||||
|
||||
String getName();
|
||||
|
||||
boolean isEnabled();
|
||||
|
||||
void setEnabled(boolean enabled);
|
||||
|
||||
int getWeight();
|
||||
|
||||
int getCooldownTicks();
|
||||
|
||||
float getMinRange();
|
||||
|
||||
float getMaxRange();
|
||||
|
||||
UserType getAllowedBy();
|
||||
|
||||
List<Condition> getConditions();
|
||||
|
||||
boolean checkConditions(EntityLivingBase caster, EntityLivingBase target);
|
||||
|
||||
boolean checkConditionsForPlayer(EntityLivingBase caster);
|
||||
|
||||
/**
|
||||
* Whether this action is a chained ability (sequence of abilities) vs an individual ability.
|
||||
*/
|
||||
boolean isChain();
|
||||
|
||||
/**
|
||||
* Create a deep copy of this action.
|
||||
*/
|
||||
IAbilityAction deepCopyAction();
|
||||
|
||||
NBTTagCompound writeNBT();
|
||||
}
|
||||
Reference in new issue
Block a user