Skip to content

Stat template tier-bonus: sword damage from leather/wool tier, animal-material defaults - #52

Merged
XxFran10xX merged 1 commit into
mainfrom
animal-tier-bonus
Nov 11, 2026
Merged

XxFran10xX merged 1 commit into
mainfrom
animal-tier-bonus

Conversation

@XxFran10xX

Copy link
Copy Markdown
Contributor

What

A stat template can now add a stat for each tier of an ingredient type:

sword:
  stats: [attack_damage, ...]
  tier-bonus:
    leather: attack_damage(0.125)
    wool: attack_damage(0.125)
  tier-bonus-neutral: 2

The bonus is per-tier x (average tier of that type's materials - neutral), so this sword gets -0.25 / 0 / +0.25 / +0.5 attack damage with common / rare / epic / legendary leather and wool. The sword keeps steady damage and gets no crit, damage reduction or movement speed. The stat must also be in the template's stats list (a load warning says so otherwise).

  • Craft, refresh and preview all go through it: CraftStatCalculator adds the bonus before the template filter. The craft-record refresh path uses the same code. The ingredient-station preview shows a hovered leather or wool item's bonus on the templates that use it.
  • Revision: only templates with a tier-bonus add it to their revision hash, so no other crafted item refreshes.
  • Rounding: bonuses are summed per stat before they are added. StatData rounds to 2 decimals on every merge, so adding -0.125 twice gave 3.26 instead of 3.25. The unit test caught this.

Default configs

These follow the 2026-11-11 animal-material pass that ships on Main with this release:

  • stats.yml: sword tier-bonus; spear and polearm accept entity_interaction_range; greataxe movement is leather/wool x 1.5 with no fixed part.
  • ingredients.yml: leather, wool and feathers give damage reduction 2 / 4 / 6 / 8 and toughness 0.25 / 0.5 / 0.75 / 1.0. Leather and wool also give reach 0.03 / 0.05 / 0.08 / 0.10.
  • config.yml: entity_interaction_range shows as "Reach".

The bundled defaults have no lute or shortsword template. Main's live config gets the lute tier-bonus and the shortsword movement change separately.

Testing

  • mvn verify: 181 tests and 100% coverage. The only failures are the 4 known Windows file-permission tests in EdgeCoverageTest and StationDatabaseCoverageTest, which fail on main too; Linux CI runs them.
  • New TierBonusTest: parsing (including invalid entries), the neutral tier, mixed tiers, alloys, ignored materials, the refresh path and the preview.
  • Dev (TFMCDev01) with Main's live configs plus the planned edits. A character bot got items through ac give equipment at filler tiers 1-4, and I read the exact values from the item data:
    • sword 3.25 / 3.5 / 3.75 / 4.0 (iron)
    • lute 5.75 / 6.0 / 6.25 / 6.5 (iron)
    • spear reach 0.26 / 0.30 / 0.36 / 0.40, polearm 0.46 / 0.60
    • warhammer DR 4 / 8 / 12 / 16, greathammer 8 / 12 / 16 / 20
    • shortsword movement 0.3–0.6, greataxe 0.9–1.8
    • light / medium / heavy toughness 0.25–1.0 / 0.75–1.5 / 1.75–2.5
  • Items given on the 2.7.0 jar refreshed to the new values after the restart.
  • In play, a held legendary spear gave 3.4 blocks of reach, and a legendary warhammer cut damage taken from 5.10 to 4.14 (bot as Templar).
  • The startup log had no AdvancedCrafting warnings.

🤖 Generated with Claude Code

… tier

A stat template can now add a stat per tier of an ingredient type
(tier-bonus: {leather: attack_damage(0.125)}), centred on
tier-bonus-neutral. Craft, refresh and the ingredient-station preview all
use it; templates without it keep their revision.

Default configs follow the 2026-11-11 animal-material pass: sword damage
-0.25/0/+0.25/+0.5 by leather/wool tier, spear and polearm take reach
from leather and wool (0.03-0.10 each), greataxe movement is leather/wool
x1.5, leather/wool/feather damage reduction 2/4/6/8 and toughness
0.25/0.5/0.75/1.0, and entity_interaction_range shows as Reach.

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

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • New Features

    • Crafting templates can now apply tier-based stat bonuses to eligible materials, including leather and wool bonuses for swords.
    • Previews reflect applicable tier bonuses, and the Reach stat now has a display name.
    • Spear and polearm stats now include reach.
  • Balance Changes

    • Updated toughness and reach values for leather, wool and feathers across tiers.
    • Reduced high-tier damage reduction for these materials.
    • Adjusted greataxe movement speed and removed its base blunt power.

Craft calculations now apply template bonuses based on material tiers. Ingredient and alloy previews pass tier data into the preview view. Resource configuration also changes material and equipment stats.

Changes: Tier-based stat bonuses

Layer / File(s) Summary
Configure tier bonuses and material stats
src/main/java/net/tfminecraft/advancedcrafting/objects/stats/StatTemplate.java, src/main/resources/config.yml, src/main/resources/ingredients.yml, src/main/resources/stats.yml
StatTemplate loads per-type tier bonuses and an optional neutral tier. Resource configuration adds or changes toughness and interaction-range values for leather, wool, and feather. Sword configuration adds leather and wool attack-damage bonuses. Spear and polearm stats include interaction range. Greataxe configuration removes base blunt power and changes its movement-speed factor.
Apply bonuses during craft calculation
src/main/java/net/tfminecraft/advancedcrafting/utils/BucketStatAverager.java, src/main/java/net/tfminecraft/advancedcrafting/utils/CraftStatCalculator.java, src/main/java/net/tfminecraft/advancedcrafting/utils/TierBonusCalculator.java, src/test/java/net/tfminecraft/advancedcrafting/TierBonusTest.java
Craft inputs are converted to material maps. Craft calculations apply amount-weighted tier bonuses before applying the template. Tests cover bonus configuration, material tiers, craft results, and preview behaviour.
Pass tier data into previews
src/main/java/net/tfminecraft/advancedcrafting/managers/IngredientManager.java, src/main/java/net/tfminecraft/advancedcrafting/managers/InventoryManager.java, src/main/java/net/tfminecraft/advancedcrafting/utils/TierBonusCalculator.java, src/test/java/net/tfminecraft/advancedcrafting/IngredientManagerCoverageTest.java
Ingredient and alloy source resolution now returns stats with a tier source. The preview view uses bonus-adjusted stats for template matching and preview items. The existing coverage test supplies the added tier argument.

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

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant CraftInputs
  participant CraftStatCalculator
  participant BucketStatAverager
  participant TierBonusCalculator
  participant StatTemplate
  CraftInputs->>CraftStatCalculator: provide inputs
  CraftStatCalculator->>BucketStatAverager: convert inputs to materials
  BucketStatAverager-->>CraftStatCalculator: return materials
  CraftStatCalculator->>BucketStatAverager: compute bucket stats
  BucketStatAverager-->>CraftStatCalculator: return stats
  CraftStatCalculator->>TierBonusCalculator: apply bonuses from materials
  TierBonusCalculator-->>CraftStatCalculator: return adjusted stats
  CraftStatCalculator->>StatTemplate: apply template
Loading

Possibly related PRs

Suggested reviewers: ryanbarlow97

Merge Risk: Minimal · up to f3ba5

The change adds tier-based stat bonuses for crafting and previews and updates the bundled defaults. No actionable merge-blocking risk was identified in the supplied material.

- [ ] 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: c437bdf5-2bde-4865-ba65-7bc5a647cbfd
Commits

Reviewing files that changed from the base of the PR and between 0b2cf85 and f3ba56e.

Files selected for processing: 11

  • src/main/java/net/tfminecraft/advancedcrafting/managers/IngredientManager.java
  • src/main/java/net/tfminecraft/advancedcrafting/managers/InventoryManager.java
  • src/main/java/net/tfminecraft/advancedcrafting/objects/stats/StatTemplate.java
  • src/main/java/net/tfminecraft/advancedcrafting/utils/BucketStatAverager.java
  • src/main/java/net/tfminecraft/advancedcrafting/utils/CraftStatCalculator.java
  • src/main/java/net/tfminecraft/advancedcrafting/utils/TierBonusCalculator.java
  • src/main/resources/config.yml
  • src/main/resources/ingredients.yml
  • src/main/resources/stats.yml
  • src/test/java/net/tfminecraft/advancedcrafting/IngredientManagerCoverageTest.java
  • src/test/java/net/tfminecraft/advancedcrafting/TierBonusTest.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 11, 2026
@XxFran10xX

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 11, 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 98246a8 into main Nov 11, 2026
3 checks passed
@XxFran10xX
XxFran10xX deleted the animal-tier-bonus branch November 11, 2026 13:10
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