trulybestfriends-0.2.3-1.21.1.jar
Curse Maven Snippet
What's new
Optimize pet data persistence to eliminate server-side tick stutter.
Fix the periodic stutter caused by flushPendingPetSaves in the server-side onServerTick:
Every tick, it performs full NBT serialization for all loaded pets + reading old files + deepequals comparison + atomic writing of temporary files, even when the data has not changed.
-
Added
PetSnapshotFingerprint: records the content fingerprint of the most recent persisted
snapshot by pet UUID (FNV-style structural hash). Before writing, compare the fingerprint first;
if the content has not changed, skip reading the old file and disk writing entirely. -
Added a
PetStateSignaturepre-check tosavePetData: if the coordinates (1/16 block
quantization), orientation, health, name, sitting state, and AI state have all not changed, and
there is already a pending persistence task, skip the full entity NBT collection inpetEntitySnapshot. -
Added an
isPetSyncCandidatepre-filter tocollectLocalSyncCandidates: only collect candidates
for already-tracked pets or entities whose owner can be resolved, instead of enqueueing all
irrelevant entities such as items and projectiles within a 5x5 chunk area. -
Added a 10-second TTL negative cache to
hasPetFileInOtherOwnerDirto avoid traversing all
player directories every tick. -
Unified cache cleanup: added
forgetPetCaches, which clearspetDeathTimes,petStateSignatures,noForeignOwnerFileUntil, and the fingerprint table when pet data is
cleared/deleted; clears all fingerprint caches when the server stops.
The fingerprint cache exists only in memory and is cleared when the server stops. Scenarios where
NBT files are directly modified offline will still take effect normally on the next startup,
preserving the original behavior unchanged.
All Relations
- All Relations
- Embedded Library
- Optional Dependency
- Required Dependency
- Tool
- Incompatible
- Include

