Skip to content

Stop artifacts muffling for time in a player's hands, and drop finished station intents - #69

Merged
XxFran10xX merged 3 commits into
mainfrom
fix/artifact-housed-care-clock
Oct 22, 2026
Merged

XxFran10xX merged 3 commits into
mainfrom
fix/artifact-housed-care-clock

Conversation

@XxFran10xX

Copy link
Copy Markdown
Contributor

Why

Two player reports from 2026-10-22: "all artifacts muffled overnight", and "the magic table still drops the server TPS dramatically".

Muffle. Muffle builds at attunement.muffled.off_per_hour (1/24 per hour) while an artifact holding aura is unhoused, and recovers while it is housed. The care clock (care_last_tick) is only saved when ArtifactCareStore.apply writes.

  • The inventory scan uses IF_VISIBLE. A housed artifact at 0% muffle has no lore change, because aura decay is 0 for every element, so its clock was never saved.
  • Placing it on a pedestal or display ran apply(housed=false). That charged every hour since the stale clock, including the night in the player's inventory, as unhoused.
  • Reproduced on Dev 0.12.1: carried for 10 h, then a pedestal round trip, gives Muffled: 41.67%.
  • Breaking a pedestal or display, or knocking an artifact out of an item frame, had the same problem. The item dropped without a care tick, and the pickup (inventory == null, unhoused) charged the housed time.

Station. Main is quiet today: gear-stations.yml is 4 KB since #66 archived released rows, and no station write has happened since the 06:10 restart. The cost would come back, though:

  • every station click re-reads and parses the whole file;
  • each row kept its deposit-intent and charge-intent, each holding two full base64 inventory snapshots (100–200 KB per row on Main), for as long as the weapon stays on the station;
  • nothing reads them after the operation finishes. They are evidence for an interrupted operation, which holdInterrupted/hold mark as held.

What changes

Case Before After
Housed artifact with aura, scan, no lore change clock never saved clock re-anchored every scaled minute (error at most ~0.07% muffle)
Placed on pedestal/display from the hand time before counted unhoused counted housed (the item comes from the player's main hand)
Pedestal/display broken, frame punched or broken pickup charged housed time as unhoused item ticked as housed before it drops
Any care write aura decay applied only when lore changed visibly decay applied whenever the clock moves, and any step is saved
Chest/container storage muffles while aura is stored unchanged
Deposit reaches active deposit-intent kept removed
Charge settles, or is cancelled before removal charge-intent kept removed
Interrupted operation (held) intent kept intent kept (unchanged)

Existing active rows lose their old intents the next time they are updated. Main's only live row today is a legacy row with no intents. The fsync of every parent folder on each station write is unchanged. On the host it measured ~9 ms per file sync, plus 0–50 ms for the folder chain.

Tests

  • New and extended unit tests:
    • ArtifactCareTest: housed anchor, decay on anchor, small decay steps.
    • ArtifactListenerTest: housed pedestal add, furniture break.
    • FrameCareTest: frame damage and break.
    • GearEffectsTest: intent present while depositing or charging, gone once active, kept when held.
  • mvn verify locally: 718 tests. The only failures are the four known Windows-only tests (two case-spelling, two symlink; they also fail on main). The run uses the usual local-only directory-fsync workaround, which is not committed. Every changed class is at 100% coverage; the only gaps are Windows-only (MagicProfileStore, GearFiles, GearPropertyStore).
  • Three rounds of self-review. Round 1 found the furniture/frame break paths and the decay on anchor; round 2 found small decay steps; round 3 was clean.
  • Dev (magic-DEV-20261022-muffle.jar, bots in ~/muffle-intent-test):
    • muffle.js: carried 10 h → 41.67% on 0.12.1, 0% with this change.
    • chest.js: 10 h in a chest still gives 41.68%, as designed.
    • station.js: on 0.12.1 the active row keeps deposit-intent and charge-intent (6.4 KB / 13.3 KB with the bot's near-empty inventory). With this change it has none (2.2 KB), and charge-intent exists only while charging. Refunds and aborts are unchanged, with no held rows and no Magic errors in the log.

Draft: not for merge or release yet.

🤖 Generated with Claude Code

XxFran10xX and others added 3 commits October 22, 2026 15:12
…finished station intents

An artifact at 0% muffle in a player's inventory never wrote its care clock, because
nothing on its lore changed. Placing it on a pedestal or display then counted every
hour since that stale clock as unhoused time, so artifacts carried overnight came out
heavily muffled. Housed artifacts holding aura now re-anchor the clock once a minute,
and a pedestal or display placement counts the time before it as housed.

Station rows kept their deposit and charge intents (two full inventory snapshots each,
100-200 KB per row) for as long as the weapon stayed on the station, and every station
click re-reads the whole file. A finished operation now drops its intent; interrupted
ones still keep it as evidence when the row is held.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…y on clock anchors

Breaking a pedestal or display, or punching an artifact out of an item frame, dropped
it without a care tick, so the pickup charged its housed time as unhoused. Those paths
now tick it as housed first. Any care write now also decays the elapsed aura time, so
a clock anchor without a lore change no longer drops it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Housed artifacts with aura now write their clock every scaled minute, so a decay step
under the old 0.0001 threshold would be lost each time. Any change in fill is saved.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4d53bab6-c3fe-4364-9e23-ad84fa1ff588
📥 Commits

Reviewing files that changed from the base of the PR and between f43e599 and b20a32c.

📒 Files selected for processing: 9
  • src/main/java/net/tfminecraft/magic/artifact/ArtifactCareStore.java
  • src/main/java/net/tfminecraft/magic/artifact/ArtifactFrameCareTicker.java
  • src/main/java/net/tfminecraft/magic/gear/GearStationStore.java
  • src/main/java/net/tfminecraft/magic/gear/ownership/GearEffects.java
  • src/main/java/net/tfminecraft/magic/listener/ArtifactListener.java
  • src/test/java/net/tfminecraft/magic/ArtifactListenerTest.java
  • src/test/java/net/tfminecraft/magic/GearEffectsTest.java
  • src/test/java/net/tfminecraft/magic/artifact/ArtifactCareTest.java
  • src/test/java/net/tfminecraft/magic/artifact/FrameCareTest.java

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Artifact care now accounts for elapsed time consistently when artifacts are housed, displayed, or held in item frames, including when frames are damaged or broken.
    • Aura decay is applied across care-clock updates even when no visible lore changes occur.
    • Gear station deposits and charges now clear their pending state when completed or cancelled, while preserving it when an operation is held.
    • Breaking display furniture now settles care for artifacts in its active slots.

The change updates artifact care clock anchoring and event handling. It also clears deposit and charge intent records during specified gear station transitions.

Changes: Artifact Care

Layer / File(s) Summary
Housed artifact clock and decay
src/main/java/net/tfminecraft/magic/artifact/ArtifactCareStore.java, src/test/java/net/tfminecraft/magic/artifact/ArtifactCareTest.java
Housed artifacts with stored aura can trigger clock anchoring after the threshold. Persisted clock updates decay fill, and any non-equal fill change is marked dirty. Tests cover clock anchoring and fill decay.
Furniture and item-frame care settlement
src/main/java/net/tfminecraft/magic/listener/ArtifactListener.java, src/main/java/net/tfminecraft/magic/artifact/ArtifactFrameCareTicker.java, src/test/java/net/tfminecraft/magic/ArtifactListenerTest.java, src/test/java/net/tfminecraft/magic/artifact/FrameCareTest.java
Furniture slot and break handling settles housed care. Uncancelled damage and hanging-break events for item frames call tickFrame with Persist.ALWAYS. Tests cover these paths.

Gear Station Intent Records

Layer / File(s) Summary
Intent cleanup across station transitions
src/main/java/net/tfminecraft/magic/gear/ownership/GearEffects.java, src/main/java/net/tfminecraft/magic/gear/GearStationStore.java, src/test/java/net/tfminecraft/magic/GearEffectsTest.java
Deposit and charge transitions clear intent records when the station becomes active or completes an update. Tests check intent cleanup and verify that an intent remains when a checkpoint failure leaves the station held.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Possibly related PRs

  • TF-Minecraft/Magic#64: Adds the deposit and charge intent records that this change clears during gear station transitions.

Suggested reviewers: drefvelin, ryanbarlow97

Merge Risk: ⚪ Minimal · up to b20a3

The identified display-placement and furniture-break concerns do not block merging. No other actionable risk is established by the supplied changes.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the size:M 30-99 effective changed lines (tests excluded in mixed PRs). label Oct 22, 2026
@XxFran10xX
XxFran10xX marked this pull request as ready for review October 22, 2026 13:48
@XxFran10xX

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@XxFran10xX
XxFran10xX merged commit 3f2322a into main Oct 22, 2026
4 checks passed
@XxFran10xX
XxFran10xX deleted the fix/artifact-housed-care-clock branch October 22, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 effective changed lines (tests excluded in mixed PRs).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant