Skip to content

perf: refresh pickup lore only on items that can carry it, and set only changed slots - #76

Merged
XxFran10xX merged 3 commits into
mainfrom
perf/vessel-lore-diff
Nov 6, 2026
Merged

XxFran10xX merged 3 commits into
mainfrom
perf/vessel-lore-diff

Conversation

@XxFran10xX

@XxFran10xX XxFran10xX commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Each pickup (once per player per tick since #75) ran both lore writers over all 41 inventory slots and set every slot back. For an ordinary item that meant about eight copies of its meta, its lore read twice and run through regexes (ArtifactLore.readAura), all to change nothing, and then a slot packet per slot. On Main at 15+ players that was ~3 s of main thread per hour (spark 11-04).

  • VesselLore now reads an item's meta once to tell whether a writer can touch it: meta at all, aura or charge-tier data, a charge item match, or lore with a "/" (an aura line readAura could read back). Other items come back unchanged, as both writers left them before.
  • The inventory refresh sets a slot again only when its item changed. Unchanged slots were only resent to the client.

Lore output is the same: artifacts and charges still go through the same writers.

Tests

  • New VesselLoreTest: what can carry vessel lore, skipped items reach neither writer, only changed slots (charge, artifact) are set.
  • Gear/profile file-system tests fail on Windows on unmodified main too (same 15 failures / 140 errors).

Dev test

Dev (TFMCDev01, 11-05, Blood Magic Dev build + this change): pickups leave artifacts, ordinary items, a lored stick, Cooking food and STEEL_INGOT unchanged; a blank charge gets "Uncharged", a stamped charge "Charge / Mitlan II"; an artifact with its aura PDC stripped is rebuilt; no other slot changes.

🤖 Generated with Claude Code

XxFran10xX and others added 3 commits November 5, 2026 11:48
…ly changed slots

Each pickup (once per player per tick since #75) ran both lore writers over
all 41 inventory slots and set every slot back. For an ordinary item that
meant about eight copies of its meta, its lore read twice and run through
regexes (ArtifactLore.readAura), all to change nothing, and then a slot
packet per slot. On Main at 15+ players that was ~3 s of main thread per hour.

VesselLore now reads an item's meta once to tell whether a writer can touch
it: aura or charge-tier data, a charge item match, or lore with a "/" (an aura
line that readAura could read back). Other items come back unchanged, as both
writers left them before. The inventory refresh sets a slot again only when
its item changed; unchanged slots were only resent to the client.

Lore output is the same: artifacts and charges still go through the same
writers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review: both writers skip an item without meta, so do that first instead of
looking up keys and charge matches on it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review: the plain-item test could not tell the skip from the old path, and
MockBukkit's item factory never reports an empty meta.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Vessel lore updates now leave items without relevant lore indicators unchanged.
    • Inventory refreshes now update only slots whose items have changed, helping avoid unnecessary changes to other items.
    • Eligible charge items and artifact items continue to receive their respective lore updates.

VesselLore now checks whether an item may contain vessel lore before writing it. Inventory refresh processes storage, armour, and extra contents by slot, and sets a slot only when its item changes.

Changes: Vessel lore refresh

Layer / File(s) Summary
Item eligibility and lore routing
src/main/java/net/tfminecraft/magic/artifact/aura/VesselLore.java, src/test/java/net/tfminecraft/magic/artifact/aura/VesselLoreTest.java
mayHaveVesselLore checks item metadata, persistent-data keys, registry matches, and lore text. Eligible items are routed to ChargeLore or ArtifactLore. Tests cover eligibility and writer calls.
Inventory slot refresh
src/main/java/net/tfminecraft/magic/artifact/aura/VesselLore.java, src/test/java/net/tfminecraft/magic/artifact/aura/VesselLoreTest.java
Inventory refresh checks storage, armour, and extra contents. It sets a slot only when the written item differs from its clone. Tests check slot updates and artifact lore.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Merge Risk: Minimal · up to cd973

The lore-refresh change has no established merge-blocking issue; it is ready for normal checks.

- [ ] 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

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: b6f70fe5-67a4-478e-b5f8-ea6e8e37aae0
Commits

Reviewing files that changed from the base of the PR and between caba970 and cd97318.

Files selected for processing: 2

  • src/main/java/net/tfminecraft/magic/artifact/aura/VesselLore.java
  • src/test/java/net/tfminecraft/magic/artifact/aura/VesselLoreTest.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.

@github-actions github-actions Bot added the size:M 30-99 effective changed lines (tests excluded in mixed PRs). label Nov 5, 2026
@XxFran10xX
XxFran10xX marked this pull request as ready for review November 6, 2026 14:27
@XxFran10xX

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Action performed

Full review finished.

@XxFran10xX
XxFran10xX merged commit bed48b4 into main Nov 6, 2026
4 checks passed
@XxFran10xX
XxFran10xX deleted the perf/vessel-lore-diff branch November 6, 2026 15:28
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