Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion projects/AdvancedCrafting/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/<player-uuid>.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;
Expand Down
6 changes: 4 additions & 2 deletions projects/Recycler/docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ net.tfminecraft.recycler/
RecycleResult.java
RecycleProviderChain.java
AdvancedCraftingProvider.java
AlloyScrapProvider.java
MagicGearProvider.java
GunsAndGadgetsProvider.java
GoldsmithProvider.java
Expand Down Expand Up @@ -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 |
Expand All @@ -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)
Expand All @@ -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

Expand Down
11 changes: 11 additions & 0 deletions projects/Recycler/docs/SYSTEM.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,20 @@ 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`):

```
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.
Expand All @@ -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.
Expand Down