Skip to content

Name mage weapons after their core's material - #60

Merged
XxFran10xX merged 1 commit into
mainfrom
fix/mage-weapon-material-name
Oct 19, 2026
Merged

XxFran10xX merged 1 commit into
mainfrom
fix/mage-weapon-material-name

Conversation

@XxFran10xX

Copy link
Copy Markdown
Contributor

Crafted mage weapons kept their template's plain white name ("Mage Staff", "Mage Wand", "Mage Blade"). AdvancedCrafting weapons and armour are named and coloured after their majority material. Magic never wrote the MMOItems name: GearItemBuilder only set sockets and stats, and GearModelResolver only swapped the model.

The core now names the weapon, since it already picks the model:

  • A core's optional material: in gear/parts.yml (e.g. "#d8d8d8Iron") fills %material% in the archetype's new item-name: in gear/archetypes.yml (e.g. "%material% Mage Staff"). The whole name takes the material's colour, as in AdvancedCrafting.
  • A core without material: falls back to its name minus "Magical Core". An archetype without item-name: uses "%material% <name>". A core that gives no material leaves the template name alone.
  • GearName.write sets the MMOItems name and the original in its stat history, the way AdvancedCrafting does, so MMOItems updates keep it.
  • Crafting, socket rewrites (charges, /magic weapon give), refreshes and the station preview all use it.
  • The name Magic wrote is kept in magic:gear_name. The join/chest-open refresh renames weapons crafted before this once, through the existing rebuild path that keeps runes and skins. Neither key changes part or archetype revisions.

Bundled configs now set material: on all 12 cores and item-name: on the three archetypes. Existing servers keep their config files, so the keys have to be added by hand; without them, names fall back to "Iron Staff" style.

Tests:

  • GearNameCoverageTest covers every new branch, plus crafting, socket rewrite and refresh naming.
  • mvn -B verify on Linux: 653 tests, 0 failures, coverage gate met. (The gear file tests can't run on Windows because of directory fsync.)
  • Dev (TFMCDev01), mineflayer bots with real Mage characters:
    • Gave four weapons on 0.6.3 (iron staff with a socketed Tide Shard rune, steel wand, abyssalite blade, and a mythril staff whose core had no material:, to cover the fallback). All four showed white "Mage …" names.
    • Swapped to this build and added the keys to Dev's configs. On the next join all four were renamed: "Iron Mage Staff" #D8D8D8, "Steel Mage Wand" #7F7D80, "Abyssalite Mage Blade" #3B4E60, "Mythril Mage Staff" #9BE1F3. Gem socket data (including the rune's history id), parts and models were unchanged.
    • A later hotbar switch did not rebuild the weapon again. A fresh magic weapon give came out as "Iron Mage Wand".
    • At a placed tfmc:magic_crafting_station, the assembly preview showed "Iron Mage Staff", and the crafted weapon on the station carries the name and magic:gear_name.
    • No Magic warnings or errors in the log.

🤖 Generated with Claude Code

Crafted mage weapons kept the template's plain white name ("Mage Staff",
"Mage Wand", "Mage Blade"), while AdvancedCrafting weapons and armour are
named and coloured after their majority material. Magic never wrote the
MMOItems name.

The core now names the weapon, since it already picks the model. A core's
optional `material:` (e.g. "#d8d8d8Iron") fills `%material%` in the
archetype's new `item-name:` (e.g. "%material% Mage Staff"), and the whole
name takes the material's colour. A core without `material:` falls back to
its name minus "Magical Core"; an archetype without `item-name:` uses
"%material% <name>". The name is written to the MMOItems data and its
original, as AdvancedCrafting does, so MMOItems updates keep it.

Crafting, socket rewrites, refreshes and the station preview all use it.
The name Magic wrote is kept in `magic:gear_name`, so the join/chest-open
refresh renames weapons crafted before this once, keeping their runes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the size:L 100-499 effective changed lines (tests excluded in mixed PRs). label Oct 19, 2026
@XxFran10xX

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0e4c9135-a8ff-4244-a7bf-07f18c1fb809
📥 Commits

Reviewing files that changed from the base of the PR and between c2c3e88 and d77d1de.

📒 Files selected for processing: 11
  • src/main/java/net/tfminecraft/magic/gear/ArchetypeDef.java
  • src/main/java/net/tfminecraft/magic/gear/GearItemBuilder.java
  • src/main/java/net/tfminecraft/magic/gear/GearKeys.java
  • src/main/java/net/tfminecraft/magic/gear/GearName.java
  • src/main/java/net/tfminecraft/magic/gear/GearRefresher.java
  • src/main/java/net/tfminecraft/magic/gear/PartDef.java
  • src/main/java/net/tfminecraft/magic/loader/GearLoader.java
  • src/main/resources/gear/archetypes.yml
  • src/main/resources/gear/parts.yml
  • src/test/java/net/tfminecraft/magic/GearItemCoverageTest.java
  • src/test/java/net/tfminecraft/magic/GearNameCoverageTest.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

  • New Features
    • Added configurable names for crafted staffs, wands and blades, including material-based naming.
    • Gear previews and rebuilt items now display their expected names.
  • Bug Fixes
    • Outdated gear names are corrected when items are refreshed, alongside existing gear updates.

This change adds configurable material-based names for crafted gear. It calculates expected names from archetype and core-part data, writes names through MMOItems, and stores the last written name in item metadata. Crafting, socket rewrites, previews and refreshes use this naming logic.

Changes: Gear naming

Layer / File(s) Summary
Name inputs and generation
src/main/java/net/tfminecraft/magic/gear/ArchetypeDef.java, src/main/java/net/tfminecraft/magic/gear/PartDef.java, src/main/java/net/tfminecraft/magic/gear/GearName.java, src/main/java/net/tfminecraft/magic/loader/GearLoader.java, src/main/resources/gear/archetypes.yml, src/main/resources/gear/parts.yml
Archetypes now define item-name templates, and core parts can define material names. GearName resolves a name from the archetype template and core material, with a fallback based on the core name.
Apply names and refresh outdated gear
src/main/java/net/tfminecraft/magic/gear/GearItemBuilder.java, src/main/java/net/tfminecraft/magic/gear/GearKeys.java, src/main/java/net/tfminecraft/magic/gear/GearName.java, src/main/java/net/tfminecraft/magic/gear/GearRefresher.java, src/test/java/net/tfminecraft/magic/GearItemCoverageTest.java, src/test/java/net/tfminecraft/magic/GearNameCoverageTest.java
Crafting and socket rewrites write and stamp the expected name. Previews use the expected name when available. Refreshing checks for outdated names and writes the updated name. Tests cover defaults, generation, storage and these gear flows.

Priority: ⬇️ Low

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

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant GearItemBuilder
  participant GearName
  participant MMOItem
  participant ItemStack
  GearItemBuilder->>GearName: expected(type, parts)
  GearItemBuilder->>MMOItem: write(name)
  GearItemBuilder->>MMOItem: build()
  GearItemBuilder->>GearName: stamp(rebuilt stack, name)
  GearName->>ItemStack: store name in metadata
Loading

Possibly related PRs

  • TF-Minecraft/Magic#27: Restores the gear-crafting flows that this change extends with configurable names.

Suggested reviewers: drefvelin, ryanbarlow97

Merge Risk: ⚪ Minimal · up to d77d1

The reviewed naming behavior is consistent with the intended fallback, and no issue remains that should block merging.

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

@coderabbitai

coderabbitai Bot commented Oct 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

Copy link
Copy Markdown
Contributor Author

Docs: TF-Minecraft/Docs#305

@XxFran10xX
XxFran10xX merged commit f7e174f into main Oct 19, 2026
3 checks passed
@XxFran10xX
XxFran10xX deleted the fix/mage-weapon-material-name branch October 19, 2026 16:27
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