mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 01:29:05 +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
@@ -14,6 +14,7 @@ import kamkeel.npcs.network.packets.data.telegraph.TelegraphSpawnPacket;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import noppes.npcs.controllers.data.Animation;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
@@ -318,6 +319,9 @@ public class DataAbilities extends AbstractDataAbilities {
|
||||
if (positionLocked) releaseLockedPosition();
|
||||
}
|
||||
|
||||
// Tick active toggles (independent of currentAbility)
|
||||
tickActiveToggles();
|
||||
|
||||
// Tick current ability if executing, or tick chain delay between entries
|
||||
if (chainDelayRemaining > 0 || (currentAbility != null && currentAbility.isExecuting())) {
|
||||
tickCurrentAbility();
|
||||
@@ -699,6 +703,7 @@ public class DataAbilities extends AbstractDataAbilities {
|
||||
*/
|
||||
public void reset() {
|
||||
stopCurrentAbility();
|
||||
clearActiveToggles();
|
||||
|
||||
// Roll cooldown so NPC doesn't immediately attack after reset
|
||||
rollCooldownOnReset();
|
||||
@@ -1038,6 +1043,13 @@ public class DataAbilities extends AbstractDataAbilities {
|
||||
}
|
||||
compound.setTag("AbilityActions", actionList);
|
||||
|
||||
// Active toggles
|
||||
NBTTagList toggleList = new NBTTagList();
|
||||
for (String key : activeToggles.keySet()) {
|
||||
toggleList.appendTag(new NBTTagString(key));
|
||||
}
|
||||
compound.setTag("ActiveToggles", toggleList);
|
||||
|
||||
return compound;
|
||||
}
|
||||
|
||||
@@ -1078,5 +1090,15 @@ public class DataAbilities extends AbstractDataAbilities {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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