Item rendering
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
import { assert, assertEquals } from "@std/assert";
|
||||
import { BUILTIN_MODELS, type ModelJson, resolve_models, resolve_texture } from "$/common/block_models.ts";
|
||||
import { EverythingRegistry } from "$/common/everything_registry.ts";
|
||||
import { validate_model } from "$/common/mod_data.ts";
|
||||
import { load_and_check } from "$/tools/check_mods.ts";
|
||||
import { create_mod } from "$/tools/new_mod.ts";
|
||||
import { copy_dir, test_game } from "./helpers.ts";
|
||||
@@ -24,6 +25,20 @@ Deno.test("a model gets its parent's elements and textures, with its own texture
|
||||
assertEquals(tall.elements.length, 2);
|
||||
});
|
||||
|
||||
Deno.test("a model gets its parent's display transform for each place it doesn't set its own", () => {
|
||||
const { models } = resolve_models([
|
||||
{ id: "a:base", display: { gui: { rotation: [30, 45, 0] }, ground: { scale: [0.25, 0.25, 0.25] } } },
|
||||
{ id: "a:wrench", parent: "a:base", display: { gui: { scale: [2, 2, 2] } }, elements: [BOX] },
|
||||
], () => undefined);
|
||||
// the whole transform, not its fields one by one
|
||||
assertEquals(models[1].display, { gui: { scale: [2, 2, 2] }, ground: { scale: [0.25, 0.25, 0.25] } });
|
||||
assertEquals(validate_model({ id: "a:base", display: models[1].display }), []);
|
||||
assertEquals(validate_model({ id: "a:base", display: { head: {}, gui: { scale: 2 } } }), [
|
||||
'display: "head" isn\'t one of gui, firstperson_righthand, ground, fixed',
|
||||
"display.gui.scale must be [x, y, z]",
|
||||
]);
|
||||
});
|
||||
|
||||
Deno.test("a parent can be another mod's model or a built-in one", () => {
|
||||
const earlier: Record<string, ModelJson> = { "base:slab": { id: "base:slab", elements: [BOX] } };
|
||||
const { models, problems } = resolve_models([
|
||||
|
||||
Reference in New Issue
Block a user