promotional bannermobile promotional banner

Truly Best Friends Forever

Let your beloved pet stay by your side forever.
Back to Files

trulybestfriends-0.2.3.jar

File nametrulybestfriends-0.2.3.jar
Uploader
whidtewhidte
Uploaded
Sep 13, 2026
Downloads
189
Size
312.7 KB
Mod Loaders
Forge
File ID
8874341
Type
R
Release
Supported game versions
  • 1.20.1

Curse Maven Snippet

Forge

implementation fg.deobf("curse.maven:truly-best-friends-forever-1587653:8874341")

Learn more about Curse Maven

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 + deep
equals 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 PetStateSignature pre-check to savePetData: 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 in
    petEntitySnapshot.

  • Added an isPetSyncCandidate pre-filter to collectLocalSyncCandidates: 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 hasPetFileInOtherOwnerDir to avoid traversing all
    player directories every tick.

  • Unified cache cleanup: added forgetPetCaches, which clears petDeathTimes,
    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.

This mod has no additional files