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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 0.4.0

La Ménagerie and the Critterbook.

- **La Ménagerie**, the journal: its own menu, opened with `/mobsquad journal` or from the book in the Bunkhouse menu. Each launch critter has a page with its Critterbook number, a half-ridiculous line about it, how to coax it, its special and your best one's level. Locked pages show only their number.
- **Pages open when you meet a critter**: within 10 blocks with a clear line of sight, or when you coax or are given one. You're told, with a link to the journal. Pages are saved in the player's file as `page` lines; files from before 0.4.0 open pages for the critters already in them.
- **Critterbook numbers** for all 88 mobs in Java Edition, in the order each first appeared, from the Minecraft Wiki's history sections. Same-version ties go by first snapshot, then alphabetically. The launch critters: creeper 1, skeleton 3, chicken 9, enderman 15, iron golem 25, fox 62, bee 63, axolotl 69, allay 75. The list ships in the jar as `critterbook.txt`.
- Not yet: spirit coats (the page says they come later) and quest chapters opening pages.

## 0.3.0

Levels and specials.
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Coax mobs into critters for Paper: they follow you, fight only hostile mobs, and live safely in a shared Bunkhouse. No client mods. Gotta coax em all... Pokemob!

**Status:** 0.3.0. Critters level up from 1 to 100 and every launch critter has its special. Passed with bots on throwaway Paper 26.1.2 and 26.2 servers (133 checks each). On 26.3 the bots can't use blocks, so only the commands and the coaxing puzzles ran there (52 checks). Bots can't crouch where the server sees it, so the creeper and fox puzzles were tested with a test-only stand-in for crouching; real crouching is untested. The skeleton's longer range and the enderman's teleport out of trouble have no bot test yet. Nothing has been seen in a real game client yet.
**Status:** 0.4.0. La Ménagerie, the journal, with Critterbook numbers. Passed with bots on throwaway Paper 26.1.2 and 26.2 servers (147 checks each). On 26.3 the bots can't use blocks, so the Bunkhouse menu and everything sent out from it didn't run there (65 checks ran). Bots can't crouch where the server sees it, so the creeper and fox puzzles were tested with a test-only stand-in for crouching; real crouching is untested. The skeleton's longer range and the enderman's teleport out of trouble have no bot test yet. Nothing has been seen in a real game client yet, including how the journal looks.

## What it does

Expand All @@ -19,6 +19,7 @@ Coax mobs into critters for Paper: they follow you, fight only hostile mobs, and
- Enderman: right-click it, then swing at a block within 8 blocks, and it fetches it for you. Only blocks an enderman can carry, and only where you could dig yourself, so claims say no. When it's badly hurt, it teleports to you.
- Skeleton: covering fire from 15 blocks, reaching further and shooting faster at each milestone.
- Iron golem: takes a quarter of any hostile mob's hit on you within 8 blocks, and throws the mobs it hits back.
- **La Ménagerie.** Your journal, with a page for each critter: its Critterbook number, a line about it, how to coax it and its special. A page opens the first time you're within 10 blocks of that critter and can see it, or when you get one. `/mobsquad journal` or the book in the Bunkhouse menu opens it. Critterbook numbers follow the order each mob first appeared in Minecraft Java Edition, so the creeper is No. 1 and the allay No. 75. Every mob in the game has a number already, and the numbers never change.
- **Vittles.** Right-click them to perk up a tuckered-out critter on the spot. Craft two from bread, a carrot and sweet berries.
- **Bunkhouses.** An admin marks a vault block as a Bunkhouse. Anyone who right-clicks it sees only their own critters. Click one to send it out or call it back. Critters never exist as items, so they can't be dropped, traded or duplicated.
- **Following.** A critter out with you walks after you and steps beside you if it's left more than 24 blocks behind.
Expand All @@ -37,9 +38,10 @@ Settings are in `plugins/MobSquad/config.yml`: worlds where MobSquad is off, the

| Command | Who | What it does |
| --- | --- | --- |
| `/mobsquad` | everyone | How it works, in three lines. |
| `/mobsquad` | everyone | How it works, in four lines. |
| `/mobsquad list` | everyone | Your critters and your Wranglin' level. |
| `/mobsquad hints` | everyone | How to coax each critter. |
| `/mobsquad journal` | everyone | Opens La Ménagerie. |
| `/mobsquad dinnerbell` | everyone | Gives you a dinnerbell. |
| `/mobsquad bunkhouse add` and `remove` | admins | Marks or unmarks the vault you're looking at. |
| `/mobsquad give <player> <critter>` | admins | Puts a critter in a player's Bunkhouse. |
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

group = "com.extantape"
version = "0.3.0"
version = "0.4.0"

java {
toolchain.languageVersion.set(JavaLanguageVersion.of(25))
Expand Down
3 changes: 3 additions & 0 deletions docs/decisions.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ Dated decisions for this repo, newest last.
- 2026-11-15: the fox waits 5 seconds before fetching a dropped item, so you can still drop something for a friend, and fetches an item only once. Items count as yours when you threw them, broke the block they came from or beat the mob that dropped them.
- 2026-11-15: the creeper's blast needs no player within its radius plus 3 blocks, and hits only mobs a critter may fight. Every 6 seconds (0.75 s less per milestone); a plain hit in between.
- 2026-11-15: the four "later" parts of specials in the brief (speed eggs, glowing sting, pounce, sharing arrows) wait for a later release.
- 2026-11-15: Critterbook numbers come from the first Java Edition entry in each mob's History section on the Minecraft Wiki, including experimental snapshots (the camel, sniffer, breeze, bogged and creaking first appeared behind experiments). A texture added before the mob doesn't count (piglin, silverfish). Mobs from the same version are ordered by first snapshot, then alphabetically by entity id. The 88 numbered are the mobs the wiki lists as current in Java Edition, without unused, removed, joke, Education or upcoming ones. The list is `src/main/resources/critterbook.txt`; numbers never change, and new mobs get the next numbers.
- 2026-11-15: a page opens when you're within 10 blocks of a living launch critter (anyone's, or wild) and have a clear line of sight, checked every 2 seconds, or when a critter is added to your Bunkhouse. Owning a critter always opens its page.
- 2026-11-15, written by the lead, for the owner's say: the eight page lines other than the creeper's, which is the owner's own (brief, "Voice").
8 changes: 8 additions & 0 deletions docs/test-audit.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

Kept by this repo's owning session, per `~/Code/CLAUDE.md`, "Test self-audits". Newest first.

## 2026-11-15: 0.4.0

- Promises added: README "La Ménagerie", the journal command, CHANGELOG 0.4.0, the Critterbook decisions.
- Covered by unit tests (ModelTest): Critterbook numbers run 1 to 88 with no gaps; the nine launch numbers are pinned so they can't change; page lines round-trip; an older file opens pages for critters already in it.
- Covered by bots (147 checks on 26.1.2 and 26.2, 65 on 26.3; the journal runs on all three): the command opens the journal; a new player's pages are all locked, in Critterbook order; meeting a fox opens and saves its page; a creeper behind a wall and a chicken 25 blocks away aren't met, and the creeper is once the wall goes; getting a critter opens its page; open pages show the critter and locked ones stay hidden; clicking an open page sends a book and a locked one doesn't; nothing can be taken from the journal; the Bunkhouse menu opens it (26.1.2 and 26.2).
- Gaps skipped: what the book pages say and how they look (bots get the book packet but don't render it; the text is plain data in Journal.java); meeting while MobSquad is off in a world (same settings check as the Bunkhouse, covered).
- Gaps for later: spirit coats and quest chapters when they land.

## 2026-11-15: 0.3.0

- Promises added: README "Levels" and "Specials", the Safety line on the two block-touching specials, CHANGELOG 0.3.0, the new decisions entries.
Expand Down
20 changes: 19 additions & 1 deletion src/main/java/com/extantape/mobsquad/MobSquadPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.extantape.mobsquad.world.Posse;
import com.extantape.mobsquad.world.Safety;
import com.extantape.mobsquad.world.Specials;
import com.extantape.mobsquad.world.Journal;
import com.extantape.mobsquad.model.Growth;
import com.mojang.brigadier.Command;
import com.mojang.brigadier.arguments.IntegerArgumentType;
Expand Down Expand Up @@ -44,6 +45,7 @@ public final class MobSquadPlugin extends JavaPlugin {
private Dinnerbell dinnerbell;
private Coaxing coaxing;
private Vittles vittles;
private Journal journal;

@Override
public void onEnable() {
Expand All @@ -62,7 +64,11 @@ public void onEnable() {
var pm = getServer().getPluginManager();
pm.registerEvents(specials, this);
pm.registerEvents(new Safety(squads), this);
pm.registerEvents(new BunkhouseMenu(squads, bunkhouses), this);
Journal journal = new Journal(this, squads);
squads.pageOpener((p, s) -> journal.open(p, s, "got"));
this.journal = journal;
pm.registerEvents(journal, this);
pm.registerEvents(new BunkhouseMenu(squads, bunkhouses, journal), this);
pm.registerEvents(dinnerbell, this);
pm.registerEvents(coaxing, this);
pm.registerEvents(vittles, this);
Expand All @@ -81,13 +87,15 @@ public void onLoad(EntitiesLoadEvent e) {
getServer().getScheduler().runTaskTimer(this, posse, Posse.FOLLOW_TICKS, Posse.FOLLOW_TICKS);
getServer().getScheduler().runTaskTimer(this, coaxing, Coaxing.PERIOD, Coaxing.PERIOD);
getServer().getScheduler().runTaskTimer(this, specials, Specials.PERIOD, Specials.PERIOD);
getServer().getScheduler().runTaskTimer(this, journal, Journal.PERIOD, Journal.PERIOD);
getServer().getScheduler().runTaskTimer(this, squads::saveAll, 20L * 300, 20L * 300);
getLifecycleManager().registerEventHandler(LifecycleEvents.COMMANDS, e -> e.registrar().register(
Commands.literal("mobsquad")
.requires(src -> src.getSender().hasPermission("mobsquad.use"))
.executes(this::help)
.then(Commands.literal("list").executes(this::list))
.then(Commands.literal("hints").executes(this::hints))
.then(Commands.literal("journal").executes(this::journal))
.then(Commands.literal("dinnerbell").executes(this::giveBell))
.then(Commands.literal("bunkhouse").requires(src -> src.getSender().hasPermission("mobsquad.admin"))
.then(Commands.literal("add").executes(c -> bunkhouse(c, true)))
Expand Down Expand Up @@ -132,6 +140,7 @@ private int help(CommandContext<CommandSourceStack> c) {
say(c, "MobSquad: coax a mob and it waits in your Bunkhouse. Right-click a Bunkhouse to send critters out and call them back.", NamedTextColor.GOLD);
say(c, "/mobsquad list shows your critters. /mobsquad dinnerbell gives you a bell that calls them all home.", NamedTextColor.GRAY);
say(c, "/mobsquad hints tells you how to coax each critter. Vittles perk up a tuckered-out critter on the spot.", NamedTextColor.GRAY);
say(c, "/mobsquad journal opens La Ménagerie, with a page for every critter you've met.", NamedTextColor.GRAY);
return Command.SINGLE_SUCCESS;
}

Expand Down Expand Up @@ -167,6 +176,15 @@ private int hints(CommandContext<CommandSourceStack> c) {
return Command.SINGLE_SUCCESS;
}

private int journal(CommandContext<CommandSourceStack> c) {
if (!(c.getSource().getExecutor() instanceof Player p)) {
say(c, "Only a player has a journal.", NamedTextColor.YELLOW);
return 0;
}
journal.show(p);
return Command.SINGLE_SUCCESS;
}

private int giveBell(CommandContext<CommandSourceStack> c) {
if (!(c.getSource().getExecutor() instanceof Player p)) {
say(c, "Only a player can carry a dinnerbell.", NamedTextColor.YELLOW);
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/com/extantape/mobsquad/Squads.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public final class Squads {
private final Map<UUID, Wrangler> online = new HashMap<>();
private Posse posse;
private Settings settings;
private java.util.function.BiConsumer<Player, com.extantape.mobsquad.model.Species> pageOpener;

public Squads(Store store, Logger log, Settings settings) {
this.store = store;
Expand Down Expand Up @@ -88,11 +89,17 @@ public void addWranglin(Player p, long xp) {
if (after > before) p.sendMessage(Component.text("Your Wranglin' is now level " + after + ".", NamedTextColor.GOLD));
}

/** Called when a player gets a critter whose La Ménagerie page they haven't opened. */
public void pageOpener(java.util.function.BiConsumer<Player, com.extantape.mobsquad.model.Species> opener) {
this.pageOpener = opener;
}

public void add(Player p, Critter c) {
Wrangler w = get(p);
if (w == null) return;
w.critters.add(c);
save(w);
if (!w.pages.contains(c.species()) && pageOpener != null) pageOpener.accept(p, c.species());
}

/** Experience for a critter that's out; tells its owner when it levels up or passes a milestone. */
Expand Down
54 changes: 54 additions & 0 deletions src/main/java/com/extantape/mobsquad/model/Critterbook.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.extantape.mobsquad.model;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;

/**
* Critterbook numbers (brief, "La Ménagerie"): every mob in Java Edition in the order it first appeared, read from
* {@code critterbook.txt} in the jar. Numbers never change.
*/
public final class Critterbook {
private static final Map<String, Integer> NUMBERS = load();

private Critterbook() {}

private static Map<String, Integer> load() {
Map<String, Integer> m = new LinkedHashMap<>();
try (InputStream in = Critterbook.class.getResourceAsStream("/critterbook.txt")) {
if (in == null) throw new IllegalStateException("critterbook.txt is missing from the jar");
BufferedReader r = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8));
for (String line; (line = r.readLine()) != null; ) {
int hash = line.indexOf('#');
String s = (hash < 0 ? line : line.substring(0, hash)).strip();
if (s.isEmpty()) continue;
String[] p = s.split("\\s+");
m.put(p[1], Integer.parseInt(p[0]));
}
} catch (IOException e) {
throw new IllegalStateException("couldn't read critterbook.txt", e);
}
return Collections.unmodifiableMap(m);
}

/** Every numbered mob, entity id to number, in number order. */
public static Map<String, Integer> all() {
return NUMBERS;
}

public static int number(Species s) {
return NUMBERS.get(s.id());
}

/** Launch critters in Critterbook order. */
public static java.util.List<Species> inOrder() {
java.util.List<Species> l = new java.util.ArrayList<>(java.util.List.of(Species.values()));
l.sort(java.util.Comparator.comparingInt(Critterbook::number));
return l;
}
}
2 changes: 2 additions & 0 deletions src/main/java/com/extantape/mobsquad/model/Wrangler.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ public final class Wrangler {
public final UUID player;
public long wranglinXp;
public final List<Critter> critters = new ArrayList<>();
/** The La Ménagerie pages this player has opened. */
public final java.util.Set<Species> pages = java.util.EnumSet.noneOf(Species.class);

public Wrangler(UUID player) {
this.player = player;
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/com/extantape/mobsquad/store/Store.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
* <pre>
* wranglin 150
* critter 6b1f... chicken 1 0 0 Clucky
* page chicken
* </pre>
*
* A critter line is its id, species, level, experience, when it's rested (epoch milliseconds, 0 when ready) and its
* name, URL-encoded. Written to a temporary file and moved into place, so a crash leaves the old file or the new one.
* name, URL-encoded. A page line is a La Ménagerie page the player has opened; owning a critter opens its page too. Written to a temporary file and moved into place, so a crash leaves the old file or the new one.
* Lines that can't be read are skipped and counted, never guessed at.
*/
public final class Store {
Expand Down Expand Up @@ -55,12 +56,18 @@ public Loaded load(UUID player) throws IOException {
w.critters.add(new Critter(UUID.fromString(p[1]), s, URLDecoder.decode(p[6], StandardCharsets.UTF_8),
Integer.parseInt(p[3]), Long.parseLong(p[4]), Long.parseLong(p[5])));
}
case "page" -> {
Species s = Species.byId(p[1]);
if (s == null) throw new IllegalArgumentException();
w.pages.add(s);
}
default -> skipped++;
}
} catch (RuntimeException e) {
skipped++;
}
}
for (Critter c : w.critters) w.pages.add(c.species()); // files from before 0.4.0 have no page lines
return new Loaded(w, skipped);
}

Expand All @@ -72,6 +79,7 @@ public void save(Wrangler w) throws IOException {
sb.append("critter ").append(c.id()).append(' ').append(c.species().id()).append(' ').append(c.level()).append(' ')
.append(c.xp()).append(' ').append(c.tuckeredUntil()).append(' ')
.append(URLEncoder.encode(c.name(), StandardCharsets.UTF_8)).append('\n');
for (Species s : w.pages) sb.append("page ").append(s.id()).append('\n');
Path tmp = dir.resolve(w.player + ".txt.tmp");
Files.writeString(tmp, sb.toString(), StandardCharsets.UTF_8);
Files.move(tmp, file(w.player), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE);
Expand Down
Loading
Loading