Skip to content

Mage weapons follow their template's classes and two-handed flag - #80

Merged
XxFran10xX merged 1 commit into
mainfrom
feat/gear-template-sync
Nov 19, 2026
Merged

XxFran10xX merged 1 commit into
mainfrom
feat/gear-template-sync

Conversation

@XxFran10xX

@XxFran10xX XxFran10xX commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Status record

  • Reviewed: Fable 5.2 APPROVE at 6b47ac9 (one review covering all three PRs; a low-confidence minor finding left, see below)
  • Second opinion: CodeRabbit APPROVED at 6b47ac9, no findings
  • Dev-tested at 6b47ac9: a wand crafted for "Mage" before the change came back requiring Evoker and two-handed after the restart, part of 18/18 bot checks; after the 11-19 renames the same wand followed its template to Conjurer, and when the wand template went back to one-handed it lost its two-handed flag; on 11-19 each path also cast a rune from its own weapon; Dev log clean, no "Gear refresh failed"
  • Local tests: GearTemplateSyncTest and GearRefresherCoverageTest passed; CI build (tests + 100% coverage) green at 6b47ac9

Left alone from the review: isOutdated compares the final class tag while apply sets the original layer of a class stat history, so a weapon whose history added a class would rebuild on every touch. No Mage weapon can get there today (runes carry no classes and every template now lists classes).

Why

Mage is getting three weapon paths (ServerAssets PR): the staff, wand and blade templates list Invoker, Conjurer and Battlemage instead of Mage. A crafted mage weapon is rebuilt from its own data on refresh, so weapons players already hold would keep required-class: Mage. Nobody could use them after the change. Handedness is synced the same way: Main's crafted blade template stops being two-handed, so crafted blades held today become one-handed on their next refresh.

What

  • GearTemplateSync: a weapon is outdated when its classes (as a set, ignoring case) or its two-handed flag differ from its MMOItems template. A refresh then copies only those two stats from the template. With a class stat history only its original layer changes; a template without classes or two-handed removes them.
  • GearRefresher treats that as one more reason to rebuild, and applies the sync while rewriting. Sockets, runes, part stats, name, skin and requirements are carried as before.
  • Same idea as AdvancedCrafting 2.9.0's required-class sync for crafted armour and weapons.

Not in this PR

No release, nothing on Main or Tutorial.

🤖 Generated with Claude Code

…efresh

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

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Gear now refreshes when its required classes or two-handed setting differ from the MMOItems template, and applies the template’s settings during refresh.

Gear refresh checks now detect differences between item data and its MMOItems template. When a rebuild occurs, the refresh path applies the template’s required classes and two-handed value to the item.

Changes: Gear template synchronisation

Layer / File(s) Summary
Template comparison and application
src/main/java/net/tfminecraft/magic/gear/GearTemplateSync.java, src/test/java/net/tfminecraft/magic/gear/GearTemplateSyncTest.java
GearTemplateSync compares required classes and two-handed values with the template. It applies template values to item NBT and handles missing or unsupported data. Tests cover comparison and application cases.
Refresh integration
src/main/java/net/tfminecraft/magic/gear/GearRefresher.java, src/test/java/net/tfminecraft/magic/GearRefresherCoverageTest.java
GearRefresher includes template differences in its outdated check and applies the template during rebuild. Coverage tests verify both refresh outcomes.

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

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant GearRefresher
  participant GearTemplateSync
  participant MMOItems
  participant NBTItem
  GearRefresher->>GearTemplateSync: Check isOutdated(stack)
  GearTemplateSync->>MMOItems: Read template data
  MMOItems-->>GearTemplateSync: Return template data
  GearTemplateSync-->>GearRefresher: Return outdated status
  GearRefresher->>NBTItem: Construct NBT wrapper during rebuild
  GearRefresher->>GearTemplateSync: Apply template to MMO item and NBT
  GearTemplateSync->>NBTItem: Set or remove template stats
Loading

Suggested reviewers: ryanbarlow97

Merge Risk: Minimal · up to 6b47a

Existing Mage weapons are synced to their template's classes and two-handed flag on refresh. No concrete merge-blocking issue was identified.

- [ ] 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: 100be40e-f77d-4655-9a52-43b736539a64
Commits

Reviewing files that changed from the base of the PR and between 435d956 and 6b47ac9.

Files selected for processing: 4

  • src/main/java/net/tfminecraft/magic/gear/GearRefresher.java
  • src/main/java/net/tfminecraft/magic/gear/GearTemplateSync.java
  • src/test/java/net/tfminecraft/magic/GearRefresherCoverageTest.java
  • src/test/java/net/tfminecraft/magic/gear/GearTemplateSyncTest.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:L 100-499 effective changed lines (tests excluded in mixed PRs). label Nov 18, 2026
@XxFran10xX
XxFran10xX marked this pull request as ready for review November 19, 2026 12:09
@XxFran10xX

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 19, 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 f508da0 into main Nov 19, 2026
4 checks passed
@XxFran10xX
XxFran10xX deleted the feat/gear-template-sync branch November 19, 2026 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 effective changed lines (tests excluded in mixed PRs).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant