From 52d0863bbab570596d1464f946fd6112bea623b2 Mon Sep 17 00:00:00 2001 From: XxFran10xX <318299142+XxFran10xX@users.noreply.github.com> Date: Sun, 27 Sep 2026 18:50:08 +0200 Subject: [PATCH] docs(recycler): alloy scrap recycles into its base metal Document AlloyScrapProvider, scrap_return_rate, and the ac_scrap_base tag AdvancedCrafting 2.2.0 puts on failed-forge scrap. Co-Authored-By: Claude Opus 5.5 (1M context) --- projects/AdvancedCrafting/architecture.md | 4 +++- projects/Recycler/docs/ARCHITECTURE.md | 6 ++++-- projects/Recycler/docs/SYSTEM.md | 11 +++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/projects/AdvancedCrafting/architecture.md b/projects/AdvancedCrafting/architecture.md index 77262f0..f2c122c 100644 --- a/projects/AdvancedCrafting/architecture.md +++ b/projects/AdvancedCrafting/architecture.md @@ -24,7 +24,9 @@ Stations are JSON files under `data/stations`; alloy state is under `data/alloys alloy recipes are under `data/alloy-recipes`. `data/revisions.json` tracks item configuration revisions. `data/forged-alloys/.json` tracks each player's discovered/forged alloys. Crafted items also retain tags and provenance -in their persistent data containers. +in their persistent data containers. Scrap from a failed alloy forge carries the +base ingredient id (`ac_scrap_base`, read with `objects.data.ScrapProvenance`) so +Recycler can return that base metal. On disable the plugin flushes revisions, clears saved station files, and rewrites stations from the in-memory manager. Use a clean stop for backups and restores; diff --git a/projects/Recycler/docs/ARCHITECTURE.md b/projects/Recycler/docs/ARCHITECTURE.md index 4f99281..a36d0c1 100644 --- a/projects/Recycler/docs/ARCHITECTURE.md +++ b/projects/Recycler/docs/ARCHITECTURE.md @@ -29,6 +29,7 @@ net.tfminecraft.recycler/ RecycleResult.java RecycleProviderChain.java AdvancedCraftingProvider.java + AlloyScrapProvider.java MagicGearProvider.java GunsAndGadgetsProvider.java GoldsmithProvider.java @@ -60,6 +61,7 @@ Specialized providers run before the config fallback: | Priority | Provider | When active | |----------|----------|-------------| | 10 | `AdvancedCraftingProvider` | AdvancedCrafting plugin present | +| 11 | `AlloyScrapProvider` | AdvancedCrafting present; scrap tagged with its base metal | | 15 | `MagicGearProvider` | Magic present with stamped gear provenance | | 20 | `GunsAndGadgetsProvider` | GunsAndGadgets present with stamped provenance | | 25 | `GoldsmithProvider` | GemInfusion present; item matches one jewelry project | @@ -69,7 +71,7 @@ Resolution flow: 1. `canHandle(item)` on each provider in order. 2. `resolveBaseOutputs(item)` returns base material amounts. -3. `RecycleContext` applies `max_return_rate` (default 0.8) and durability factor. +3. `RecycleContext` applies the provider's `returnRate()` (`max_return_rate`, default 0.8; `scrap_return_rate`, default 0.5, for alloy scrap; 1.0 for config recipes) and durability factor. 4. `floor(base * rate * durability * stackSize)` per output line. ## Escrow (crash safety) @@ -87,7 +89,7 @@ The GUI is **not** the source of truth for the input item. - **Required:** TLibs, ItemsAdder (station block + icons) - **Soft:** AdvancedCrafting, Magic, GunsAndGadgets, GemInfusion, MMOItems -AdvancedCrafting, Magic, and GunsAndGadgets providers require stamped provenance from those plugins. Goldsmithing matches the live jewelry project for the item. Admin escrow tooling: `/recycler escrow list|return`. +AdvancedCrafting, Magic, and GunsAndGadgets providers require stamped provenance from those plugins. The alloy scrap provider needs AdvancedCrafting 2.2.0 or newer (`ScrapProvenance`). Goldsmithing matches the live jewelry project for the item. Admin escrow tooling: `/recycler escrow list|return`. ## What not to add yet diff --git a/projects/Recycler/docs/SYSTEM.md b/projects/Recycler/docs/SYSTEM.md index 5360ae5..c359f98 100644 --- a/projects/Recycler/docs/SYSTEM.md +++ b/projects/Recycler/docs/SYSTEM.md @@ -31,6 +31,12 @@ Provider recipes (AdvancedCrafting, Magic, GunsAndGadgets, goldsmithing): final_amount = floor(base_amount * max_return_rate * durability_factor * stack_amount) ``` +AdvancedCrafting alloy scrap: + +``` +final_amount = floor(1 * scrap_return_rate * stack_amount) +``` + Config recipes (`recipes/*.yml`): ``` @@ -38,6 +44,7 @@ final_amount = floor(base_amount * durability_factor * stack_amount) ``` - `max_return_rate`: config default `0.8` (80% cap). Applies to AdvancedCrafting, Magic, GunsAndGadgets, and goldsmithing providers, not yaml config recipes. +- `scrap_return_rate`: config default `0.5` (1 base metal per 2 scrap). Only applies to alloy scrap; `max_return_rate` does not. Values outside `0.0`-`1.0` are clamped with a console warning. - `durability_factor`: `0.0` when broken, `1.0` when full. Vanilla `Damageable` items and MMOItems custom durability NBT when MMOItems is present. - `stack_amount`: full stack placed in station (one stack per deposit). - Use `floor`; zero yield blocks confirm when `block_confirm_when_zero_yield` is true. @@ -52,6 +59,10 @@ Map `ingredient.*` inputs to live `Ingredient.getPath()` x stamped amount. Map ` Raw AC ingredients/alloys (`ac_ingredient_id` / `ac_alloy_id`) are not provenance-backed - handle via config recipes or a future AC rule. +### AdvancedCrafting (alloy scrap) + +A failed alloy forge tags its scrap with the base ingredient id (`ac_scrap_base`, AdvancedCrafting 2.2.0+). `AlloyScrapProvider` reads it with `ScrapProvenance.readBaseId` and returns one live `Ingredient.getPath()` per scrap, scaled by `scrap_return_rate`. Output rounds down per deposit, so a single scrap at `0.5` is a zero-yield deposit; players stack scrap first. Scrap forged before 2.2.0 has no tag and is not handled. Scrap from different base metals does not stack. + ### GunsAndGadgets (guns) Read stamped part list from gun PDC (`gg_craft_parts`), sum each `GunPart.getCost()` from live `parts.yml` via `GunsAndGadgetsProvider`. Broken guns and guns with missing stamped ids are not handled by this provider.