Abilities are now Stored by Name not UUID. Refactor Built In and Toggleable Abilities

This commit is contained in:
Kam committed 2026-02-17 23:08:12 -05:00
1 parent f39d843c70
commit 6514b217b9
12 files changed
+465 -127

No files matched your search

@@ -263,6 +263,9 @@ public class PlayerAbilityData extends AbstractDataAbilities implements IPlayerA
return;
}
// Tick active toggles (independent of currentAbility)
tickActiveToggles();
if (currentAbility != null && currentAbility.isExecuting()) {
tickCurrentAbility();
@@ -385,6 +388,11 @@ public class PlayerAbilityData extends AbstractDataAbilities implements IPlayerA
}
}
@Override
protected void onToggleStateChanged(String key, boolean active) {
syncToClient();
}
// ═══════════════════════════════════════════════════════════════════
// SELECTION
// ═══════════════════════════════════════════════════════════════════
@@ -750,6 +758,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) {
@@ -772,6 +787,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);
}
}
}
/**