Move farmers delight to bworld

This commit is contained in:
2026-11-01 00:49:05 -03:00
parent 4a713a85d1
commit 61693d611a
161 changed files with 403 additions and 466 deletions
+5 -5
View File
@@ -136,12 +136,12 @@ Deno.test("/give suggests item ids as they're typed", async () => {
const ids = (text: string) => suggest(text).suggestions.map((s: { text: string }) => s.text);
assertEquals(ids("/give ").length, 100);
assert(ids("/give bworld:sto").includes("bworld:stone"));
assert(ids("/give farmersdelight:cab").includes("farmersdelight:cabbage"));
assert(ids("/give bworld:cab").includes("bworld:cabbage"));
assert(!ids("/give bworld:a").includes("bworld:air"));
assertEquals(suggest("/give farmersdelight:tom").suggestions.map((s: { text: string }) => s.text), [
"farmersdelight:tomato",
"farmersdelight:tomato_sauce",
"farmersdelight:tomato_seeds",
assertEquals(suggest("/give bworld:tom").suggestions.map((s: { text: string }) => s.text), [
"bworld:tomato",
"bworld:tomato_sauce",
"bworld:tomato_seeds",
]);
assertEquals(suggest("/gi").suggestions, [{ text: "give" }]);
+32 -32
View File
@@ -18,7 +18,7 @@ async function setup() {
stone_floor(t.game);
t.send(1, { type: "move", x: 2.5, y: 100, z: 2.5, yaw: 0, pitch: 0 });
t.game.set_block(...FURNACE, "bworld:furnace");
t.game.set_block(...POT, "farmersdelight:cooking_pot");
t.game.set_block(...POT, "bworld:cooking_pot");
const container = (at: readonly [number, number, number]) => {
const id = (t.game.world.get_tile(...at)?.mod_data as { container: string }).container;
@@ -43,12 +43,12 @@ async function setup() {
Deno.test("the pot only cooks over a lit furnace, then serves the meal into bowls", async () => {
const t = await setup();
t.put(0, "farmersdelight:tomato", 2);
t.put(3, "farmersdelight:tomato", 2);
t.put(0, "bworld:tomato", 2);
t.put(3, "bworld:tomato", 2);
// cold: nothing happens
t.ticks(150);
assertEquals(t.slot(0), "farmersdelight:tomato 2");
assertEquals(t.slot(0), "bworld:tomato 2");
assertEquals(t.slot(6), "");
t.light_furnace();
@@ -56,13 +56,13 @@ Deno.test("the pot only cooks over a lit furnace, then serves the meal into bowl
assertEquals(t.game.world.get_block_id(...FURNACE), "bworld:furnace");
t.ticks(100);
// one sauce, one tomato from each slot, waiting in the pot for a bowl
assertEquals(t.slot(6), "farmersdelight:tomato_sauce 1");
assertEquals(t.slot(0), "farmersdelight:tomato 1");
assertEquals(t.slot(3), "farmersdelight:tomato 1");
assertEquals(t.slot(6), "bworld:tomato_sauce 1");
assertEquals(t.slot(0), "bworld:tomato 1");
assertEquals(t.slot(3), "bworld:tomato 1");
assertEquals(t.slot(8), "");
t.ticks(100);
assertEquals(t.slot(6), "farmersdelight:tomato_sauce 2");
assertEquals(t.slot(6), "bworld:tomato_sauce 2");
assertEquals(t.slot(0), "");
// bowls take it out
@@ -70,59 +70,59 @@ Deno.test("the pot only cooks over a lit furnace, then serves the meal into bowl
t.ticks(1);
assertEquals(t.slot(6), "");
assertEquals(t.slot(7), "bworld:bowl 3");
assertEquals(t.slot(8), "farmersdelight:tomato_sauce 2");
assertEquals(t.slot(8), "bworld:tomato_sauce 2");
});
Deno.test("ingredients go in any slots, lists take any of their items, and meals without a container come right out", async () => {
const t = await setup();
t.light_furnace();
t.put(5, "bworld:potato");
t.put(1, "farmersdelight:cabbage");
t.put(1, "bworld:cabbage");
t.ticks(101);
assertEquals(t.slot(8), "farmersdelight:cabbage_rolls 1");
assertEquals(t.slot(8), "bworld:cabbage_rolls 1");
assertEquals(t.slot(6), "");
// something extra matches nothing
t.put(0, "farmersdelight:cabbage");
t.put(1, "farmersdelight:onion");
t.put(2, "farmersdelight:rice");
t.put(0, "bworld:cabbage");
t.put(1, "bworld:onion");
t.put(2, "bworld:rice");
t.ticks(300);
assertEquals(t.slot(8), "farmersdelight:cabbage_rolls 1");
assertEquals(t.slot(0), "farmersdelight:cabbage 1");
assertEquals(t.slot(8), "bworld:cabbage_rolls 1");
assertEquals(t.slot(0), "bworld:cabbage 1");
// a different meal waits until the pot's empty of the other
t.pot.set_item(0, undefined);
t.pot.set_item(1, undefined);
t.ticks(100);
assertEquals(t.slot(6), "farmersdelight:cooked_rice 1");
t.put(0, "farmersdelight:tomato", 2);
t.put(1, "farmersdelight:tomato", 2);
assertEquals(t.slot(6), "bworld:cooked_rice 1");
t.put(0, "bworld:tomato", 2);
t.put(1, "bworld:tomato", 2);
t.ticks(300);
assertEquals(t.slot(6), "farmersdelight:cooked_rice 1");
assertEquals(t.slot(0), "farmersdelight:tomato 2");
assertEquals(t.slot(6), "bworld:cooked_rice 1");
assertEquals(t.slot(0), "bworld:tomato 2");
});
Deno.test("holding a bowl serves the meal straight into your hand, and breaking the pot drops everything", async () => {
const t = await setup();
t.light_furnace();
t.put(0, "farmersdelight:rice", 3);
t.put(0, "bworld:rice", 3);
t.ticks(301);
assertEquals(t.slot(6), "farmersdelight:cooked_rice 3");
assertEquals(t.slot(6), "bworld:cooked_rice 3");
t.send(1, { type: "chat", text: "/give bworld:bowl 2" });
const inventory = () => t.game.players()[0].inventory.to_data().filter((i) => i);
t.send(1, { type: "select_slot", slot: 0 });
t.send(1, { type: "use_block", x: POT[0], y: POT[1], z: POT[2], face: "top" });
assertEquals(t.slot(6), "farmersdelight:cooked_rice 2");
assertEquals(inventory().map((i) => `${i!.id} ${i!.count}`), ["bworld:bowl 1", "farmersdelight:cooked_rice 1"]);
assertEquals(t.slot(6), "bworld:cooked_rice 2");
assertEquals(inventory().map((i) => `${i!.id} ${i!.count}`), ["bworld:bowl 1", "bworld:cooked_rice 1"]);
t.game.destroy_block(...POT);
const dropped = t.game.item_entities().map((e) => `${e.item.type_id} ${e.item.amount}`);
assert(dropped.includes("farmersdelight:cooked_rice 2"), String(dropped));
assert(dropped.includes("bworld:cooked_rice 2"), String(dropped));
});
Deno.test("mods' own recipe types are accepted, and model faces can turn their texture", () => {
assertEquals(validate_recipe({ type: "farmersdelight:cooking", anything: 1 }), []);
assertEquals(validate_recipe({ type: "bworld:cooking", anything: 1 }), []);
assertEquals(validate_recipe({ type: "cooking" }).length, 1);
const face = (rotation?: number) =>
@@ -144,21 +144,21 @@ Deno.test("a stove is placed lit and heats the pot, coal relights it, and standi
const t = await setup();
const info = () => t.game.world.get_block_info(...FURNACE)!;
const lit = () => get_state_value(t.game.world.get_block_value(...FURNACE), info(), "lit");
t.game.set_block(...FURNACE, "farmersdelight:stove");
t.game.set_block(...FURNACE, "bworld:stove");
assertEquals(lit(), 1);
t.put(0, "farmersdelight:rice");
t.put(0, "bworld:rice");
t.ticks(101);
assertEquals(t.slot(6), "farmersdelight:cooked_rice 1");
assertEquals(t.slot(6), "bworld:cooked_rice 1");
// out, it doesn't cook
t.game.set_block_state(
...FURNACE,
set_state_value(t.game.world.get_block_value(...FURNACE), info(), "lit", 0)! >>> 16,
);
t.put(0, "farmersdelight:rice");
t.put(0, "bworld:rice");
t.ticks(150);
assertEquals(t.slot(6), "farmersdelight:cooked_rice 1");
assertEquals(t.slot(6), "bworld:cooked_rice 1");
// coal lights it again, used up
t.send(1, { type: "chat", text: "/give bworld:coal 2" });
+13 -13
View File
@@ -14,10 +14,10 @@ async function setup(yaw = 0) {
t.join(1, "alice");
stone_floor(t.game);
t.send(1, { type: "move", x: 2.5, y: 100, z: 2.5, yaw, pitch: 0 });
t.send(1, { type: "chat", text: "/give farmersdelight:cutting_board" });
t.send(1, { type: "chat", text: "/give bworld:cutting_board" });
t.send(1, { type: "select_slot", slot: 0 });
t.send(1, { type: "use_block", x: BOARD[0], y: BOARD[1] - 1, z: BOARD[2], face: "top" });
assertEquals(t.game.world.get_block_id(...BOARD), "farmersdelight:cutting_board");
assertEquals(t.game.world.get_block_id(...BOARD), "bworld:cutting_board");
const use = (slot: number) => {
t.send(1, { type: "select_slot", slot });
@@ -58,15 +58,15 @@ Deno.test("so does any block with a facing state, like the furnace, keeping its
Deno.test("a stack goes on the board, and a knife cuts one at a time by its recipe", async () => {
const t = await setup();
t.send(1, { type: "chat", text: "/give bworld:cod 3" });
t.send(1, { type: "chat", text: "/give farmersdelight:iron_knife" });
t.send(1, { type: "chat", text: "/give bworld:iron_knife" });
t.use(0);
assertEquals(t.on_board(), "bworld:cod 3");
assertEquals(t.inventory(), ["farmersdelight:iron_knife 1"]);
assertEquals(t.inventory(), ["bworld:iron_knife 1"]);
t.use(1);
assertEquals(t.on_board(), "bworld:cod 2");
assertEquals(t.dropped(), ["bworld:bone_meal 1", "farmersdelight:cod_slice 2"]);
assertEquals(t.dropped(), ["bworld:bone_meal 1", "bworld:cod_slice 2"]);
t.use(1);
t.use(1);
assertEquals(t.on_board(), "");
@@ -74,25 +74,25 @@ Deno.test("a stack goes on the board, and a knife cuts one at a time by its reci
// on an empty board the knife goes on it, like the java mod, and cutting nothing does nothing
t.use(1);
assertEquals(t.on_board(), "farmersdelight:iron_knife 1");
t.send(1, { type: "chat", text: "/give farmersdelight:stone_knife" });
assertEquals(t.on_board(), "bworld:iron_knife 1");
t.send(1, { type: "chat", text: "/give bworld:stone_knife" });
t.use(0);
assertEquals(t.on_board(), "farmersdelight:iron_knife 1");
assertEquals(t.inventory(), ["farmersdelight:stone_knife 1"]);
assertEquals(t.on_board(), "bworld:iron_knife 1");
assertEquals(t.inventory(), ["bworld:stone_knife 1"]);
});
Deno.test("an empty hand takes it all back, and breaking the board drops it", async () => {
const t = await setup();
t.send(1, { type: "chat", text: "/give farmersdelight:cabbage 5" });
t.send(1, { type: "chat", text: "/give bworld:cabbage 5" });
t.use(0);
assertEquals(t.on_board(), "farmersdelight:cabbage 5");
assertEquals(t.on_board(), "bworld:cabbage 5");
t.use(1);
assertEquals(t.on_board(), "");
assertEquals(t.inventory(), ["farmersdelight:cabbage 5"]);
assertEquals(t.inventory(), ["bworld:cabbage 5"]);
t.use(0);
t.game.destroy_block(...BOARD);
assertEquals(t.dropped(), ["farmersdelight:cabbage 5", "farmersdelight:cutting_board 1"]);
assertEquals(t.dropped(), ["bworld:cabbage 5", "bworld:cutting_board 1"]);
assertEquals(t.game.world.get_tile(...BOARD), undefined);
});
+12 -12
View File
@@ -161,8 +161,8 @@ Deno.test("each crop takes its own number of watered days to grow", async () =>
assertEquals(grow(t, 0, "bworld:carrots", 3), [1, 2, 3]);
assertEquals(grow(t, 1, "bworld:potatoes", 6), [0, 1, 1, 2, 2, 3]);
assertEquals(grow(t, 2, "bworld:wheat", 7), [1, 2, 3, 4, 5, 6, 7]);
assertEquals(grow(t, -1, "farmersdelight:onions", 4), [0, 1, 2, 3]);
const cabbage = grow(t, -2, "farmersdelight:cabbages", 12);
assertEquals(grow(t, -1, "bworld:onions", 4), [0, 1, 2, 3]);
const cabbage = grow(t, -2, "bworld:cabbages", 12);
assertEquals(cabbage.at(-2), 6, "not grown a day early");
assertEquals(cabbage.at(-1), 7);
@@ -191,16 +191,16 @@ Deno.test("tomatoes take 11 days, are picked by hand, and grow back in 4", async
// they only grow in summer, which starts on day 50
t.game.set_time(49 * CYCLE_TICKS);
t.game.tick();
const ages = grow(t, 1, "farmersdelight:tomatoes", 11);
const ages = grow(t, 1, "bworld:tomatoes", 11);
assertEquals(ages.at(-1), 7);
assertEquals(ages.at(-2), 6);
t.use(1, 101, 0);
const picked = t.game.item_entities().map((e) => e.item.to_data());
assertEquals(picked.length, 1);
assertEquals(picked[0].id, "farmersdelight:tomato");
assertEquals(picked[0].id, "bworld:tomato");
assert(picked[0].count >= 1 && picked[0].count <= 2);
assertEquals(t.game.world.get_block_id(1, 101, 0), "farmersdelight:tomatoes", "the plant stays");
assertEquals(t.game.world.get_block_id(1, 101, 0), "bworld:tomatoes", "the plant stays");
assertEquals(t.state(1, 101, 0, "age"), 4, "back to a young vine");
// 3 watered mornings isn't enough, the 4th is
@@ -212,24 +212,24 @@ Deno.test("tomatoes take 11 days, are picked by hand, and grow back in 4", async
});
Deno.test("rice is planted in water, grows panicles on top without watering, and leaves its water when harvested", async () => {
const t = await setup(["farmersdelight:rice 2"]);
const t = await setup(["bworld:rice 2"]);
t.game.set_block(1, 99, 0, "bworld:dirt");
t.game.set_block(1, 100, 0, "bworld:water");
t.game.set_block(2, 100, 0, "bworld:hoed_dirt");
// not on land
t.hold("farmersdelight:rice");
t.hold("bworld:rice");
t.use(2, 100, 0);
assertEquals(t.game.world.get_block_id(2, 101, 0), "bworld:air");
// into the water, standing on the dirt under it
t.use(1, 100, 0);
assertEquals(t.game.world.get_block_id(1, 100, 0), "farmersdelight:rice");
assertEquals(t.game.world.get_block_id(1, 100, 0), "bworld:rice");
for (let day = 0; day < 3; day++) t.next_morning();
assertEquals(t.state(1, 100, 0, "age"), 3);
assertEquals(t.game.world.get_block_id(1, 101, 0), "bworld:air");
for (let day = 0; day < 3; day++) t.next_morning();
assertEquals(t.game.world.get_block_id(1, 101, 0), "farmersdelight:rice_panicles");
assertEquals(t.game.world.get_block_id(1, 101, 0), "bworld:rice_panicles");
assertEquals(t.state(1, 101, 0, "age"), 3, "fully grown after 6 days");
assertEquals(t.state(1, 100, 0, "age"), 4, "the stalk holding them up");
@@ -239,7 +239,7 @@ Deno.test("rice is planted in water, grows panicles on top without watering, and
t.game.tick();
t.game.tick();
const dropped = t.game.item_entities().map((e) => e.item.type_id).sort();
assertEquals(dropped, ["farmersdelight:rice", "farmersdelight:rice_panicle"]);
assertEquals(dropped, ["bworld:rice", "bworld:rice_panicle"]);
assertEquals(t.game.world.get_block_id(1, 100, 0), "bworld:water");
assertEquals(t.game.world.get_block_id(1, 101, 0), "bworld:air");
});
@@ -263,9 +263,9 @@ Deno.test("a crop dies into a dead bush the first morning out of its seasons", a
Deno.test("a two block crop dies whole, its top going without dropping anything", async () => {
const t = await setup();
t.game.set_block(1, 99, 0, "bworld:dirt");
t.game.set_block(1, 100, 0, "farmersdelight:rice");
t.game.set_block(1, 100, 0, "bworld:rice");
for (let day = 0; day < 6; day++) t.next_morning();
assertEquals(t.game.world.get_block_id(1, 101, 0), "farmersdelight:rice_panicles");
assertEquals(t.game.world.get_block_id(1, 101, 0), "bworld:rice_panicles");
// rice grows in autumn, dies in winter, winter starts on day 148
t.game.set_time(147 * CYCLE_TICKS - 1);
+10 -10
View File
@@ -65,21 +65,21 @@ Deno.test("the recipe viewer finds what makes and uses an item, in any recipe ty
assertEquals(outputs(bowl), [{ ids: ["bworld:bowl"], count: 4 }]);
// the cooking pot's own type: ingredients, alternatives, and the bowl it's served in
const [rolls] = making("farmersdelight:cabbage_rolls");
const [rolls] = making("bworld:cabbage_rolls");
assertEquals(category_name(rolls.type), "Cooking");
assertEquals(ids(inputs(rolls)), [
"farmersdelight:cabbage",
"bworld:carrot|bworld:potato|farmersdelight:onion|farmersdelight:tomato",
"bworld:cabbage",
"bworld:carrot|bworld:potato|bworld:onion|bworld:tomato",
]);
const [rice] = making("farmersdelight:cooked_rice");
assertEquals(ids(inputs(rice)), ["farmersdelight:rice", "bworld:bowl"]);
const [rice] = making("bworld:cooked_rice");
assertEquals(ids(inputs(rice)), ["bworld:rice", "bworld:bowl"]);
// uses: the bowl serves meals, coal is fuel and in the stove, potatoes are in cabbage rolls
const served_in_bowls = using("bworld:bowl").map((r) => outputs(r)[0].ids[0]);
assert(served_in_bowls.includes("farmersdelight:cooked_rice"));
assert(served_in_bowls.includes("farmersdelight:tomato_sauce"));
assert(served_in_bowls.includes("bworld:cooked_rice"));
assert(served_in_bowls.includes("bworld:tomato_sauce"));
assert(using("bworld:coal").some((r) => r.type === "fuel"));
assert(using("bworld:coal").some((r) => r.type === "shaped" && outputs(r)[0].ids[0] === "farmersdelight:stove"));
assert(using("bworld:coal").some((r) => r.type === "shaped" && outputs(r)[0].ids[0] === "bworld:stove"));
assert(using("bworld:potato").includes(rolls));
// smelting and smithing
@@ -96,8 +96,8 @@ Deno.test("recipes are found by category in jei's order, and a catalyst's uses a
const titles = index.categories.map((category) => category.title);
assertEquals(titles.slice(0, 4), ["Crafting", "Smelting", "Fuel", "Smithing"]);
assert(titles.includes("Cooking"));
assertEquals(index.categories.find((c) => c.type === "farmersdelight:cooking")?.catalysts, [
"farmersdelight:cooking_pot",
assertEquals(index.categories.find((c) => c.type === "bworld:cooking")?.catalysts, [
"bworld:cooking_pot",
]);
const furnace_uses = index.find(item("bworld:furnace"), "uses").map((
+2 -2
View File
@@ -186,7 +186,7 @@ Deno.test("check-mods finds broken tags and tags nobody defines", async () => {
recipe: { type: "fuel", item: "#maple:nothing_here", burn_time: 100 },
});
// another mod's namespace, without depending on it
write("tags/items/farmersdelight/knives.json", { format_version: 1, tag: { values: ["maple:maple_planks"] } });
write("tags/items/kitchen/knives.json", { format_version: 1, tag: { values: ["maple:maple_planks"] } });
const report = (await check_mods(dir, { typecheck: false })).find((r) => r.id === "maple")!;
const has = (list: string[], text: string) =>
@@ -197,7 +197,7 @@ Deno.test("check-mods finds broken tags and tags nobody defines", async () => {
has(report.errors, "tags/items/misplaced.json: tag files go in tags/<registry>/<namespace>/");
has(report.errors, `tags/fluids/maple/sap.json: registry must be "blocks", "items", "entities"`);
has(report.errors, "recipes/uses_missing_tag.json: item tag #maple:nothing_here doesn't exist");
has(report.warnings, `uses #farmersdelight:knives but doesn't list "farmersdelight" in dependencies`);
has(report.warnings, `uses #kitchen:knives but doesn't list "kitchen" in dependencies`);
// the shared namespace and optional entries need no dependency
assert(!report.warnings.some((w) => w.includes("c:wood") || w.includes("other_mod")), report.warnings.join("\n"));
Deno.removeSync(dir, { recursive: true });
+3 -3
View File
@@ -80,7 +80,7 @@ Deno.test("water flows out of a waterlogged fence, which never drains, and break
});
Deno.test("rice is only planted in a water source, holds it, and leaves it behind when broken", async () => {
const t = await setup([["farmersdelight:rice", 1]]);
const t = await setup([["bworld:rice", 1]]);
for (const x of [-2, 2, 4]) t.game.set_block(x, 99, 0, "bworld:dirt");
t.game.set_block(2, 100, 0, "bworld:water");
// not in flowing water, or out of water
@@ -91,8 +91,8 @@ Deno.test("rice is only planted in a water source, holds it, and leaves it behin
assertEquals(t.game.world.get_block_id(4, 100, 0), "bworld:air");
t.send(1, { type: "use_block", x: 2, y: 100, z: 0, face: "top", hit: [0.5, 1, 0.5] });
assertEquals(t.game.world.get_block_id(2, 100, 0), "farmersdelight:rice");
const rice = EverythingRegistry.get<BlockRegistry>("blocks", "farmersdelight:rice")!;
assertEquals(t.game.world.get_block_id(2, 100, 0), "bworld:rice");
const rice = EverythingRegistry.get<BlockRegistry>("blocks", "bworld:rice")!;
assertEquals(get_state_value(t.game.world.get_block_value(2, 100, 0), rice, "waterlogged"), 1);
assert(t.game.entities.is_fluid(2, 100, 0));