From cb7d655f0cfc473fb49fb6f16f7289f2c9d2fb56 Mon Sep 17 00:00:00 2001 From: Paula Date: Sat, 3 Oct 2026 18:56:44 -0300 Subject: [PATCH] Add the oak_ on the oak blocks --- common/generation.ts | 6 ++---- docs/modding/concepts/registries.md | 2 +- docs/modding/resources/models.md | 4 ++-- docs/modding/resources/recipes.md | 2 +- docs/modding/resources/tags.md | 5 +++-- mods/bworld/blocks/{leaves.json => oak_leaves.json} | 3 +-- mods/bworld/blocks/{log.json => oak_log.json} | 5 ++--- mods/bworld/blocks/{planks.json => oak_planks.json} | 5 ++--- mods/bworld/recipes/crafting_oak_fence.json | 2 +- .../{crafting_planks.json => crafting_oak_planks.json} | 4 ++-- mods/bworld/recipes/crafting_oak_trapdoor.json | 2 +- mods/bworld/tags/blocks/bworld/leaves.json | 2 +- mods/bworld/tags/blocks/bworld/logs.json | 2 +- mods/bworld/tags/blocks/bworld/planks.json | 2 +- mods/bworld/tags/items/bworld/logs.json | 2 +- mods/bworld/tags/items/bworld/planks.json | 2 +- tests/cooking_test.ts | 2 +- tests/fence_test.ts | 2 +- tests/mod_loading_test.ts | 2 +- tests/shared_rules_test.ts | 2 +- tests/shift_click_test.ts | 8 ++++---- tests/tags_test.ts | 2 +- tests/tint_test.ts | 2 +- tests/wood_test.ts | 6 +++--- tests/world_save_test.ts | 4 ++-- tools/worldgen_preview.ts | 4 ++-- 26 files changed, 40 insertions(+), 44 deletions(-) rename mods/bworld/blocks/{leaves.json => oak_leaves.json} (83%) rename mods/bworld/blocks/{log.json => oak_log.json} (75%) rename mods/bworld/blocks/{planks.json => oak_planks.json} (63%) rename mods/bworld/recipes/{crafting_planks.json => crafting_oak_planks.json} (71%) diff --git a/common/generation.ts b/common/generation.ts index f31d206..bf8537a 100644 --- a/common/generation.ts +++ b/common/generation.ts @@ -73,11 +73,9 @@ export function generate_raw_chunk( const nid = block_ids[name]; return nid === undefined ? AIR : default_values?.[nid] ?? nid; }; - // oak's are the plain bworld:log and bworld:leaves, the others are named after their wood + // each wood's are named after it, like bworld:oak_log const wood_ids = (part: "log" | "leaves") => - Object.fromEntries( - WOODS.map((wood) => [wood, id(wood === "oak" ? `bworld:${part}` : `bworld:${wood}_${part}`)]), - ) as Record; + Object.fromEntries(WOODS.map((wood) => [wood, id(`bworld:${wood}_${part}`)])) as Record; generate_overworld(blocks, heights, biomes, chunk_x, chunk_z, seed, { stone: id("bworld:stone"), dirt: id("bworld:dirt"), diff --git a/docs/modding/concepts/registries.md b/docs/modding/concepts/registries.md index 84fb715..e252de0 100644 --- a/docs/modding/concepts/registries.md +++ b/docs/modding/concepts/registries.md @@ -9,7 +9,7 @@ An id looks like `namespace:name`, like `farmersdelight:cabbage`: - `namespace` is the id of the mod that registers it, 1-32 characters of `a-z`, `0-9` and `_`. - `name` is `a-z`, `0-9` and `_`. -- A mod only registers ids in its own namespace. It can _refer to_ any id, like using `bworld:planks` in a recipe. +- A mod only registers ids in its own namespace. It can _refer to_ any id, like using `bworld:oak_planks` in a recipe. - Registering an id that's already registered, by the same mod or another, is an error. Two namespaces are reserved: diff --git a/docs/modding/resources/models.md b/docs/modding/resources/models.md index d4c697e..0dbd3a0 100644 --- a/docs/modding/resources/models.md +++ b/docs/modding/resources/models.md @@ -59,8 +59,8 @@ with a texture per face. `models/slab.json`: } ``` -A block using it sets `"model": "copper_tools:slab"` and `"textures": { "side": "bworld:planks" }`, and gets planks on -every face, since `top` and `bottom` default to `#side`. +A block using it sets `"model": "copper_tools:slab"` and `"textures": { "side": "bworld:oak_planks" }`, and gets planks +on every face, since `top` and `bottom` default to `#side`. | Field | Meaning | | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | diff --git a/docs/modding/resources/recipes.md b/docs/modding/resources/recipes.md index 62c19f3..684b30e 100644 --- a/docs/modding/resources/recipes.md +++ b/docs/modding/resources/recipes.md @@ -13,7 +13,7 @@ For the crafting grid in the player's inventory screen: "recipe": { "type": "shaped", "pattern": ["PPP", "P P", "PPP"], - "key": { "P": "bworld:planks" }, + "key": { "P": "bworld:oak_planks" }, "result": { "id": "bworld:chest", "count": 1 } } } diff --git a/docs/modding/resources/tags.md b/docs/modding/resources/tags.md index 2c92ec7..cc5171e 100644 --- a/docs/modding/resources/tags.md +++ b/docs/modding/resources/tags.md @@ -4,7 +4,8 @@ A tag is a named list of blocks, items or entities, like every kind of planks. R they take an id, and any mod can add to any tag, so a mod's planks can make sticks just by adding them to `#bworld:planks`. Tags work like [NeoForge's](https://docs.neoforged.net/docs/resources/server/tags). -A tag's id starts with `#` where it's used, so `#bworld:planks` is the tag and `bworld:planks` is the oak planks item. +A tag's id starts with `#` where it's used, so `#bworld:planks` is the tag of every kind of planks, and +`bworld:oak_planks` is one of them. ## Tag Files @@ -104,5 +105,5 @@ Mods' own [recipe types](recipes.md#custom-recipe-types) should take tags like t choice into the items it stands for, so the mod's server script can check and match them: ```ts -const ingredient = ctx.tags.expand(json.ingredient); // "#bworld:planks" -> ["bworld:planks", "bworld:spruce_planks", ...] +const ingredient = ctx.tags.expand(json.ingredient); // "#bworld:planks" -> ["bworld:oak_planks", "bworld:spruce_planks", ...] ``` diff --git a/mods/bworld/blocks/leaves.json b/mods/bworld/blocks/oak_leaves.json similarity index 83% rename from mods/bworld/blocks/leaves.json rename to mods/bworld/blocks/oak_leaves.json index 4ce3e7a..4afdccc 100644 --- a/mods/bworld/blocks/leaves.json +++ b/mods/bworld/blocks/oak_leaves.json @@ -1,8 +1,7 @@ { "format_version": 1, "block": { - "id": "bworld:leaves", - "name": "Oak Leaves", + "id": "bworld:oak_leaves", "textures": "bworld:oak_leaves", "tint": { "color": "foliage" diff --git a/mods/bworld/blocks/log.json b/mods/bworld/blocks/oak_log.json similarity index 75% rename from mods/bworld/blocks/log.json rename to mods/bworld/blocks/oak_log.json index 7ced3d9..cc875ef 100644 --- a/mods/bworld/blocks/log.json +++ b/mods/bworld/blocks/oak_log.json @@ -1,8 +1,7 @@ { "format_version": 1, "block": { - "id": "bworld:log", - "name": "Oak Log", + "id": "bworld:oak_log", "textures": { "side": "bworld:oak_log", "top": "bworld:oak_log_top", @@ -12,6 +11,6 @@ "toughness": 3, "tool": "axe" }, - "drops": "bworld:log" + "drops": "bworld:oak_log" } } diff --git a/mods/bworld/blocks/planks.json b/mods/bworld/blocks/oak_planks.json similarity index 63% rename from mods/bworld/blocks/planks.json rename to mods/bworld/blocks/oak_planks.json index e18d5e1..17e3a73 100644 --- a/mods/bworld/blocks/planks.json +++ b/mods/bworld/blocks/oak_planks.json @@ -1,13 +1,12 @@ { "format_version": 1, "block": { - "id": "bworld:planks", - "name": "Oak Planks", + "id": "bworld:oak_planks", "textures": "bworld:oak_planks", "mining": { "toughness": 3, "tool": "axe" }, - "drops": "bworld:planks" + "drops": "bworld:oak_planks" } } diff --git a/mods/bworld/recipes/crafting_oak_fence.json b/mods/bworld/recipes/crafting_oak_fence.json index 3f67371..3928749 100644 --- a/mods/bworld/recipes/crafting_oak_fence.json +++ b/mods/bworld/recipes/crafting_oak_fence.json @@ -7,7 +7,7 @@ "PSP" ], "key": { - "P": "bworld:planks", + "P": "bworld:oak_planks", "S": "bworld:stick" }, "result": { diff --git a/mods/bworld/recipes/crafting_planks.json b/mods/bworld/recipes/crafting_oak_planks.json similarity index 71% rename from mods/bworld/recipes/crafting_planks.json rename to mods/bworld/recipes/crafting_oak_planks.json index 82eacb2..6518284 100644 --- a/mods/bworld/recipes/crafting_planks.json +++ b/mods/bworld/recipes/crafting_oak_planks.json @@ -6,10 +6,10 @@ "L" ], "key": { - "L": "bworld:log" + "L": "bworld:oak_log" }, "result": { - "id": "bworld:planks", + "id": "bworld:oak_planks", "count": 2 } } diff --git a/mods/bworld/recipes/crafting_oak_trapdoor.json b/mods/bworld/recipes/crafting_oak_trapdoor.json index c77dbe2..7506c81 100644 --- a/mods/bworld/recipes/crafting_oak_trapdoor.json +++ b/mods/bworld/recipes/crafting_oak_trapdoor.json @@ -7,7 +7,7 @@ "PPP" ], "key": { - "P": "bworld:planks" + "P": "bworld:oak_planks" }, "result": { "id": "bworld:oak_trapdoor", diff --git a/mods/bworld/tags/blocks/bworld/leaves.json b/mods/bworld/tags/blocks/bworld/leaves.json index 1c2082c..d0629e5 100644 --- a/mods/bworld/tags/blocks/bworld/leaves.json +++ b/mods/bworld/tags/blocks/bworld/leaves.json @@ -2,7 +2,7 @@ "format_version": 1, "tag": { "values": [ - "bworld:leaves", + "bworld:oak_leaves", "bworld:spruce_leaves", "bworld:birch_leaves", "bworld:jungle_leaves", diff --git a/mods/bworld/tags/blocks/bworld/logs.json b/mods/bworld/tags/blocks/bworld/logs.json index aada47f..a52f417 100644 --- a/mods/bworld/tags/blocks/bworld/logs.json +++ b/mods/bworld/tags/blocks/bworld/logs.json @@ -2,7 +2,7 @@ "format_version": 1, "tag": { "values": [ - "bworld:log", + "bworld:oak_log", "bworld:spruce_log", "bworld:birch_log", "bworld:jungle_log", diff --git a/mods/bworld/tags/blocks/bworld/planks.json b/mods/bworld/tags/blocks/bworld/planks.json index 2ecd438..a77659f 100644 --- a/mods/bworld/tags/blocks/bworld/planks.json +++ b/mods/bworld/tags/blocks/bworld/planks.json @@ -2,7 +2,7 @@ "format_version": 1, "tag": { "values": [ - "bworld:planks", + "bworld:oak_planks", "bworld:spruce_planks", "bworld:birch_planks", "bworld:jungle_planks", diff --git a/mods/bworld/tags/items/bworld/logs.json b/mods/bworld/tags/items/bworld/logs.json index aada47f..a52f417 100644 --- a/mods/bworld/tags/items/bworld/logs.json +++ b/mods/bworld/tags/items/bworld/logs.json @@ -2,7 +2,7 @@ "format_version": 1, "tag": { "values": [ - "bworld:log", + "bworld:oak_log", "bworld:spruce_log", "bworld:birch_log", "bworld:jungle_log", diff --git a/mods/bworld/tags/items/bworld/planks.json b/mods/bworld/tags/items/bworld/planks.json index 2ecd438..a77659f 100644 --- a/mods/bworld/tags/items/bworld/planks.json +++ b/mods/bworld/tags/items/bworld/planks.json @@ -2,7 +2,7 @@ "format_version": 1, "tag": { "values": [ - "bworld:planks", + "bworld:oak_planks", "bworld:spruce_planks", "bworld:birch_planks", "bworld:jungle_planks", diff --git a/tests/cooking_test.ts b/tests/cooking_test.ts index b527ee6..11e399e 100644 --- a/tests/cooking_test.ts +++ b/tests/cooking_test.ts @@ -31,7 +31,7 @@ async function setup() { }; // something to smelt and coal, so the furnace burns const light_furnace = () => { - container(FURNACE).set_item(0, new ItemStack("bworld:log", 64)); + container(FURNACE).set_item(0, new ItemStack("bworld:oak_log", 64)); container(FURNACE).set_item(1, new ItemStack("bworld:coal", 64)); }; const ticks = (n: number) => { diff --git a/tests/fence_test.ts b/tests/fence_test.ts index 1fb36f6..92e21c6 100644 --- a/tests/fence_test.ts +++ b/tests/fence_test.ts @@ -44,7 +44,7 @@ Deno.test("fences join full sides of solid blocks, but not leaves, plants or a s const { game, sides } = await setup(); game.set_block(0, Y, 0, "bworld:oak_fence"); game.set_block(0, Y, -1, "bworld:stone"); - game.set_block(1, Y, 0, "bworld:leaves"); + game.set_block(1, Y, 0, "bworld:oak_leaves"); game.set_block(-1, Y, 0, "bworld:wheat"); assertEquals(sides(0, 0), ["north"]); assert(!covers_face([[0, 0, 0, 1, 0.5, 1]], "north")); diff --git a/tests/mod_loading_test.ts b/tests/mod_loading_test.ts index d899306..55b9f31 100644 --- a/tests/mod_loading_test.ts +++ b/tests/mod_loading_test.ts @@ -28,7 +28,7 @@ Deno.test("the base game loads from mods/bworld", async () => { assert(EverythingRegistry.get("blocks", "bworld:stone")); assert(EverythingRegistry.get("items", "bworld:stone")); assert(EverythingRegistry.get("items", "bworld:coal")); - assert(game.recipes.shaped.some((recipe) => recipe.result.id === "bworld:planks")); + assert(game.recipes.shaped.some((recipe) => recipe.result.id === "bworld:oak_planks")); assert(game.recipes.furnace.has("bworld:iron_ore")); assert(game.recipes.fuel.has("bworld:coal")); assertEquals(EverythingRegistry.get("blocks", "bworld:water")?.replaceable, true); diff --git a/tests/shared_rules_test.ts b/tests/shared_rules_test.ts index d5ace40..748cddf 100644 --- a/tests/shared_rules_test.ts +++ b/tests/shared_rules_test.ts @@ -113,7 +113,7 @@ Deno.test("a client places a fence joined to the fences and walls beside it, the const { t, use } = await setup("bworld:oak_fence"); t.game.set_block(-1, 100, 0, "bworld:oak_fence"); t.game.set_block(0, 100, -1, "bworld:stone"); - t.game.set_block(1, 100, 0, "bworld:leaves"); + t.game.set_block(1, 100, 0, "bworld:oak_leaves"); const client = client_of(t); client.place("bworld:oak_fence", 0, 100, 0, 0, "top", [0.5, 1, 0.5]); diff --git a/tests/shift_click_test.ts b/tests/shift_click_test.ts index 49c14e1..ad466cd 100644 --- a/tests/shift_click_test.ts +++ b/tests/shift_click_test.ts @@ -93,22 +93,22 @@ Deno.test("shift clicking into a furnace goes by its slot filters, and takes the }); Deno.test("shift clicking the crafting result crafts as many as fit", async () => { - const t = await setup([["bworld:log", 3]]); + const t = await setup([["bworld:oak_log", 3]]); // the logs into the grid, then the result shift clicked: 3 crafts of 2 planks t.send(1, { type: "click", menu: 0, slot: 0, button: 0 }); t.send(1, { type: "click", menu: 0, slot: PLAYER_MENU_CRAFTING, button: 0 }); t.send(1, { type: "click", menu: 0, slot: PLAYER_MENU_CRAFTING + CRAFTING_RESULT_SLOT, button: 0, shift: true }); const messages = t.take(1); assertEquals(last_container(messages, "crafting").every((item: Msg) => item === null), true); - assertEquals(last_container(messages, "inventory")[8], { id: "bworld:planks", count: 6 }); + assertEquals(last_container(messages, "inventory")[8], { id: "bworld:oak_planks", count: 6 }); }); Deno.test("shift clicking the crafting grid puts its items back in the inventory", async () => { - const t = await setup([["bworld:log", 3]]); + const t = await setup([["bworld:oak_log", 3]]); t.send(1, { type: "click", menu: 0, slot: 0, button: 0 }); t.send(1, { type: "click", menu: 0, slot: PLAYER_MENU_CRAFTING + 4, button: 0 }); t.send(1, { type: "click", menu: 0, slot: PLAYER_MENU_CRAFTING + 4, button: 0, shift: true }); const messages = t.take(1); assertEquals(last_container(messages, "crafting").every((item: Msg) => item === null), true); - assertEquals(last_container(messages, "inventory")[9], { id: "bworld:log", count: 3 }); + assertEquals(last_container(messages, "inventory")[9], { id: "bworld:oak_log", count: 3 }); }); diff --git a/tests/tags_test.ts b/tests/tags_test.ts index 536072c..aa929a1 100644 --- a/tests/tags_test.ts +++ b/tests/tags_test.ts @@ -105,7 +105,7 @@ Deno.test("the base game's tags, from scripts", async () => { tags.get("items", "bworld:planks").pop(); assertEquals(tags.get("items", "bworld:planks").length, 7); // deno-lint-ignore no-explicit-any - assertThrows(() => tags.has("recipes" as any, "bworld:planks", "bworld:planks"), Error, 'not "recipes"'); + assertThrows(() => tags.has("recipes" as any, "bworld:planks", "bworld:oak_planks"), Error, 'not "recipes"'); }); // mods/bworld and a mod that adds maple wood to the base game's tags diff --git a/tests/tint_test.ts b/tests/tint_test.ts index 429cb42..fe6ce4b 100644 --- a/tests/tint_test.ts +++ b/tests/tint_test.ts @@ -90,7 +90,7 @@ Deno.test("biome colors blend over the 5x5 columns around, across chunk edges", Deno.test("oak leaves are the biome's foliage color on every side, birch a fixed green, spruce isn't tinted", async () => { const colors = { grass: 0xff0000, foliage: 0x00ff80 }; - const oak = await mesh_block("bworld:leaves", 8, colors, null); + const oak = await mesh_block("bworld:oak_leaves", 8, colors, null); assertEquals(oak.top, [[0, 255, 128]]); assert(oak.sides.some((rgb) => JSON.stringify(rgb) === JSON.stringify(shaded(0x00ff80, 0.8)))); diff --git a/tests/wood_test.ts b/tests/wood_test.ts index e712683..4accb63 100644 --- a/tests/wood_test.ts +++ b/tests/wood_test.ts @@ -16,7 +16,7 @@ Deno.test("recipes that take planks take any kind, even mixed, but nothing else" update_crafting_result(grid, game.recipes.shaped); return grid.get_item(CRAFTING_RESULT_SLOT); }; - assertEquals(craft("bworld:planks", "bworld:planks")?.type_id, "bworld:stick"); + assertEquals(craft("bworld:oak_planks", "bworld:oak_planks")?.type_id, "bworld:stick"); assertEquals(craft("bworld:birch_planks", "bworld:cherry_planks")?.type_id, "bworld:stick"); assertEquals(craft("bworld:birch_planks", "bworld:stone"), undefined); @@ -27,7 +27,7 @@ Deno.test("recipes that take planks take any kind, even mixed, but nothing else" assertEquals(grid.get_item(CRAFTING_RESULT_SLOT)?.type_id, "bworld:dark_oak_planks"); // every log burns and smelts - for (const log of ["bworld:log", "bworld:spruce_log", "bworld:cherry_log"]) { + for (const log of ["bworld:oak_log", "bworld:spruce_log", "bworld:cherry_log"]) { assert(game.recipes.fuel.has(log), log); assert(game.recipes.furnace.has(log), log); } @@ -37,7 +37,7 @@ Deno.test("trees grow the wood of their kind and biome", async () => { const { game } = await test_game("mods"); const ids = game.world.block_ids; const woods: Record = { - "bworld:log": "oak", + "bworld:oak_log": "oak", "bworld:spruce_log": "spruce", "bworld:birch_log": "birch", "bworld:jungle_log": "jungle", diff --git a/tests/world_save_test.ts b/tests/world_save_test.ts index 1fccd77..aed3574 100644 --- a/tests/world_save_test.ts +++ b/tests/world_save_test.ts @@ -56,7 +56,7 @@ Deno.test("region files keep chunks, including negative ones, and saving one aga Deno.test("changed blocks are saved as whole chunks, and only chunks that changed are saved again", async () => { const { game } = await test_game("mods"); game.set_block(3, 120, 5, "bworld:stone"); - game.set_block(-20, 120, 40, "bworld:planks"); + game.set_block(-20, 120, 40, "bworld:oak_planks"); game.world.set_block(-20, 121, 40, "bworld:furnace", 1); const saved = game.save(); assertEquals(saved.chunks.map((c) => [c.x, c.z]).sort(), [[-2, 2], [0, 0]]); @@ -75,7 +75,7 @@ Deno.test("changed blocks are saved as whole chunks, and only chunks that change const loaded = await test_game("mods", saved); assertEquals(loaded.game.world.get_block_id(3, 120, 5), "bworld:stone"); - assertEquals(loaded.game.world.get_block_id(-20, 120, 40), "bworld:planks"); + assertEquals(loaded.game.world.get_block_id(-20, 120, 40), "bworld:oak_planks"); assertEquals(loaded.game.world.get_block_value(-20, 121, 40) >>> 16, 1); // players get the whole chunks, with what was saved in them const join = loaded.join(1, "alice"); diff --git a/tools/worldgen_preview.ts b/tools/worldgen_preview.ts index 079ee97..6c2ea9d 100644 --- a/tools/worldgen_preview.ts +++ b/tools/worldgen_preview.ts @@ -24,8 +24,8 @@ const NAMES = [ "bworld:tin_ore", "bworld:iron_ore", "bworld:gold_ore", - "bworld:log", - "bworld:leaves", + "bworld:oak_log", + "bworld:oak_leaves", ]; const block_ids: Record = Object.fromEntries(NAMES.map((name, i) => [name, i + 1])); const COLORS: Record = {