Worm bin model

This commit is contained in:
2026-10-12 18:58:38 -03:00
parent 99bdcaeffc
commit 038b6d2caa
16 changed files with 447 additions and 39 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ export interface ModelElementJson {
rotation?: {
origin: [number, number, number];
axis: "x" | "y" | "z";
// -45, -22.5, 0, 22.5 or 45
// degrees, any from -180 to 180. minecraft only takes -45, -22.5, 0, 22.5 or 45, blockbench's newer models any
angle: number;
// stretch the rotated faces back to the block's size, like the cross model does
rescale?: boolean;
+2 -2
View File
@@ -808,10 +808,10 @@ export function validate_model(json: unknown): Problems {
if (rotation !== undefined) {
if (
!is_object(rotation) || !["x", "y", "z"].includes(rotation.axis as string) ||
![-45, -22.5, 0, 22.5, 45].includes(rotation.angle as number) || !Array.isArray(rotation.origin)
typeof rotation.angle !== "number" || Math.abs(rotation.angle) > 180 || !Array.isArray(rotation.origin)
) {
problems.push(
`${where}.rotation must be { origin, axis: x, y or z, angle: -45, -22.5, 0, 22.5 or 45 }`,
`${where}.rotation must be { origin, axis: x, y or z, angle: degrees from -180 to 180 }`,
);
}
}