Step goal quantity by one recipe's output, not always 1.
Build / build (push) Failing after 30s

Capture, +, and - use RecipeProvider.outputCount. Planks move by 4. Gather stays 1. Minus at or below one yield removes the goal.
This commit is contained in:
Stephen Fasciani
2026-09-09 01:40:16 -04:00
parent d0033d613a
commit 3beaa12706
21 changed files with 128 additions and 35 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ Read [[🧠 Philosophy]] before changing the vault. The Bookshelf Principle, Pre
## Code
The first slice is in code and has been played (ADRs 012–020): [[▶️ Create Goal]], [[🔌 Recipe Provider]] via `RecipeManager`, overlay HUD, capture = tooltip + rebindable Add key, client-owned plan files. Tag ingredients are any-of (ADR-019). Completion is manual, plus opt-in `/satistaskory auto-remove` (ADR-020).
The first slice is in code and has been played (ADRs 012–021): [[▶️ Create Goal]], [[🔌 Recipe Provider]] via `RecipeManager`, overlay HUD, capture = tooltip + rebindable Add key, client-owned plan files. Tag ingredients are any-of (ADR-019). Completion is manual, plus opt-in `/satistaskory auto-remove` (ADR-020).
Do not start EMI/JEI/REI. Recipe source is `RecipeManager` (ADR-016). The host does not need this mod (ADR-018). Project waits until settled. Do not rewrite the overlay as a `Screen` unless the HUD path fails.
+3 -4
View File
@@ -33,10 +33,9 @@ Target Quantity is required and is never 0.
| Action | Result |
|--------|--------|
| [[▶️ Create Goal]] | Quantity **1** if new; **+1** if that ItemId already exists |
| `[+]` on the overlay | Quantity + 1 |
| `[-]` when quantity > 1 | Quantity − 1 |
| `[-]` when quantity is 1 | Goal is **removed** |
| [[▶️ Create Goal]] | One recipe’s output if new; **+ that output** if the ItemId already exists. No recipe → 1 |
| `[+]` on the overlay | + one recipe’s output (planks +4). No recipe → +1 |
| `[-]` | − one recipe’s output. At or below that step, the goal is **removed** |
| `X Clear Items` | All goals removed |
There is no quantity picker on capture. See [[🖥️ Experience]].
@@ -25,7 +25,7 @@ A thing the player wishes to obtain.
Contains: Target Item (**ItemId**, `namespace:path`), Target Quantity (≥ 1).
One Goal per ItemId in the plan. Create at 1, or +1 if that item is already a goal. `[-]` at 1 removes it.
One Goal per ItemId in the plan. Create / `[+]` / `[-]` step by one recipe’s output (no recipe → 1). `[-]` at or below one yield removes it.
Examples: 4 Ender Chests. 1 AE2 Controller. 64 Export Buses.
+1 -1
View File
@@ -17,7 +17,7 @@ Capture (hover item → Add key) is one caller. The use case does not know about
## Quantity
Always **1** on this path. New goal: quantity 1. Existing goal: quantity + 1.
One recipe’s output on this path (and on overlay `[+]`). New goal: that many. Existing goal: + that many. No recipe → 1.
---
+18
View File
@@ -368,6 +368,24 @@ The walk: finished items stayed on the overlay until a click. For a prosthetic t
---
### ADR-021 — Quantity steps by recipe output
**Date:** 2026-09-08
**Decision:** Capture, `[+]`, and `[-]` move Target Quantity by **one recipe’s output count**, not always 1. Oak planks +4. A furnace +1. No recipe → 1. `[-]` at or below one yield removes the goal.
The same recipe `VanillaRecipeProvider` already picked for ingredients. Ingredient math stays aligned with crafts.
**Reason:**
The walk: items that craft in stacks of 4 still ticked by 1, so the overlay was counting pieces instead of crafts.
**Status:** ✅ Accepted
**Supersedes:** ADR-012’s “Create = 1 / +1” freeze for quantity steps.
---
## Related Documents
[[🏛️ Architecture]]
@@ -13,6 +13,8 @@ Infrastructure answers. The domain never imports a recipe **viewer** (EMI/JEI/RE
RecipeProvider
resolve(ItemId target, int quantity)
→ list of MaterialRequirement
outputCount(ItemId target)
→ how many one recipe produces (gather → 1)
```
`ItemId` is `namespace:path` (e.g. `minecraft:furnace`). Not `net.minecraft.world.item.Item`.
+1 -1
View File
@@ -6,7 +6,7 @@ What exists, and what is next. Implementation detail will live in an Implementat
## ✅ Now (docs)
- Philosophy Rules #1–#10; ADRs **001–020**
- Philosophy Rules #1–#10; ADRs **001–021**
- Vision, ubiquitous language, bounded context (one: Goal Planning)
- Goal invariants: one per ItemId, quantity ≥ 1, create at 1 / +1, `[-]` at 1 removes
- Packages named; [[🔌 Recipe Provider]] sketched; [[▶️ Create Goal]] written
@@ -453,6 +453,16 @@ Cut `0.1.0-alpha.1` for friend testers. Client jar. Host does not need the mod.
---
## 📜 2026-09-08 (step by recipe yield)
Greetings, Wayfinder.
The walk: `[+]` on planks added 1, not 4.
ADR-021: capture / `+` / `−` step by `RecipeProvider.outputCount`. Same picked recipe as ingredients. Gather stays 1.
---
## 📜 2026-09-08 (the black screen was HDR)
Greetings, Wayfinder.
+1 -1
View File
@@ -48,7 +48,7 @@ As a player
I want `[+]` / `[-]` on a goal
so I can set Target Quantity while I play.
Screen 2. Capture starts at 1 (or +1). `[-]` at 1 removes the goal.
Screen 2. Capture and `[+]` add one recipe’s yield. `[-]` subtracts that yield.
### US-6 — Clear the plan
+3 -3
View File
@@ -35,7 +35,7 @@ Interaction:
1. Hover the item
2. Tooltip includes `[+] Add to Crafting Goals` (bound key)
3. Press that key — [[▶️ Create Goal]] — quantity **1**, or **+1** if that item is already a goal
3. Press that key — [[▶️ Create Goal]] — one recipe’s yield (or 1 if none), or + that yield if already a goal
4. Player closes the view and is back in the world
5. The item is a row on the overlay’s goal list
@@ -80,9 +80,9 @@ A full-screen planner is not this surface. It is not discovered.
## Quantity
Capture always applies **1** (new goal) or **+1** (existing). No picker on Screen 1.
Capture and `[+]` apply **one recipe’s yield** (oak planks → 4). No recipe → 1. No picker on Screen 1.
`[+]` / `[-]` on the overlay change quantity. `[-]` at 1 removes the goal. There is no 0.
`[-]` subtracts that same yield. At or below one yield, the goal is removed. There is no 0.
---
+1 -1
View File
@@ -25,7 +25,7 @@ Satistaskory draws only a tooltip line. The mouse stays on the item.
[+] Add to Crafting Goals
```
**Primary action:** hover the item, press the Add key (default `=`, rebindable in Controls) → [[▶️ Create Goal]] (quantity 1, or +1 if present) → close the host view → the item is a row on Screen 2.
**Primary action:** hover the item, press the Add key (default `=`, rebindable in Controls) → [[▶️ Create Goal]] (one recipe’s yield, or + that yield if present) → close the host view → the item is a row on Screen 2.
Same control in inventory, crafting pane, and craft book. We do not restyle those views. We do not draw a click target you have to leave the item to hit.
+1 -1
View File
@@ -107,7 +107,7 @@ Player copy **Crafting Goals**. Domain: [[🎯 Goal]]. See [[🖥️ Experience]
### Quantity
A goal has a Target Quantity. Hover-add starts at **1**, or **+1** if that item is already a goal. The overlay changes it with `[+]` / `[-]`. `[-]` at 1 removes the goal.
A goal has a Target Quantity. Hover-add and `[+]` add **one recipe’s yield** (planks 4, furnace 1). `[-]` subtracts that yield and removes the goal at or below it.
---
@@ -9,6 +9,7 @@ import com.sufficient.satistaskory.domain.InventoryState;
import com.sufficient.satistaskory.domain.ItemId;
import com.sufficient.satistaskory.domain.ProgressCalculation;
import com.sufficient.satistaskory.domain.ProgressSnapshot;
import com.sufficient.satistaskory.domain.RecipeResolution;
/**
* Application facade for the first slice. Persistence is the store's job.
@@ -17,11 +18,17 @@ public final class Planner {
private final GoalStore store;
private final ProgressCalculation progress;
private final Supplier<InventoryState> inventory;
private final RecipeResolution resolution;
public Planner(GoalStore store, ProgressCalculation progress, Supplier<InventoryState> inventory) {
public Planner(
GoalStore store,
ProgressCalculation progress,
Supplier<InventoryState> inventory,
RecipeResolution resolution) {
this.store = Objects.requireNonNull(store, "store");
this.progress = Objects.requireNonNull(progress, "progress");
this.inventory = Objects.requireNonNull(inventory, "inventory");
this.resolution = Objects.requireNonNull(resolution, "resolution");
}
public List<Goal> goals() {
@@ -34,25 +41,28 @@ public final class Planner {
public ProgressSnapshot create(ItemId item) {
Objects.requireNonNull(item, "item");
int step = step(item);
store.find(item).ifPresentOrElse(
existing -> store.put(existing.increment()),
() -> store.put(new Goal(item, 1)));
existing -> store.put(existing.plus(step)),
() -> store.put(new Goal(item, step)));
return refresh();
}
public ProgressSnapshot increment(ItemId item) {
Objects.requireNonNull(item, "item");
store.find(item).ifPresent(existing -> store.put(existing.increment()));
int step = step(item);
store.find(item).ifPresent(existing -> store.put(existing.plus(step)));
return refresh();
}
public ProgressSnapshot decrement(ItemId item) {
Objects.requireNonNull(item, "item");
int step = step(item);
store.find(item).ifPresent(existing -> {
if (existing.quantity() == 1) {
if (existing.quantity() <= step) {
store.remove(item);
} else {
store.put(existing.decrement());
store.put(new Goal(item, existing.quantity() - step));
}
});
return refresh();
@@ -87,6 +97,10 @@ public final class Planner {
});
}
private int step(ItemId item) {
return resolution.outputCount(item);
}
private ProgressSnapshot refresh() {
return progress.calculate(store.all(), inventory.get());
}
@@ -26,7 +26,14 @@ public final class Goal {
}
public Goal increment() {
return new Goal(targetItem, quantity + 1);
return plus(1);
}
public Goal plus(int amount) {
if (amount < 1) {
throw new IllegalArgumentException("amount must be >= 1");
}
return new Goal(targetItem, quantity + amount);
}
public Goal decrement() {
@@ -11,4 +11,11 @@ public interface RecipeProvider {
* One crafting level. No recipe → {@code (target, quantity)}. {@code quantity < 1} → empty.
*/
List<MaterialRequirement> resolve(ItemId target, int quantity);
/**
* How many of {@code target} one recipe produces. Gather / unknown → 1.
*/
default int outputCount(ItemId target) {
return 1;
}
}
@@ -16,4 +16,8 @@ public final class RecipeResolution {
}
return provider.resolve(target, quantity);
}
public int outputCount(ItemId target) {
return Math.max(1, provider.outputCount(target));
}
}
@@ -32,7 +32,7 @@ public final class PlannerSession {
RecipeResolution resolution = new RecipeResolution(new VanillaRecipeProvider());
ProgressCalculation progress = new ProgressCalculation(resolution, new MaterialAggregation());
store = new PersistingGoalStore();
planner = new Planner(store, progress, PlannerSession::currentInventory);
planner = new Planner(store, progress, PlannerSession::currentInventory, resolution);
ClientSettings.load();
obtained.reset();
}
@@ -18,6 +18,7 @@ public final class StubRecipeProvider implements RecipeProvider {
private static final ItemId CHEST = ItemId.parse("minecraft:chest");
private static final ItemId COBBLESTONE = ItemId.parse("minecraft:cobblestone");
private static final ItemId OAK_PLANKS = ItemId.parse("minecraft:oak_planks");
private static final ItemId OAK_LOG = ItemId.parse("minecraft:oak_log");
private final Map<ItemId, Recipe> recipes = new HashMap<>();
@@ -25,6 +26,13 @@ public final class StubRecipeProvider implements RecipeProvider {
recipes.put(FURNACE, new Recipe(1, List.of(new MaterialRequirement(COBBLESTONE, 8))));
recipes.put(CRAFTING_TABLE, new Recipe(1, List.of(new MaterialRequirement(OAK_PLANKS, 4))));
recipes.put(CHEST, new Recipe(1, List.of(new MaterialRequirement(OAK_PLANKS, 8))));
recipes.put(OAK_PLANKS, new Recipe(4, List.of(new MaterialRequirement(OAK_LOG, 1))));
}
@Override
public int outputCount(ItemId target) {
Recipe recipe = recipes.get(target);
return recipe == null ? 1 : recipe.outputCount();
}
@Override
@@ -34,20 +34,11 @@ public final class VanillaRecipeProvider implements RecipeProvider {
if (quantity < 1) {
return List.of();
}
Minecraft minecraft = Minecraft.getInstance();
if (minecraft.level == null) {
return gather(target, quantity);
}
Item item = BuiltInRegistries.ITEM.get(ResourceLocation.parse(target.toString()));
if (item == Items.AIR && !target.toString().equals("minecraft:air")) {
return gather(target, quantity);
}
HolderLookup.Provider registries = minecraft.level.registryAccess();
RecipeHolder<?> chosen = pick(minecraft.level.getRecipeManager(), registries, item);
RecipeHolder<?> chosen = chosen(target);
if (chosen == null) {
return gather(target, quantity);
}
HolderLookup.Provider registries = Minecraft.getInstance().level.registryAccess();
ItemStack result = chosen.value().getResultItem(registries);
int outputCount = Math.max(1, result.getCount());
@@ -77,6 +68,28 @@ public final class VanillaRecipeProvider implements RecipeProvider {
return List.copyOf(requirements);
}
@Override
public int outputCount(ItemId target) {
RecipeHolder<?> chosen = chosen(target);
if (chosen == null) {
return 1;
}
ItemStack result = chosen.value().getResultItem(Minecraft.getInstance().level.registryAccess());
return Math.max(1, result.getCount());
}
private static RecipeHolder<?> chosen(ItemId target) {
Minecraft minecraft = Minecraft.getInstance();
if (minecraft.level == null) {
return null;
}
Item item = BuiltInRegistries.ITEM.get(ResourceLocation.parse(target.toString()));
if (item == Items.AIR && !target.toString().equals("minecraft:air")) {
return null;
}
return pick(minecraft.level.getRecipeManager(), minecraft.level.registryAccess(), item);
}
private static RecipeHolder<?> pick(RecipeManager manager, HolderLookup.Provider registries, Item target) {
RecipeHolder<?> best = null;
int bestScore = Integer.MIN_VALUE;
@@ -25,7 +25,7 @@ class ObtainedCompletionTest {
void setUp() {
RecipeResolution resolution = new RecipeResolution(new StubRecipeProvider());
ProgressCalculation progress = new ProgressCalculation(resolution, new MaterialAggregation());
planner = new Planner(new InMemoryGoalStore(), progress, InventoryState::empty);
planner = new Planner(new InMemoryGoalStore(), progress, InventoryState::empty, resolution);
completion = new ObtainedCompletion();
}
@@ -32,7 +32,7 @@ class PlannerTest {
inventory = InventoryState.empty();
RecipeResolution resolution = new RecipeResolution(new StubRecipeProvider());
ProgressCalculation progress = new ProgressCalculation(resolution, new MaterialAggregation());
planner = new Planner(new InMemoryGoalStore(), progress, () -> inventory);
planner = new Planner(new InMemoryGoalStore(), progress, () -> inventory, resolution);
}
@Test
@@ -43,6 +43,17 @@ class PlannerTest {
assertEquals(2, second.goals().getFirst().quantity());
}
@Test
void plusStepsByRecipeOutput() {
planner.create(OAK_PLANKS);
assertEquals(4, planner.goals().getFirst().quantity());
planner.increment(OAK_PLANKS);
assertEquals(8, planner.goals().getFirst().quantity());
planner.decrement(OAK_PLANKS);
assertEquals(4, planner.goals().getFirst().quantity());
assertTrue(planner.decrement(OAK_PLANKS).goals().isEmpty());
}
@Test
void decrementAtOneRemoves() {
planner.create(FURNACE);