Skip to content

Recycle spent artifact husks at half their rarity's dust - #38

Merged
XxFran10xX merged 2 commits into
mainfrom
artifact-husks
Oct 20, 2026
Merged

XxFran10xX merged 2 commits into
mainfrom
artifact-husks

Conversation

@XxFran10xX

@XxFran10xX XxFran10xX commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What

Magic 0.9.0 makes artifacts wear out in meditation and crumble into spent husks. Husks hold no aura and are no longer artifacts to Magic, so ArtifactProvider now takes them separately:

  • A husk returns artifact_returns.husk_fraction (0.0-1.0, default 0.5) of its rarity's amount, rounded down. For example, a Legendary husk returns 14 dust.
  • min_muffle does not apply to husks, since they hold no aura.
  • A husk worth 0 is refused before recipe fallback, the same as an artifact.

The Epic row stays in the table, now commented as legacy, because Magic no longer rolls Epic and older Epic artifacts should still recycle at their value.

Dependency

magic.version goes from 0.4.7 to 0.9.0 for ArtifactWear. Hold this PR until Magic 0.9.0 is released, or CI can't resolve the jar. At runtime the husk checks only run when ArtifactWear exists, so this Recycler keeps recycling everything normally against an older Magic; husks simply need 0.9.0.

Tests

  • New ArtifactProviderTest case for husks, and LoadersTest covers husk_fraction defaults and clamping.
  • Built locally against the Magic branch: JaCoCo reports no missed lines or branches in ArtifactProvider, ConfigLoader or Cache.
  • The ownership and escrow suites fail on Windows only (POSIX permissions), as before.

🤖 Generated with Claude Code

Magic 0.9.0 crumbles worn-out artifacts into aura-less husks. They skip
min_muffle and return artifact_returns.husk_fraction (default 0.5) of the
rarity amount, rounded down. Needs Magic 0.9.0.

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

coderabbitai Bot commented Oct 20, 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: b089fa73-ccda-491a-85d6-c64c23e9d8d2
📥 Commits

Reviewing files that changed from the base of the PR and between b402088 and 9909b5c.

📒 Files selected for processing: 2
  • src/main/java/net/tfminecraft/recycler/provider/ArtifactProvider.java
  • src/test/java/net/tfminecraft/recycler/ArtifactProviderTest.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 support for recycling spent artifact husks when artifact wear support is available.
    • Spent husks return a configurable share of their rarity-based value, defaulting to 50%, rounded down.
    • Husks can be recycled without meeting the minimum muffle requirement.
  • Configuration

    • Added artifact_returns.husk_fraction, accepting values from 0 to 1.
    • Invalid values are constrained to the supported range.
    • Husks produce no output when the configured fraction is zero.

The change adds a configurable return fraction for spent artifact husks. The provider recognises husks, bypasses normal artifact and muffle checks, and calculates a rarity-based return rounded down.

Changes: Spent artifact husk returns

Layer / File(s) Summary
Configure husk return fraction
pom.xml, src/main/java/net/tfminecraft/recycler/Cache.java, src/main/java/net/tfminecraft/recycler/loader/ConfigLoader.java, src/main/resources/config.yml, src/test/java/net/tfminecraft/recycler/LoadersTest.java
The magic dependency is upgraded to 0.9.0. A default husk_fraction of 0.5 is added. The loader reads configured values from 0.0 to 1.0 and restores the default when the configuration is empty. Tests cover defaults, overrides, and clamping.
Handle spent husks
src/main/java/net/tfminecraft/recycler/provider/ArtifactProvider.java, src/test/java/net/tfminecraft/recycler/ArtifactProviderTest.java
Spent husks bypass normal artifact and muffle checks. Their rarity-based return is scaled by artifactHuskFraction and rounded down. Tests cover eligibility, output calculation, class detection, and the zero-fraction case.

Priority: ⬇️ Low

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

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant ArtifactProvider
  participant ArtifactWear
  participant Cache
  ArtifactProvider->>ArtifactWear: Detect and identify spent husk
  ArtifactProvider->>Cache: Read artifactHuskFraction
  ArtifactProvider-->>ArtifactProvider: Scale rarity return and round down
Loading
Merge Risk: ⚪ Minimal · up to 9909b

No actionable issue is established by this review. The requested wait for Magic 0.9.0 remains a release-timing decision.

✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • 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:S 10-29 effective changed lines (tests excluded in mixed PRs). label Oct 20, 2026
@XxFran10xX

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

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

coderabbitai[bot]
coderabbitai Bot previously approved these changes Oct 20, 2026
The chain asks ArtifactProvider about every item, so touching
ArtifactWear on Magic 0.8.x or older would break all recycling. Husk
checks now run only when the class is present.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added size:M 30-99 effective changed lines (tests excluded in mixed PRs). and removed size:S 10-29 effective changed lines (tests excluded in mixed PRs). labels Oct 20, 2026
@XxFran10xX

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 20, 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 68a1f81 into main Oct 20, 2026
3 of 4 checks passed
@XxFran10xX
XxFran10xX deleted the artifact-husks branch October 20, 2026 21:32
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