minerender 2.1.0-alpha.80 → 2.1.0-alpha.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.d.mts +8 -1
- package/dist/browser/index.d.ts +8 -1
- package/dist/browser/index.js +29 -0
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +36 -7
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +29 -0
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +8 -1
- package/dist/node/index.d.ts +8 -1
- package/dist/node/index.js +29 -0
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +36 -7
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.d.mts
CHANGED
|
@@ -552,6 +552,11 @@ type SpecialItemRenderer = {
|
|
|
552
552
|
type: "chest" | "minecraft:chest";
|
|
553
553
|
texture: string;
|
|
554
554
|
openness?: number;
|
|
555
|
+
} | {
|
|
556
|
+
type: "shulker_box" | "minecraft:shulker_box";
|
|
557
|
+
texture: string;
|
|
558
|
+
openness?: number;
|
|
559
|
+
orientation?: "down" | "up" | "north" | "south" | "west" | "east";
|
|
555
560
|
} | {
|
|
556
561
|
type: "bed" | "minecraft:bed";
|
|
557
562
|
texture: string;
|
|
@@ -1285,8 +1290,10 @@ interface SpecialItemPart {
|
|
|
1285
1290
|
model: EntityModel;
|
|
1286
1291
|
transform: Matrix4;
|
|
1287
1292
|
rotations: Record<string, TripleArray>;
|
|
1293
|
+
/** Absolute named-part positions in the entity model's coordinate system. */
|
|
1294
|
+
positions?: Record<string, TripleArray>;
|
|
1288
1295
|
}
|
|
1289
|
-
/** Loads the entity geometry used by chest, bed, and supported mob-head item previews. */
|
|
1296
|
+
/** Loads the entity geometry used by chest, shulker-box, bed, and supported mob-head item previews. */
|
|
1290
1297
|
declare class SpecialItems {
|
|
1291
1298
|
/** Resolves the static entity parts drawn by a special item renderer, in model units. */
|
|
1292
1299
|
static getParts(special: SpecialItemRenderer, root?: string): Promise<SpecialItemPart[]>;
|
package/dist/node/index.d.ts
CHANGED
|
@@ -552,6 +552,11 @@ type SpecialItemRenderer = {
|
|
|
552
552
|
type: "chest" | "minecraft:chest";
|
|
553
553
|
texture: string;
|
|
554
554
|
openness?: number;
|
|
555
|
+
} | {
|
|
556
|
+
type: "shulker_box" | "minecraft:shulker_box";
|
|
557
|
+
texture: string;
|
|
558
|
+
openness?: number;
|
|
559
|
+
orientation?: "down" | "up" | "north" | "south" | "west" | "east";
|
|
555
560
|
} | {
|
|
556
561
|
type: "bed" | "minecraft:bed";
|
|
557
562
|
texture: string;
|
|
@@ -1285,8 +1290,10 @@ interface SpecialItemPart {
|
|
|
1285
1290
|
model: EntityModel;
|
|
1286
1291
|
transform: Matrix4;
|
|
1287
1292
|
rotations: Record<string, TripleArray>;
|
|
1293
|
+
/** Absolute named-part positions in the entity model's coordinate system. */
|
|
1294
|
+
positions?: Record<string, TripleArray>;
|
|
1288
1295
|
}
|
|
1289
|
-
/** Loads the entity geometry used by chest, bed, and supported mob-head item previews. */
|
|
1296
|
+
/** Loads the entity geometry used by chest, shulker-box, bed, and supported mob-head item previews. */
|
|
1290
1297
|
declare class SpecialItems {
|
|
1291
1298
|
/** Resolves the static entity parts drawn by a special item renderer, in model units. */
|
|
1292
1299
|
static getParts(special: SpecialItemRenderer, root?: string): Promise<SpecialItemPart[]>;
|
package/dist/node/index.js
CHANGED
|
@@ -1781,6 +1781,12 @@ var init_Models = __esm({
|
|
|
1781
1781
|
if (!node.base || !node.model || typeof node.model !== "object") break;
|
|
1782
1782
|
const special = node.model;
|
|
1783
1783
|
switch (special.type) {
|
|
1784
|
+
case "shulker_box":
|
|
1785
|
+
case "minecraft:shulker_box":
|
|
1786
|
+
if (typeof special.texture === "string" && special.texture && (special.openness === void 0 || typeof special.openness === "number" && Number.isFinite(special.openness)) && (special.orientation === void 0 || ["down", "up", "north", "south", "west", "east"].includes(special.orientation))) {
|
|
1787
|
+
return { model: node.base, special };
|
|
1788
|
+
}
|
|
1789
|
+
break;
|
|
1784
1790
|
case "chest":
|
|
1785
1791
|
case "minecraft:chest":
|
|
1786
1792
|
case "bed":
|
|
@@ -5550,6 +5556,26 @@ var init_SpecialItems = __esm({
|
|
|
5550
5556
|
chest.model = { ...chest.model, render: "solid", layers: void 0 };
|
|
5551
5557
|
return [chest];
|
|
5552
5558
|
}
|
|
5559
|
+
case "minecraft:shulker_box":
|
|
5560
|
+
case "shulker_box": {
|
|
5561
|
+
const openness = special.openness === void 0 ? 0 : special.openness;
|
|
5562
|
+
const orientation = special.orientation === void 0 ? "up" : special.orientation;
|
|
5563
|
+
const directions = {
|
|
5564
|
+
down: [Math.PI, 0, 0],
|
|
5565
|
+
up: [0, 0, 0],
|
|
5566
|
+
north: [Math.PI / 2, 0, Math.PI],
|
|
5567
|
+
south: [Math.PI / 2, 0, 0],
|
|
5568
|
+
west: [Math.PI / 2, 0, Math.PI / 2],
|
|
5569
|
+
east: [Math.PI / 2, 0, -Math.PI / 2]
|
|
5570
|
+
};
|
|
5571
|
+
if (!Object.prototype.hasOwnProperty.call(directions, orientation)) throw new Error(`Unsupported shulker-box orientation ${orientation}`);
|
|
5572
|
+
if (typeof openness !== "number" || !Number.isFinite(openness)) throw new Error("Shulker-box openness must be finite");
|
|
5573
|
+
if (typeof special.texture !== "string" || !special.texture) throw new Error("Shulker-box texture is required");
|
|
5574
|
+
const transform = new import_three24.Matrix4().makeTranslation(8, 8, 8).multiply(new import_three24.Matrix4().makeScale(0.9995, 0.9995, 0.9995)).multiply(new import_three24.Matrix4().makeRotationFromEuler(new import_three24.Euler(...directions[orientation], "XYZ"))).multiply(new import_three24.Matrix4().makeScale(1, -1, -1)).multiply(new import_three24.Matrix4().makeTranslation(0, -16, 0));
|
|
5575
|
+
const box = await load("shulker_box", texture(special.texture, "shulker"), transform, { lid: [0, openness * Math.PI * 1.5, 0] });
|
|
5576
|
+
box.positions = { lid: [0, 24 - openness * 8, 0] };
|
|
5577
|
+
return [box];
|
|
5578
|
+
}
|
|
5553
5579
|
case "minecraft:bed":
|
|
5554
5580
|
case "bed": {
|
|
5555
5581
|
const transform = new import_three24.Matrix4().makeTranslation(0, 9, 0).multiply(new import_three24.Matrix4().makeRotationX(Math.PI / 2)).multiply(new import_three24.Matrix4().makeTranslation(8, 8, 8)).multiply(new import_three24.Matrix4().makeRotationZ(Math.PI)).multiply(new import_three24.Matrix4().makeTranslation(-8, -8, -8));
|
|
@@ -5841,6 +5867,9 @@ var init_ModelObject = __esm({
|
|
|
5841
5867
|
for (const [name, rotation] of Object.entries(part.rotations)) {
|
|
5842
5868
|
object3.getGroupByName(name)?.rotation.set(...rotation, "ZYX");
|
|
5843
5869
|
}
|
|
5870
|
+
for (const [name, position] of Object.entries(part.positions ?? {})) {
|
|
5871
|
+
object3.getGroupByName(name)?.position.set(...position);
|
|
5872
|
+
}
|
|
5844
5873
|
}
|
|
5845
5874
|
} catch (error) {
|
|
5846
5875
|
this.disposeAndRemoveAllChildren();
|