From 3672550e01d5fa7a51736909ac4008114e6177ae Mon Sep 17 00:00:00 2001 From: Stephen Fasciani Date: Tue, 8 Sep 2026 05:48:32 -0400 Subject: [PATCH] Keep the plan on this client; the host does not need the mod. Replace player attachments with client-owned files. Singleplayer writes satistaskory.dat next to the world. Remote writes satistaskory/remote/
.dat. displayTest IGNORE_ALL_VERSION. No packets, no server jar. --- AGENTS.md | 4 +- README.md | 2 +- docs/03-Architecture/โ–ถ๏ธ Create Goal.md | 2 +- docs/03-Architecture/๐Ÿ›๏ธ Architecture.md | 6 +- docs/03-Architecture/๐Ÿ’พ Persistence.md | 17 ++-- docs/03-Architecture/๐Ÿ“ Decisions.md | 27 +++++- docs/03-Architecture/๐Ÿ“ฆ Packages.md | 3 +- docs/04-Planning/๐Ÿ—บ๏ธ Roadmap.md | 4 +- .../04-Planning/๐Ÿงญ Notes for the Wayfinder.md | 14 +++ .../sufficient/satistaskory/Satistaskory.java | 21 +---- .../infrastructure/client/PlannerSession.java | 6 +- .../persistence/ClientGoalPersistence.java | 92 +++++++++++++++++++ .../persistence/ClientSaveKeys.java | 22 +++++ .../persistence/PersistingGoalStore.java | 4 +- .../persistence/PlayerGoalPersistence.java | 49 ---------- .../resources/META-INF/neoforge.mods.toml | 8 +- .../persistence/ClientSaveKeysTest.java | 22 +++++ 17 files changed, 211 insertions(+), 92 deletions(-) create mode 100644 src/main/java/com/sufficient/satistaskory/infrastructure/persistence/ClientGoalPersistence.java create mode 100644 src/main/java/com/sufficient/satistaskory/infrastructure/persistence/ClientSaveKeys.java delete mode 100644 src/main/java/com/sufficient/satistaskory/infrastructure/persistence/PlayerGoalPersistence.java create mode 100644 src/test/java/com/sufficient/satistaskory/infrastructure/persistence/ClientSaveKeysTest.java diff --git a/AGENTS.md b/AGENTS.md index 50915ae..5d437dd 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -40,8 +40,8 @@ Read [[๐Ÿง  Philosophy]] before changing the vault. The Bookshelf Principle, Pre ## Code -The first slice is in code and has been played (ADRs 012โ€“017): [[โ–ถ๏ธ Create Goal]], [[๐Ÿ”Œ Recipe Provider]] via `RecipeManager`, overlay HUD, capture = tooltip + rebindable Add key, player world save. +The first slice is in code and has been played (ADRs 012โ€“018): [[โ–ถ๏ธ Create Goal]], [[๐Ÿ”Œ Recipe Provider]] via `RecipeManager`, overlay HUD, capture = tooltip + rebindable Add key, client-owned plan files. -Do not start EMI/JEI/REI. Recipe source is `RecipeManager` (ADR-016). Persistence is the player in this world (ADR-017). Project waits until settled. Do not rewrite the overlay as a `Screen` unless the HUD path fails. +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. The NeoForge template example block/item is gone. Do not put it back. diff --git a/README.md b/README.md index 2db87df..edd1e51 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Those may be integrated with later. They are not owned by Satistaskory. ## Status -First slice is in `src/` and has been played: domain, `VanillaRecipeProvider` (`RecipeManager`, one level), player world save, overlay on the right, hover + Add key (default `=`). +First slice is in `src/` and has been played: domain, `VanillaRecipeProvider` (`RecipeManager`, one level), client-owned plan files, overlay on the right, hover + Add key (default `=`). The host does not need this mod. `/satistaskory add minecraft:furnace` is a debug command. Not EMI. Template example block/item is gone. diff --git a/docs/03-Architecture/โ–ถ๏ธ Create Goal.md b/docs/03-Architecture/โ–ถ๏ธ Create Goal.md index 7ddef57..648f77a 100644 --- a/docs/03-Architecture/โ–ถ๏ธ Create Goal.md +++ b/docs/03-Architecture/โ–ถ๏ธ Create Goal.md @@ -37,7 +37,7 @@ RefreshProgress missing = required โˆ’ available ``` -Persistence: the player in this world's save (ADR-017). Leave the world and the overlay unloads; come back and the goals load. +Persistence: a file this client owns (ADR-018). Leave the world and the overlay unloads; come back and the goals load. The host does not need this mod. --- diff --git a/docs/03-Architecture/๐Ÿ›๏ธ Architecture.md b/docs/03-Architecture/๐Ÿ›๏ธ Architecture.md index bb4d105..a608d08 100644 --- a/docs/03-Architecture/๐Ÿ›๏ธ Architecture.md +++ b/docs/03-Architecture/๐Ÿ›๏ธ Architecture.md @@ -100,7 +100,7 @@ First use case: [[โ–ถ๏ธ Create Goal]]. In code this slice is one `Planner` faca Mark Goal Complete is named. It is not in the first slice. -The application layer calls infrastructure through ports (`RecipeProvider`, inventory snapshot, `GoalStore`). It does not contain domain rules. It loads what the use case needs, asks the domain to decide, and presents the result. Persistence is the player in this world's save (ADR-017). +The application layer calls infrastructure through ports (`RecipeProvider`, inventory snapshot, `GoalStore`). It does not contain domain rules. It loads what the use case needs, asks the domain to decide, and presents the result. Persistence is a client-owned file (ADR-018). Packages: [[๐Ÿ“ฆ Packages]]. @@ -119,7 +119,7 @@ Examples: - Save data storage - Inventory scanning -Shipped this slice: `VanillaRecipeProvider` (`RecipeManager`, all types, one level), player-inventory snapshot, HUD overlay, tooltip+key capture, player world save. `StubRecipeProvider` is unit tests only. EMI/JEI/REI are not dependencies. +Shipped this slice: `VanillaRecipeProvider` (`RecipeManager`, all types, one level), player-inventory snapshot, HUD overlay, tooltip+key capture, client-owned plan files. `StubRecipeProvider` is unit tests only. EMI/JEI/REI are not dependencies. The host does not need this mod. Infrastructure is never the source of domain truth. @@ -147,7 +147,7 @@ Possible implementations: - Server Save - Future Cloud Sync -Shipped: player attachment in this world's save. Survives quit and death. Remote multiplayer stays RAM-only until a server adapter exists. See [[๐Ÿ’พ Persistence]] and ADR-017. +Shipped: client-owned files. Singleplayer lives next to the world; remote lives under the game directory keyed by address. See [[๐Ÿ’พ Persistence]] and ADR-018. The host does not need this mod. --- diff --git a/docs/03-Architecture/๐Ÿ’พ Persistence.md b/docs/03-Architecture/๐Ÿ’พ Persistence.md index e29179f..8b8dc5a 100644 --- a/docs/03-Architecture/๐Ÿ’พ Persistence.md +++ b/docs/03-Architecture/๐Ÿ’พ Persistence.md @@ -21,18 +21,21 @@ Play uses `PersistingGoalStore`: RAM plus a write after each change. ## Shipped implementation -Player attachment in **this world's save** (ADR-017). +Client-owned files (ADR-018). The host does not need this mod. + +| Where | File | +|-------|------| +| Singleplayer | `/satistaskory.dat` | +| Remote / LAN guest | `satistaskory/remote/
.dat` in the game directory | | Event | Result | |-------|--------| -| Join world | Load this player's goals | -| Create / + / โˆ’ / Clear | Write the attachment | +| Join world | Load this client's file for that world or address | +| Create / + / โˆ’ / Clear | Write that file | | Leave world | Unload RAM. Do not write empty (that would wipe the save) | -| Death | Plan is copied. It is not loot | +| Death | Irrelevant. The plan is not on the player entity | -Singleplayer and LAN host. Remote dedicated server: RAM-only this slice. - -Server save and cloud remain possible later. They do not change `GoalStore`. +A later server or cloud adapter is still allowed. It does not change `GoalStore`. It is not required for the prosthetic to function. --- diff --git a/docs/03-Architecture/๐Ÿ“ Decisions.md b/docs/03-Architecture/๐Ÿ“ Decisions.md index 1f6bb4a..d045030 100644 --- a/docs/03-Architecture/๐Ÿ“ Decisions.md +++ b/docs/03-Architecture/๐Ÿ“ Decisions.md @@ -297,12 +297,37 @@ The port remains. The **order** was wrong. The first slice is a prosthetic the player can quit and resume. ADR-004 named world save, server save, and cloud. World save is the one they play. -**Status:** โœ… Accepted +**Status:** โš ๏ธ Superseded by ADR-018 **Refines:** ADR-004. **Supersedes** ADR-013โ€™s โ€œPersistence: in-memoryโ€ freeze for this slice. --- +### ADR-018 โ€” Client-only; the host does not need this mod + +**Date:** 2026-09-08 + +**Decision:** Satistaskory is a **client** mod. A dedicated server, LAN host, or singleplayer integrated server does not need it installed for the prosthetic to work. + +Persistence is a file this client owns: + +- Singleplayer: `/satistaskory.dat` (travels with the world backup) +- Remote / LAN guest: `satistaskory/remote/
.dat` under the game directory + +`displayTest="IGNORE_ALL_VERSION"`. No player attachment. No server packet. No server jar. + +The overlay, capture, inventory snapshot, and `RecipeManager` lookup already run on the client. ADR-017โ€™s player attachment was the only thing that required the mod on the host. That was the wrong persistence for this product. + +**Reason:** + +The player carries the plan. The server is not a Satistaskory collaborator. Requiring the jar on a friendโ€™s server, a modpack host, or a dedicated box would make the prosthetic a pack dependency instead of a personal tool. + +**Status:** โœ… Accepted + +**Supersedes:** ADR-017 (player attachment in the world save) + +--- + ## Related Documents [[๐Ÿ›๏ธ Architecture]] diff --git a/docs/03-Architecture/๐Ÿ“ฆ Packages.md b/docs/03-Architecture/๐Ÿ“ฆ Packages.md index d9a1bf3..b7ce12e 100644 --- a/docs/03-Architecture/๐Ÿ“ฆ Packages.md +++ b/docs/03-Architecture/๐Ÿ“ฆ Packages.md @@ -37,7 +37,8 @@ com.sufficient.satistaskory persistence/ GoalPlan # NBT codec PersistingGoalStore - PlayerGoalPersistence # player attachment in this world + ClientGoalPersistence # client files; host does not need this mod + ClientSaveKeys client/ PlayOverlay # Screen 2 HUD (not a Screen) CaptureHook # tooltip + KeyMapping ADD_GOAL diff --git a/docs/04-Planning/๐Ÿ—บ๏ธ Roadmap.md b/docs/04-Planning/๐Ÿ—บ๏ธ Roadmap.md index d92c982..1301ac6 100644 --- a/docs/04-Planning/๐Ÿ—บ๏ธ Roadmap.md +++ b/docs/04-Planning/๐Ÿ—บ๏ธ Roadmap.md @@ -6,13 +6,13 @@ What exists, and what is next. Implementation detail will live in an Implementat ## โœ… Now (docs) -- Philosophy Rules #1โ€“#10; ADRs **001โ€“017** +- Philosophy Rules #1โ€“#10; ADRs **001โ€“018** - 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 - Experience: capture in place; overlay on the right (goals + aggregated needed counts) -First slice **code exists** and has been played: domain, `VanillaRecipeProvider` (`RecipeManager`, all types, one level), player world save, player inventory, play overlay, hover + Add key. +First slice **code exists** and has been played: domain, `VanillaRecipeProvider` (`RecipeManager`, all types, one level), client-owned plan files, player inventory, play overlay, hover + Add key. Host does not need this mod. --- diff --git a/docs/04-Planning/๐Ÿงญ Notes for the Wayfinder.md b/docs/04-Planning/๐Ÿงญ Notes for the Wayfinder.md index 5a81a23..bffc5cd 100644 --- a/docs/04-Planning/๐Ÿงญ Notes for the Wayfinder.md +++ b/docs/04-Planning/๐Ÿงญ Notes for the Wayfinder.md @@ -381,6 +381,20 @@ Do not open Project because that feels like "what's next." Listen. --- +## ๐Ÿ“œ 2026-09-08 (client-only) + +Greetings, Wayfinder. + +The player attachment was the wrong save. It made Satistaskory a host mod. + +ADR-018: client-only. Overlay, capture, recipes, inventory were already client. Persistence is a file this client owns. Singleplayer writes `satistaskory.dat` next to the world. Remote writes `satistaskory/remote/
.dat`. `displayTest=IGNORE_ALL_VERSION`. No packet. No server jar. + +If they playtested the attachment build, those goals will not come back. Re-add once. + +The prosthetic travels with the player, not with the pack. + +--- + ## Related Documents [[๐ŸŒŸ Project Vision]] diff --git a/src/main/java/com/sufficient/satistaskory/Satistaskory.java b/src/main/java/com/sufficient/satistaskory/Satistaskory.java index 29a0e3d..cd88bcd 100644 --- a/src/main/java/com/sufficient/satistaskory/Satistaskory.java +++ b/src/main/java/com/sufficient/satistaskory/Satistaskory.java @@ -4,32 +4,17 @@ import org.slf4j.Logger; import com.mojang.logging.LogUtils; -import com.sufficient.satistaskory.infrastructure.persistence.GoalPlan; - +import net.neoforged.api.distmarker.Dist; import net.neoforged.bus.api.IEventBus; import net.neoforged.fml.ModContainer; import net.neoforged.fml.common.Mod; -import net.neoforged.neoforge.attachment.AttachmentType; -import net.neoforged.neoforge.registries.DeferredHolder; -import net.neoforged.neoforge.registries.DeferredRegister; -import net.neoforged.neoforge.registries.NeoForgeRegistries; -@Mod(Satistaskory.MODID) +@Mod(value = Satistaskory.MODID, dist = Dist.CLIENT) public class Satistaskory { public static final String MODID = "satistaskory"; public static final Logger LOGGER = LogUtils.getLogger(); - public static final DeferredRegister> ATTACHMENT_TYPES = - DeferredRegister.create(NeoForgeRegistries.Keys.ATTACHMENT_TYPES, MODID); - - public static final DeferredHolder, AttachmentType> PLAYER_GOALS = - ATTACHMENT_TYPES.register("player_goals", () -> AttachmentType.builder(GoalPlan::empty) - .serialize(GoalPlan.CODEC) - .copyOnDeath() - .build()); - public Satistaskory(IEventBus modEventBus, ModContainer modContainer) { - ATTACHMENT_TYPES.register(modEventBus); - LOGGER.info("Satistaskory loaded. Goals are the domain."); + LOGGER.info("Satistaskory loaded. Client-only. Goals are the domain."); } } diff --git a/src/main/java/com/sufficient/satistaskory/infrastructure/client/PlannerSession.java b/src/main/java/com/sufficient/satistaskory/infrastructure/client/PlannerSession.java index 1ded872..409bd94 100644 --- a/src/main/java/com/sufficient/satistaskory/infrastructure/client/PlannerSession.java +++ b/src/main/java/com/sufficient/satistaskory/infrastructure/client/PlannerSession.java @@ -7,14 +7,14 @@ import com.sufficient.satistaskory.domain.ProgressCalculation; import com.sufficient.satistaskory.domain.RecipeResolution; import com.sufficient.satistaskory.infrastructure.inventory.PlayerInventoryAdapter; import com.sufficient.satistaskory.infrastructure.persistence.PersistingGoalStore; -import com.sufficient.satistaskory.infrastructure.persistence.PlayerGoalPersistence; +import com.sufficient.satistaskory.infrastructure.persistence.ClientGoalPersistence; import com.sufficient.satistaskory.infrastructure.recipe.VanillaRecipeProvider; import net.minecraft.client.Minecraft; import net.minecraft.client.player.LocalPlayer; /** - * Client plan for the current world. Written to the player in this world's save. + * Client plan for the current world. Written to a file this client owns. */ public final class PlannerSession { private static PersistingGoalStore store; @@ -41,7 +41,7 @@ public final class PlannerSession { public static void onJoinWorld() { bootstrap(); - store.loadFromWorld(PlayerGoalPersistence.load()); + store.loadFromWorld(ClientGoalPersistence.load()); } public static void onLeaveWorld() { diff --git a/src/main/java/com/sufficient/satistaskory/infrastructure/persistence/ClientGoalPersistence.java b/src/main/java/com/sufficient/satistaskory/infrastructure/persistence/ClientGoalPersistence.java new file mode 100644 index 0000000..8568635 --- /dev/null +++ b/src/main/java/com/sufficient/satistaskory/infrastructure/persistence/ClientGoalPersistence.java @@ -0,0 +1,92 @@ +package com.sufficient.satistaskory.infrastructure.persistence; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; + +import com.mojang.serialization.DataResult; + +import com.sufficient.satistaskory.Satistaskory; +import com.sufficient.satistaskory.domain.Goal; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.ServerData; +import net.minecraft.client.server.IntegratedServer; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtAccounter; +import net.minecraft.nbt.NbtIo; +import net.minecraft.nbt.NbtOps; +import net.minecraft.nbt.Tag; +import net.minecraft.world.level.storage.LevelResource; + +/** + * Client-owned files. The server does not need this mod. + * Singleplayer: {@code /satistaskory.dat}. Remote: {@code satistaskory/remote/
.dat}. + */ +public final class ClientGoalPersistence { + private ClientGoalPersistence() {} + + public static List load() { + Path file = currentFile(); + if (file == null || !Files.isRegularFile(file)) { + return List.of(); + } + try { + CompoundTag root = NbtIo.readCompressed(file, NbtAccounter.unlimitedHeap()); + Tag planTag = root.get("Plan"); + if (planTag == null) { + return List.of(); + } + DataResult parsed = GoalPlan.CODEC.parse(NbtOps.INSTANCE, planTag); + return parsed.result().map(GoalPlan::toGoals).orElseGet(() -> { + Satistaskory.LOGGER.warn("Ignoring unreadable Satistaskory plan at {}", file); + return List.of(); + }); + } catch (IOException e) { + Satistaskory.LOGGER.warn("Could not read Satistaskory plan at {}", file, e); + return List.of(); + } + } + + public static void save(List goals) { + Path file = currentFile(); + if (file == null) { + return; + } + DataResult encoded = GoalPlan.CODEC.encodeStart(NbtOps.INSTANCE, GoalPlan.fromGoals(goals)); + Tag planTag = encoded.result().orElse(null); + if (planTag == null) { + Satistaskory.LOGGER.warn("Could not encode Satistaskory plan"); + return; + } + CompoundTag root = new CompoundTag(); + root.putInt("DataVersion", 1); + root.put("Plan", planTag); + try { + Path parent = file.getParent(); + if (parent != null) { + Files.createDirectories(parent); + } + NbtIo.writeCompressed(root, file); + } catch (IOException e) { + Satistaskory.LOGGER.warn("Could not write Satistaskory plan at {}", file, e); + } + } + + private static Path currentFile() { + Minecraft minecraft = Minecraft.getInstance(); + IntegratedServer integrated = minecraft.getSingleplayerServer(); + if (integrated != null) { + return integrated.getWorldPath(LevelResource.ROOT).resolve("satistaskory.dat"); + } + ServerData server = minecraft.getCurrentServer(); + if (server != null && server.ip != null && !server.ip.isBlank()) { + return minecraft.gameDirectory.toPath() + .resolve("satistaskory") + .resolve("remote") + .resolve(ClientSaveKeys.remoteFileName(server.ip)); + } + return null; + } +} diff --git a/src/main/java/com/sufficient/satistaskory/infrastructure/persistence/ClientSaveKeys.java b/src/main/java/com/sufficient/satistaskory/infrastructure/persistence/ClientSaveKeys.java new file mode 100644 index 0000000..471ccac --- /dev/null +++ b/src/main/java/com/sufficient/satistaskory/infrastructure/persistence/ClientSaveKeys.java @@ -0,0 +1,22 @@ +package com.sufficient.satistaskory.infrastructure.persistence; + +import java.util.Locale; + +/** + * File names for remote-server plans on this client. Not a domain type. + */ +public final class ClientSaveKeys { + private ClientSaveKeys() {} + + public static String remoteFileName(String address) { + String cleaned = address.toLowerCase(Locale.ROOT).replaceAll("[^a-z0-9._-]+", "_"); + cleaned = cleaned.replaceAll("^_+|_+$", ""); + if (cleaned.isEmpty()) { + cleaned = "unknown"; + } + if (cleaned.length() > 80) { + cleaned = cleaned.substring(0, 80); + } + return cleaned + ".dat"; + } +} diff --git a/src/main/java/com/sufficient/satistaskory/infrastructure/persistence/PersistingGoalStore.java b/src/main/java/com/sufficient/satistaskory/infrastructure/persistence/PersistingGoalStore.java index 8844a4d..7725580 100644 --- a/src/main/java/com/sufficient/satistaskory/infrastructure/persistence/PersistingGoalStore.java +++ b/src/main/java/com/sufficient/satistaskory/infrastructure/persistence/PersistingGoalStore.java @@ -9,7 +9,7 @@ import com.sufficient.satistaskory.domain.Goal; import com.sufficient.satistaskory.domain.ItemId; /** - * RAM store that writes the player's world save after each change. + * RAM store that writes this client's plan file after each change. * Load and leave-world must not write; otherwise logout would wipe the save. */ public final class PersistingGoalStore implements GoalStore { @@ -61,7 +61,7 @@ public final class PersistingGoalStore implements GoalStore { private void persist() { if (persist) { - PlayerGoalPersistence.save(inner.all()); + ClientGoalPersistence.save(inner.all()); } } } diff --git a/src/main/java/com/sufficient/satistaskory/infrastructure/persistence/PlayerGoalPersistence.java b/src/main/java/com/sufficient/satistaskory/infrastructure/persistence/PlayerGoalPersistence.java deleted file mode 100644 index ad9168f..0000000 --- a/src/main/java/com/sufficient/satistaskory/infrastructure/persistence/PlayerGoalPersistence.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.sufficient.satistaskory.infrastructure.persistence; - -import java.util.List; -import java.util.UUID; - -import com.sufficient.satistaskory.Satistaskory; -import com.sufficient.satistaskory.domain.Goal; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.server.IntegratedServer; -import net.minecraft.server.level.ServerPlayer; - -/** - * Player attachment in this world's save. Singleplayer and LAN host. - * A remote server has no integrated save; the session stays RAM-only there. - */ -public final class PlayerGoalPersistence { - private PlayerGoalPersistence() {} - - public static List load() { - Minecraft minecraft = Minecraft.getInstance(); - IntegratedServer server = minecraft.getSingleplayerServer(); - if (server == null || minecraft.player == null) { - return List.of(); - } - ServerPlayer player = server.getPlayerList().getPlayer(minecraft.player.getUUID()); - if (player == null) { - return List.of(); - } - return player.getData(Satistaskory.PLAYER_GOALS).toGoals(); - } - - public static void save(List goals) { - Minecraft minecraft = Minecraft.getInstance(); - IntegratedServer server = minecraft.getSingleplayerServer(); - if (server == null || minecraft.player == null) { - return; - } - UUID id = minecraft.player.getUUID(); - GoalPlan plan = GoalPlan.fromGoals(goals); - server.execute(() -> { - ServerPlayer player = server.getPlayerList().getPlayer(id); - if (player == null) { - return; - } - player.setData(Satistaskory.PLAYER_GOALS, plan); - }); - } -} diff --git a/src/main/resources/META-INF/neoforge.mods.toml b/src/main/resources/META-INF/neoforge.mods.toml index 5cbac8a..27abed5 100644 --- a/src/main/resources/META-INF/neoforge.mods.toml +++ b/src/main/resources/META-INF/neoforge.mods.toml @@ -44,6 +44,10 @@ displayName="${mod_name}" #mandatory # The authors of the mod, displayed in the mod UI (optional) authors="sufficient" +# Client-only. The server must not require this mod to be installed. +# IGNORE_ALL_VERSION: joining a host that does not have Satistaskory is allowed. +displayTest="IGNORE_ALL_VERSION" + # The description text for the mod (multi line!) (#mandatory) description=''' A Satisfactory-inspired crafting planner and goal tracker @@ -75,7 +79,7 @@ A Satisfactory-inspired crafting planner and goal tracker # AFTER - This mod is loaded AFTER the dependency ordering="NONE" # Side this dependency is applied on - BOTH, CLIENT, or SERVER - side="BOTH" + side="CLIENT" # Here's another dependency [[dependencies.${mod_id}]] @@ -84,7 +88,7 @@ A Satisfactory-inspired crafting planner and goal tracker # This version range declares a minimum of the current minecraft version up to but not including the next major version versionRange="${minecraft_version_range}" ordering="NONE" - side="BOTH" + side="CLIENT" # Features are specific properties of the game environment, that you may want to declare you require. This example declares # that your mod requires GL version 3.2 or higher. Other features will be added. They are side aware so declaring this won't diff --git a/src/test/java/com/sufficient/satistaskory/infrastructure/persistence/ClientSaveKeysTest.java b/src/test/java/com/sufficient/satistaskory/infrastructure/persistence/ClientSaveKeysTest.java new file mode 100644 index 0000000..07f71ed --- /dev/null +++ b/src/test/java/com/sufficient/satistaskory/infrastructure/persistence/ClientSaveKeysTest.java @@ -0,0 +1,22 @@ +package com.sufficient.satistaskory.infrastructure.persistence; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.Test; + +class ClientSaveKeysTest { + @Test + void sanitizesHostAndPort() { + assertEquals("127.0.0.1_25565.dat", ClientSaveKeys.remoteFileName("127.0.0.1:25565")); + } + + @Test + void keepsHostnameDots() { + assertEquals("play.hypixel.net.dat", ClientSaveKeys.remoteFileName("play.hypixel.net")); + } + + @Test + void emptyBecomesUnknown() { + assertEquals("unknown.dat", ClientSaveKeys.remoteFileName(" ")); + } +}