mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-21 10:22:25 +00:00
Ability Checking
This commit is contained in:
1 parent
3919831857
commit
37d4b97a44
6 files changed
+79
-167
No files matched your search
@@ -81,6 +81,7 @@ public class AbilityController implements IAbilityHandler {
|
||||
private final List<IAbilityExtender> extenders = new ArrayList<>();
|
||||
private final Map<String, Supplier<AbilityCondition>> conditionTypes = new HashMap<>();
|
||||
private final List<Predicate<EntityPlayer>> flightCheckers = new ArrayList<>();
|
||||
private final List<Predicate<EntityPlayer>> activationCheckers = new ArrayList<>();
|
||||
|
||||
// ── Chained Abilities ──────────────────────────────────────────────────
|
||||
private final Map<String, ChainedAbility> chainedAbilities = new LinkedHashMap<>(); // name → ChainedAbility
|
||||
@@ -1019,6 +1020,17 @@ public class AbilityController implements IAbilityHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void registerActivationChecker(Predicate<EntityPlayer> checker) {
|
||||
activationCheckers.add(checker);
|
||||
}
|
||||
|
||||
public boolean canPlayerActivate(EntityPlayer player) {
|
||||
for (Predicate<EntityPlayer> checker : activationCheckers) {
|
||||
if (!checker.test(player)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fire onAbilityStart on all extenders. Returns false if ANY extender cancels.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user