mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 19:15:11 +00:00
Merge upstream dev: name-based storage, UUID/DisplayName, toggle system
Resolved conflicts in AbstractDataAbilities, DataAbilities, PlayerAbilityData to integrate both toggle system (upstream) and chain delay tracking (local). ChainedAbility now has UUID and DisplayName fields matching Ability pattern. ChainedAbilityController rewritten: saves in abilities/chained/, dual-index by name and UUID, legacy migration from chained_abilities/ directory. Co-Authored-By: Claude Opus 4.6 <[email protected]>
This commit is contained in:
commit
0311dc5806
14 files changed
+628
-148
No files matched your search
@@ -271,6 +271,9 @@ public class PlayerAbilityData extends AbstractDataAbilities implements IPlayerA
|
||||
return;
|
||||
}
|
||||
|
||||
// Tick active toggles (independent of currentAbility)
|
||||
tickActiveToggles();
|
||||
|
||||
if (chainDelayRemaining > 0 || (currentAbility != null && currentAbility.isExecuting())) {
|
||||
tickCurrentAbility();
|
||||
|
||||
@@ -422,6 +425,11 @@ public class PlayerAbilityData extends AbstractDataAbilities implements IPlayerA
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onToggleStateChanged(String key, boolean active) {
|
||||
syncToClient();
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// SELECTION
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
@@ -787,6 +795,13 @@ public class PlayerAbilityData extends AbstractDataAbilities implements IPlayerA
|
||||
compound.setTag("PlayerAbilities", list);
|
||||
compound.setInteger("PlayerAbilitySelected", selectedIndex);
|
||||
compound.setBoolean("AbilityAnimating", playingAbilityAnimation);
|
||||
|
||||
// Active toggles
|
||||
NBTTagList toggleList = new NBTTagList();
|
||||
for (String key : activeToggles.keySet()) {
|
||||
toggleList.appendTag(new NBTTagString(key));
|
||||
}
|
||||
compound.setTag("ActiveToggles", toggleList);
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
@@ -809,6 +824,16 @@ public class PlayerAbilityData extends AbstractDataAbilities implements IPlayerA
|
||||
selectedIndex = Math.max(0, unlockedAbilities.size() - 1);
|
||||
}
|
||||
playingAbilityAnimation = compound.getBoolean("AbilityAnimating");
|
||||
|
||||
// Active toggles - restore state directly (no onToggleOn callback during load)
|
||||
activeToggles.clear();
|
||||
if (compound.hasKey("ActiveToggles")) {
|
||||
NBTTagList toggleNbt = compound.getTagList("ActiveToggles", 8); // 8 = TAG_STRING
|
||||
for (int i = 0; i < toggleNbt.tagCount(); i++) {
|
||||
String key = toggleNbt.getStringTagAt(i);
|
||||
setToggleEntryDirect(key, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user