Basic crops system

This commit is contained in:
2026-09-25 22:49:27 -03:00
parent ef25e66f08
commit 099811670f
22 changed files with 985 additions and 178 deletions
+18
View File
@@ -65,6 +65,20 @@ Deno.test("check-mods finds broken mods", async () => {
format_version: 1,
block: { id: "broken:x", textures: "bworld:stone" },
});
// a model that doesn't exist, a variant for a state the block doesn't have, and a broken model
write_json(`${mod}/blocks/plant.json`, {
format_version: 1,
block: { id: "broken:plant", textures: { cross: "broken:plant" }, model: "broken:no_such_model" },
});
write_json(`${mod}/blocks/grows.json`, {
format_version: 1,
block: { id: "broken:grows", textures: "broken:plant", variants: { "size=1": { y: 90 } } },
});
Deno.mkdirSync(`${mod}/models`);
write_json(`${mod}/models/bad.json`, {
format_version: 1,
model: { id: "broken:bad", elements: [{ from: [0, 0], to: [16, 16, 16], faces: { up: { texture: "#all" } } }] },
});
// not json
Deno.writeTextFileSync(`${mod}/items/bad.json`, "{ nope");
// uses a letter the key doesn't define
@@ -93,6 +107,10 @@ Deno.test("check-mods finds broken mods", async () => {
has(report.errors, "item broken:no_such_item doesn't exist");
has(report.errors, "block broken:x is also defined by broken, broken");
has(report.errors, "items/bad.json: isn't valid json");
has(report.errors, "model broken:no_such_model doesn't exist");
has(report.errors, `"size=1" must be a state of this block`);
has(report.errors, "elements[0].from must be [x, y, z]");
has(report.errors, `elements[0].faces: "up" isn't one of`);
has(report.errors, `pattern uses "B" but key doesn't define it`);
has(report.errors, "textures/huge.png: is");
has(report.errors, "scripts don't typecheck");