Add the oak_ on the oak blocks
This commit is contained in:
@@ -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<Wood, number>;
|
||||
Object.fromEntries(WOODS.map((wood) => [wood, id(`bworld:${wood}_${part}`)])) as Record<Wood, number>;
|
||||
generate_overworld(blocks, heights, biomes, chunk_x, chunk_z, seed, {
|
||||
stone: id("bworld:stone"),
|
||||
dirt: id("bworld:dirt"),
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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 |
|
||||
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
|
||||
@@ -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 }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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", ...]
|
||||
```
|
||||
|
||||
@@ -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"
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
"PSP"
|
||||
],
|
||||
"key": {
|
||||
"P": "bworld:planks",
|
||||
"P": "bworld:oak_planks",
|
||||
"S": "bworld:stick"
|
||||
},
|
||||
"result": {
|
||||
|
||||
+2
-2
@@ -6,10 +6,10 @@
|
||||
"L"
|
||||
],
|
||||
"key": {
|
||||
"L": "bworld:log"
|
||||
"L": "bworld:oak_log"
|
||||
},
|
||||
"result": {
|
||||
"id": "bworld:planks",
|
||||
"id": "bworld:oak_planks",
|
||||
"count": 2
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
"PPP"
|
||||
],
|
||||
"key": {
|
||||
"P": "bworld:planks"
|
||||
"P": "bworld:oak_planks"
|
||||
},
|
||||
"result": {
|
||||
"id": "bworld:oak_trapdoor",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"format_version": 1,
|
||||
"tag": {
|
||||
"values": [
|
||||
"bworld:leaves",
|
||||
"bworld:oak_leaves",
|
||||
"bworld:spruce_leaves",
|
||||
"bworld:birch_leaves",
|
||||
"bworld:jungle_leaves",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"format_version": 1,
|
||||
"tag": {
|
||||
"values": [
|
||||
"bworld:log",
|
||||
"bworld:oak_log",
|
||||
"bworld:spruce_log",
|
||||
"bworld:birch_log",
|
||||
"bworld:jungle_log",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"format_version": 1,
|
||||
"tag": {
|
||||
"values": [
|
||||
"bworld:planks",
|
||||
"bworld:oak_planks",
|
||||
"bworld:spruce_planks",
|
||||
"bworld:birch_planks",
|
||||
"bworld:jungle_planks",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"format_version": 1,
|
||||
"tag": {
|
||||
"values": [
|
||||
"bworld:log",
|
||||
"bworld:oak_log",
|
||||
"bworld:spruce_log",
|
||||
"bworld:birch_log",
|
||||
"bworld:jungle_log",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"format_version": 1,
|
||||
"tag": {
|
||||
"values": [
|
||||
"bworld:planks",
|
||||
"bworld:oak_planks",
|
||||
"bworld:spruce_planks",
|
||||
"bworld:birch_planks",
|
||||
"bworld:jungle_planks",
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
+1
-1
@@ -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"));
|
||||
|
||||
@@ -28,7 +28,7 @@ Deno.test("the base game loads from mods/bworld", async () => {
|
||||
assert(EverythingRegistry.get<BlockRegistry>("blocks", "bworld:stone"));
|
||||
assert(EverythingRegistry.get<ItemRegistry>("items", "bworld:stone"));
|
||||
assert(EverythingRegistry.get<ItemRegistry>("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<BlockRegistry>("blocks", "bworld:water")?.replaceable, true);
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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 });
|
||||
});
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
+1
-1
@@ -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))));
|
||||
|
||||
|
||||
+3
-3
@@ -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<string, string> = {
|
||||
"bworld:log": "oak",
|
||||
"bworld:oak_log": "oak",
|
||||
"bworld:spruce_log": "spruce",
|
||||
"bworld:birch_log": "birch",
|
||||
"bworld:jungle_log": "jungle",
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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<string, number> = Object.fromEntries(NAMES.map((name, i) => [name, i + 1]));
|
||||
const COLORS: Record<number, [number, number, number]> = {
|
||||
|
||||
Reference in New Issue
Block a user