Rename engine to cubi
This commit is contained in:
@@ -14,7 +14,7 @@ import {
|
||||
import { block_from_json, validate_block } from "$/common/mod_data.ts";
|
||||
import { set_state_value } from "$/common/utils.ts";
|
||||
|
||||
const cube = BUILTIN_MODELS["engine:cube"];
|
||||
const cube = BUILTIN_MODELS["cubi:cube"];
|
||||
|
||||
Deno.test("cubes resolve the old texture shapes", () => {
|
||||
assertEquals(resolve_texture("#top", "a:all", cube), "a:all");
|
||||
@@ -31,7 +31,7 @@ Deno.test("cubes resolve the old texture shapes", () => {
|
||||
"a:side",
|
||||
"a:front",
|
||||
]);
|
||||
assertEquals(resolve_texture("#nothing", { crop: "a:crop" }), "engine:missing");
|
||||
assertEquals(resolve_texture("#nothing", { crop: "a:crop" }), "cubi:missing");
|
||||
});
|
||||
|
||||
Deno.test("a cube bakes into six full faces that cull against their neighbors", () => {
|
||||
@@ -44,12 +44,12 @@ Deno.test("a cube bakes into six full faces that cull against their neighbors",
|
||||
});
|
||||
|
||||
Deno.test("crop and cross models are planes inside the block, seen from both sides", () => {
|
||||
const crop = bake_model(BUILTIN_MODELS["engine:crop"], { crop: "a:wheat" });
|
||||
const crop = bake_model(BUILTIN_MODELS["cubi:crop"], { crop: "a:wheat" });
|
||||
assertEquals(crop.length, 8);
|
||||
assert(crop.every((q) => !q.flush && q.cull === -1 && !q.shade && q.texture === "a:wheat"));
|
||||
assertEquals(crop[0].positions.filter((_, i) => i % 3 === 0), [0.25, 0.25, 0.25, 0.25]);
|
||||
|
||||
const cross = bake_model(BUILTIN_MODELS["engine:cross"], { cross: "a:flower" });
|
||||
const cross = bake_model(BUILTIN_MODELS["cubi:cross"], { cross: "a:flower" });
|
||||
assertEquals(cross.length, 4);
|
||||
// rescaled so the diagonal planes stay as wide as the block, like minecraft's (0.8 to 15.2 pixels)
|
||||
for (const quad of cross) {
|
||||
@@ -99,7 +99,7 @@ Deno.test("an x turn tips a model's top to the north, before its y turn", () =>
|
||||
Deno.test("variants pick textures by state", () => {
|
||||
const { block } = block_from_json(JSON.parse(Deno.readTextFileSync("mods/bworld/blocks/wheat.json")).block);
|
||||
assertEquals(block_variant(block, { age: 5 }).textures, { crop: "bworld:wheat_stage_5" });
|
||||
assertEquals(block_variant(block, { age: 5 }).model, "engine:crop");
|
||||
assertEquals(block_variant(block, { age: 5 }).model, "cubi:crop");
|
||||
assertEquals(block_variant(block).textures, { crop: "bworld:wheat_stage_0" });
|
||||
// states live above the numeric id
|
||||
assertEquals(set_state_value(7, block, "age", 3), (3 << 16) | 7);
|
||||
|
||||
Reference in New Issue
Block a user