/satistaskory auto-remove. Off by default. A gain in held target items reduces quantity and removes the goal at 0. Player inventory only. Already-held stacks are a baseline, not a wipe.
This commit is contained in:
@@ -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–019): [[▶️ Create Goal]], [[🔌 Recipe Provider]] via `RecipeManager`, overlay HUD, capture = tooltip + rebindable Add key, client-owned plan files. Tag ingredients are any-of (ADR-019).
|
||||
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).
|
||||
|
||||
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.
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ First slice is in `src/` and has been played: domain, `VanillaRecipeProvider` (`
|
||||
|
||||
On a server, the plan follows the **name you gave that server in the multiplayer list** (and its MOTD), not the IP. **Do not rename the list entry** if you still need those Crafting Goals. Renaming starts an empty plan. Rebuilding it from memory is the thing this mod is supposed to spare you.
|
||||
|
||||
`/satistaskory add minecraft:furnace` is a debug command. Not EMI. Template example block/item is gone.
|
||||
`/satistaskory add minecraft:furnace` is a debug command. `/satistaskory auto-remove` counts picking up a goal item as done (off by default). Not EMI. Template example block/item is gone.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -8,13 +8,12 @@ A [[🎯 Goal]] that the player considers finished.
|
||||
|
||||
Must be configurable.
|
||||
|
||||
Examples:
|
||||
Shipped:
|
||||
|
||||
- Manual completion
|
||||
- Inventory detection
|
||||
- Future implementations
|
||||
- Manual: `[−]` at 1, or Clear
|
||||
- Inventory detection (opt-in): `/satistaskory auto-remove` — picking up the goal item counts that many as done. Player inventory only. Dumping the item in a chest does not restore the quantity. Turning it on (or joining a world) baselines what you already hold; it does not wipe the list for items already on you.
|
||||
|
||||
Ready To Craft is not completion. See [[🛠️ Ready To Craft]] and Philosophy Rule #5.
|
||||
Ready To Craft is not completion. Auto-remove is off until the player turns it on. See [[🛠️ Ready To Craft]] and Philosophy Rule #5.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ Completed
|
||||
|
||||
A goal is created with a target item and quantity. [[🧾 Recipe Resolution]] produces its [[🧱 Material Requirement|material requirements]] for **how many are still to obtain** (target quantity minus how many of that item are already available). [[📈 Progress Calculation]] compares those requirements to [[🎒 Inventory State]], yielding [[📉 Missing Material|missing materials]] and eventually [[🛠️ Ready To Craft]].
|
||||
|
||||
[[✅ Completed Goal|Completion]] is a separate decision from readiness. It is **not in the first slice**.
|
||||
[[✅ Completed Goal|Completion]] is a separate decision from readiness. Manual `[−]` / Clear always. Inventory detection is opt-in (`/satistaskory auto-remove`): a gain in held target items reduces quantity and removes the goal at 0.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ Needed so Screen 2’s `[+]`, `[-]`, and Clear are not invented in the UI.
|
||||
| **Remove Goal** | ItemId | Goal gone, then RefreshProgress |
|
||||
| **Clear Goals** | — | All goals gone, then RefreshProgress |
|
||||
| **Refresh Progress** | — | Recompute missing list from current goals + inventory |
|
||||
| **Auto-remove (opt-in)** | Pickup of the goal item | Quantity down by the gain; gone at 0. `/satistaskory auto-remove` |
|
||||
|
||||
`[-]` on the overlay: if quantity > 1, Adjust −1; if quantity is 1, Remove Goal. The overlay does not keep a 0.
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ Resolution converts one goal into requirements. Aggregation combines active goal
|
||||
|
||||
Having the diamonds is not the same as considering the work finished.
|
||||
|
||||
**Status:** ✅ Accepted
|
||||
**Status:** ✅ Accepted. Opt-in inventory detection: ADR-020.
|
||||
|
||||
---
|
||||
|
||||
@@ -348,6 +348,26 @@ A chest crafts from any `#minecraft:planks`. Picking `getItems()[0]` made spruce
|
||||
|
||||
---
|
||||
|
||||
### ADR-020 — Opt-in: picking up the goal item can complete it
|
||||
|
||||
**Date:** 2026-09-08
|
||||
|
||||
**Decision:** Inventory-detection completion is a **player toggle**: `/satistaskory auto-remove` `[on|off]`. Default **off**.
|
||||
|
||||
When on, an **increase** in how many of the goal item the player is holding counts that many toward the goal. Quantity drops. At 0 the goal is removed. Player inventory only. Putting the item in a chest does not restore quantity. Enabling the toggle, or joining a world, baselines current holdings so already-held stacks do not wipe the list.
|
||||
|
||||
Manual `[−]` / Clear remain. Ready is still not complete.
|
||||
|
||||
**Reason:**
|
||||
|
||||
The walk: finished items stayed on the overlay until a click. For a prosthetic that is extra working memory. Auto-removing whenever `held >= target` would also delete a new goal the moment they add it while carrying any of that item. Counting **gains** avoids that.
|
||||
|
||||
**Status:** ✅ Accepted
|
||||
|
||||
**Refines:** ADR-008 (completion is configurable; this is the inventory-detection option)
|
||||
|
||||
---
|
||||
|
||||
## Related Documents
|
||||
|
||||
[[🏛️ Architecture]]
|
||||
|
||||
@@ -27,6 +27,7 @@ com.sufficient.satistaskory
|
||||
Planner # create / increment / decrement / clear / snapshot
|
||||
GoalStore # port
|
||||
InMemoryGoalStore # unit tests; inner store for persist
|
||||
ObtainedCompletion # opt-in: pickup counts as done
|
||||
|
||||
infrastructure/
|
||||
recipe/
|
||||
@@ -43,7 +44,8 @@ com.sufficient.satistaskory
|
||||
PlayOverlay # Screen 2 HUD (not a Screen)
|
||||
CaptureHook # tooltip + KeyMapping ADD_GOAL
|
||||
PlannerSession
|
||||
ClientCommands # debug /satistaskory add|clear
|
||||
ClientSettings # auto-remove preference
|
||||
ClientCommands # debug /satistaskory add|clear|auto-remove
|
||||
```
|
||||
|
||||
Dependencies point inward: `infrastructure` and `application` may import `domain`. `domain` imports nothing from NeoForge, EMI, JEI, REI, or `infrastructure`.
|
||||
@@ -55,7 +57,7 @@ Dependencies point inward: `infrastructure` and `application` may import `domain
|
||||
| Omitted | Why |
|
||||
|---------|-----|
|
||||
| `Project` | Organizational only; not in the slice |
|
||||
| Completion strategy | Ready ≠ complete; complete is not in the slice |
|
||||
| Full completion UI | Ready ≠ complete. Opt-in inventory detection exists (`/satistaskory auto-remove`). No complete button. |
|
||||
| Full-screen planner | Not discovered |
|
||||
|
||||
The NeoForge template example block/item is gone. Do not put it back.
|
||||
|
||||
@@ -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–019**
|
||||
- Philosophy Rules #1–#10; ADRs **001–020**
|
||||
- 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
|
||||
@@ -27,7 +27,6 @@ EMI is not a dependency. See ADR-016.
|
||||
## ⏸ Not opened
|
||||
|
||||
- Project
|
||||
- Completion
|
||||
- Full-screen planner
|
||||
|
||||
---
|
||||
|
||||
@@ -435,6 +435,16 @@ ADR-019: a tag ingredient is one requirement, every member counts. Overlay names
|
||||
|
||||
---
|
||||
|
||||
## 📜 2026-09-08 (auto-remove)
|
||||
|
||||
Greetings, Wayfinder.
|
||||
|
||||
The walk: completed items stayed on the overlay.
|
||||
|
||||
ADR-020: `/satistaskory auto-remove`. Off by default. When on, a **gain** in held goal items reduces quantity and removes at 0. Not “held >= target” (that would eat a new goal while they are carrying the item). Not storage. Baseline on join/enable.
|
||||
|
||||
---
|
||||
|
||||
## Related Documents
|
||||
|
||||
[[🌟 Project Vision]]
|
||||
|
||||
@@ -60,6 +60,8 @@ The overlay answers both halves of the vision question:
|
||||
|
||||
`[-]` at quantity 1 removes that goal.
|
||||
|
||||
`/satistaskory auto-remove` (off by default): picking up the goal item counts it done and drops the quantity (gone at 0). Only what is on you. A chest you just filled does not count. Dumping the item does not bring the row back.
|
||||
|
||||
Walking has no cursor. Overlay `[+]` / `[-]` / Clear are HUD hit-tests (vanilla button sprites + click sound), not a `Screen`. Open chat (`T` or `/`) to click them. Capture does not use a clickable chip you leave the item to hit.
|
||||
|
||||
Same material from two goals is one row. Any-plank recipes (chest, crafting table) are one row too: spruce counts, mixed stacks count. If they hold none, the row says Planks, not Oak. Changing a goal quantity recalculates the lower list. As inventory fills, counts shrink.
|
||||
|
||||
@@ -8,7 +8,7 @@ Not a build queue.
|
||||
|
||||
- Viewer-only recipe adapter (EMI/JEI/REI) **if** a recipe never appears in `RecipeManager`
|
||||
- Persistence (server save / cloud)
|
||||
- Inventory-detection completion (alongside manual)
|
||||
- Other completion strategies (the opt-in pickup path is shipped: `/satistaskory auto-remove`)
|
||||
- Ender chest / later storage in the inventory snapshot
|
||||
- Projects packaged
|
||||
- Full-screen planner
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.sufficient.satistaskory.application;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.sufficient.satistaskory.domain.Goal;
|
||||
import com.sufficient.satistaskory.domain.InventoryState;
|
||||
import com.sufficient.satistaskory.domain.ItemId;
|
||||
|
||||
/**
|
||||
* When auto-remove is on: an increase in held target items counts as obtained.
|
||||
* Dumping items does not put quantity back. First look after enable/join is a baseline, not a gain.
|
||||
*/
|
||||
public final class ObtainedCompletion {
|
||||
private final Map<ItemId, Integer> lastHeld = new HashMap<>();
|
||||
private boolean primed;
|
||||
|
||||
public void reset() {
|
||||
lastHeld.clear();
|
||||
primed = false;
|
||||
}
|
||||
|
||||
public void apply(Planner planner, InventoryState inventory) {
|
||||
if (!primed) {
|
||||
seed(planner, inventory);
|
||||
primed = true;
|
||||
return;
|
||||
}
|
||||
for (Goal goal : List.copyOf(planner.goals())) {
|
||||
int now = inventory.get(goal.targetItem());
|
||||
int was = lastHeld.getOrDefault(goal.targetItem(), 0);
|
||||
int gained = now - was;
|
||||
if (gained > 0) {
|
||||
planner.reduce(goal.targetItem(), gained);
|
||||
}
|
||||
}
|
||||
seed(planner, inventory);
|
||||
}
|
||||
|
||||
private void seed(Planner planner, InventoryState inventory) {
|
||||
lastHeld.clear();
|
||||
lastHeld.putAll(inventory.contents());
|
||||
for (Goal goal : planner.goals()) {
|
||||
lastHeld.putIfAbsent(goal.targetItem(), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.sufficient.satistaskory.application;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@@ -23,6 +24,10 @@ public final class Planner {
|
||||
this.inventory = Objects.requireNonNull(inventory, "inventory");
|
||||
}
|
||||
|
||||
public List<Goal> goals() {
|
||||
return store.all();
|
||||
}
|
||||
|
||||
public ProgressSnapshot snapshot() {
|
||||
return refresh();
|
||||
}
|
||||
@@ -64,6 +69,24 @@ public final class Planner {
|
||||
return refresh();
|
||||
}
|
||||
|
||||
/**
|
||||
* Count obtained items toward the goal. Removes the goal when quantity hits 0.
|
||||
*/
|
||||
public void reduce(ItemId item, int amount) {
|
||||
Objects.requireNonNull(item, "item");
|
||||
if (amount < 1) {
|
||||
return;
|
||||
}
|
||||
store.find(item).ifPresent(existing -> {
|
||||
int left = existing.quantity() - amount;
|
||||
if (left < 1) {
|
||||
store.remove(item);
|
||||
} else {
|
||||
store.put(new Goal(item, left));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private ProgressSnapshot refresh() {
|
||||
return progress.calculate(store.all(), inventory.get());
|
||||
}
|
||||
|
||||
@@ -40,4 +40,8 @@ public final class InventoryState {
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
public Map<ItemId, Integer> contents() {
|
||||
return available;
|
||||
}
|
||||
}
|
||||
|
||||
+25
-1
@@ -26,7 +26,11 @@ public final class ClientCommands {
|
||||
PlannerSession.get().clear();
|
||||
ctx.getSource().sendSuccess(() -> Component.literal("Cleared crafting goals"), false);
|
||||
return 1;
|
||||
})));
|
||||
}))
|
||||
.then(Commands.literal("auto-remove")
|
||||
.executes(ClientCommands::toggleAutoRemove)
|
||||
.then(Commands.literal("on").executes(ctx -> setAutoRemove(ctx, true)))
|
||||
.then(Commands.literal("off").executes(ctx -> setAutoRemove(ctx, false)))));
|
||||
}
|
||||
|
||||
private static int add(CommandContext<CommandSourceStack> ctx) {
|
||||
@@ -43,4 +47,24 @@ public final class ClientCommands {
|
||||
ctx.getSource().sendSuccess(() -> Component.literal("Added " + item), false);
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int toggleAutoRemove(CommandContext<CommandSourceStack> ctx) {
|
||||
boolean on = ClientSettings.toggleAutoRemove();
|
||||
tellAutoRemove(ctx, on);
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int setAutoRemove(CommandContext<CommandSourceStack> ctx, boolean on) {
|
||||
ClientSettings.setAutoRemove(on);
|
||||
tellAutoRemove(ctx, on);
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static void tellAutoRemove(CommandContext<CommandSourceStack> ctx, boolean on) {
|
||||
ctx.getSource().sendSuccess(
|
||||
() -> Component.translatable(on
|
||||
? "satistaskory.message.auto_remove.on"
|
||||
: "satistaskory.message.auto_remove.off"),
|
||||
false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.sufficient.satistaskory.infrastructure.client;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import com.sufficient.satistaskory.Satistaskory;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
/**
|
||||
* Client preferences. Not per-world. Auto-remove is off until the player turns it on.
|
||||
*/
|
||||
public final class ClientSettings {
|
||||
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
|
||||
private static boolean autoRemove;
|
||||
|
||||
private ClientSettings() {}
|
||||
|
||||
public static boolean autoRemove() {
|
||||
return autoRemove;
|
||||
}
|
||||
|
||||
public static boolean toggleAutoRemove() {
|
||||
return setAutoRemove(!autoRemove);
|
||||
}
|
||||
|
||||
public static boolean setAutoRemove(boolean value) {
|
||||
autoRemove = value;
|
||||
save();
|
||||
return autoRemove;
|
||||
}
|
||||
|
||||
public static void load() {
|
||||
Path file = file();
|
||||
if (file == null || !Files.isRegularFile(file)) {
|
||||
autoRemove = false;
|
||||
return;
|
||||
}
|
||||
try {
|
||||
JsonObject json = GSON.fromJson(Files.readString(file), JsonObject.class);
|
||||
autoRemove = json != null && json.has("autoRemove") && json.get("autoRemove").getAsBoolean();
|
||||
} catch (RuntimeException | IOException e) {
|
||||
Satistaskory.LOGGER.warn("Could not read Satistaskory settings at {}", file, e);
|
||||
autoRemove = false;
|
||||
}
|
||||
}
|
||||
|
||||
private static void save() {
|
||||
Path file = file();
|
||||
if (file == null) {
|
||||
return;
|
||||
}
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("autoRemove", autoRemove);
|
||||
try {
|
||||
Path parent = file.getParent();
|
||||
if (parent != null) {
|
||||
Files.createDirectories(parent);
|
||||
}
|
||||
Files.writeString(file, GSON.toJson(json));
|
||||
} catch (IOException e) {
|
||||
Satistaskory.LOGGER.warn("Could not write Satistaskory settings at {}", file, e);
|
||||
}
|
||||
}
|
||||
|
||||
private static Path file() {
|
||||
Minecraft minecraft = Minecraft.getInstance();
|
||||
if (minecraft == null) {
|
||||
return null;
|
||||
}
|
||||
return minecraft.gameDirectory.toPath().resolve("satistaskory").resolve("settings.json");
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.sufficient.satistaskory.infrastructure.client;
|
||||
|
||||
import com.sufficient.satistaskory.application.ObtainedCompletion;
|
||||
import com.sufficient.satistaskory.application.Planner;
|
||||
import com.sufficient.satistaskory.domain.InventoryState;
|
||||
import com.sufficient.satistaskory.domain.MaterialAggregation;
|
||||
import com.sufficient.satistaskory.domain.ProgressCalculation;
|
||||
import com.sufficient.satistaskory.domain.ProgressSnapshot;
|
||||
import com.sufficient.satistaskory.domain.RecipeResolution;
|
||||
import com.sufficient.satistaskory.infrastructure.inventory.PlayerInventoryAdapter;
|
||||
import com.sufficient.satistaskory.infrastructure.persistence.PersistingGoalStore;
|
||||
@@ -19,6 +21,7 @@ import net.minecraft.client.player.LocalPlayer;
|
||||
public final class PlannerSession {
|
||||
private static PersistingGoalStore store;
|
||||
private static Planner planner;
|
||||
private static final ObtainedCompletion obtained = new ObtainedCompletion();
|
||||
|
||||
private PlannerSession() {}
|
||||
|
||||
@@ -30,6 +33,8 @@ public final class PlannerSession {
|
||||
ProgressCalculation progress = new ProgressCalculation(resolution, new MaterialAggregation());
|
||||
store = new PersistingGoalStore();
|
||||
planner = new Planner(store, progress, PlannerSession::currentInventory);
|
||||
ClientSettings.load();
|
||||
obtained.reset();
|
||||
}
|
||||
|
||||
public static Planner get() {
|
||||
@@ -39,15 +44,27 @@ public final class PlannerSession {
|
||||
return planner;
|
||||
}
|
||||
|
||||
public static ProgressSnapshot snapshot() {
|
||||
bootstrap();
|
||||
if (ClientSettings.autoRemove()) {
|
||||
obtained.apply(planner, currentInventory());
|
||||
} else {
|
||||
obtained.reset();
|
||||
}
|
||||
return planner.snapshot();
|
||||
}
|
||||
|
||||
public static void onJoinWorld() {
|
||||
bootstrap();
|
||||
store.loadFromWorld(ClientGoalPersistence.load());
|
||||
obtained.reset();
|
||||
}
|
||||
|
||||
public static void onLeaveWorld() {
|
||||
if (store != null) {
|
||||
store.unload();
|
||||
}
|
||||
obtained.reset();
|
||||
}
|
||||
|
||||
private static InventoryState currentInventory() {
|
||||
|
||||
@@ -46,7 +46,7 @@ public final class PlayOverlay {
|
||||
return;
|
||||
}
|
||||
|
||||
ProgressSnapshot snapshot = PlannerSession.get().snapshot();
|
||||
ProgressSnapshot snapshot = PlannerSession.snapshot();
|
||||
if (snapshot.goals().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4,5 +4,7 @@
|
||||
"key.categories.satistaskory": "Satistaskory",
|
||||
"key.satistaskory.add_goal": "Add to Crafting Goals",
|
||||
"satistaskory.tooltip.add": "[%s] Add to Crafting Goals",
|
||||
"satistaskory.message.added": "Added %s to crafting goals"
|
||||
"satistaskory.message.added": "Added %s to crafting goals",
|
||||
"satistaskory.message.auto_remove.on": "Auto-remove ON: picking up a goal item counts it done. Dumping it in a chest does not bring it back.",
|
||||
"satistaskory.message.auto_remove.off": "Auto-remove OFF: goals stay until you [-] or Clear."
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.sufficient.satistaskory.application;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.sufficient.satistaskory.domain.InventoryState;
|
||||
import com.sufficient.satistaskory.domain.ItemId;
|
||||
import com.sufficient.satistaskory.domain.MaterialAggregation;
|
||||
import com.sufficient.satistaskory.domain.ProgressCalculation;
|
||||
import com.sufficient.satistaskory.domain.RecipeResolution;
|
||||
import com.sufficient.satistaskory.infrastructure.recipe.StubRecipeProvider;
|
||||
|
||||
class ObtainedCompletionTest {
|
||||
private static final ItemId CHEST = ItemId.parse("minecraft:chest");
|
||||
|
||||
private Planner planner;
|
||||
private ObtainedCompletion completion;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
RecipeResolution resolution = new RecipeResolution(new StubRecipeProvider());
|
||||
ProgressCalculation progress = new ProgressCalculation(resolution, new MaterialAggregation());
|
||||
planner = new Planner(new InMemoryGoalStore(), progress, InventoryState::empty);
|
||||
completion = new ObtainedCompletion();
|
||||
}
|
||||
|
||||
@Test
|
||||
void firstLookDoesNotCountWhatIsAlreadyHeld() {
|
||||
planner.create(CHEST);
|
||||
completion.apply(planner, new InventoryState(Map.of(CHEST, 5)));
|
||||
assertEquals(1, planner.goals().getFirst().quantity());
|
||||
}
|
||||
|
||||
@Test
|
||||
void pickingUpReducesQuantity() {
|
||||
planner.create(CHEST);
|
||||
planner.increment(CHEST);
|
||||
completion.apply(planner, InventoryState.empty());
|
||||
completion.apply(planner, new InventoryState(Map.of(CHEST, 1)));
|
||||
assertEquals(1, planner.goals().getFirst().quantity());
|
||||
}
|
||||
|
||||
@Test
|
||||
void pickingUpTheLastRemovesTheGoal() {
|
||||
planner.create(CHEST);
|
||||
completion.apply(planner, InventoryState.empty());
|
||||
completion.apply(planner, new InventoryState(Map.of(CHEST, 1)));
|
||||
assertTrue(planner.goals().isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
void dumpingDoesNotRestoreQuantity() {
|
||||
planner.create(CHEST);
|
||||
planner.increment(CHEST);
|
||||
completion.apply(planner, InventoryState.empty());
|
||||
completion.apply(planner, new InventoryState(Map.of(CHEST, 1)));
|
||||
completion.apply(planner, InventoryState.empty());
|
||||
assertEquals(1, planner.goals().getFirst().quantity());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user