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.
@@ -551,6 +551,11 @@ type SpecialItemRenderer = {
551
551
  type: "chest" | "minecraft:chest";
552
552
  texture: string;
553
553
  openness?: number;
554
+ } | {
555
+ type: "shulker_box" | "minecraft:shulker_box";
556
+ texture: string;
557
+ openness?: number;
558
+ orientation?: "down" | "up" | "north" | "south" | "west" | "east";
554
559
  } | {
555
560
  type: "bed" | "minecraft:bed";
556
561
  texture: string;
@@ -1284,8 +1289,10 @@ interface SpecialItemPart {
1284
1289
  model: EntityModel;
1285
1290
  transform: Matrix4;
1286
1291
  rotations: Record<string, TripleArray>;
1292
+ /** Absolute named-part positions in the entity model's coordinate system. */
1293
+ positions?: Record<string, TripleArray>;
1287
1294
  }
1288
- /** Loads the entity geometry used by chest, bed, and supported mob-head item previews. */
1295
+ /** Loads the entity geometry used by chest, shulker-box, bed, and supported mob-head item previews. */
1289
1296
  declare class SpecialItems {
1290
1297
  /** Resolves the static entity parts drawn by a special item renderer, in model units. */
1291
1298
  static getParts(special: SpecialItemRenderer, root?: string): Promise<SpecialItemPart[]>;
@@ -551,6 +551,11 @@ type SpecialItemRenderer = {
551
551
  type: "chest" | "minecraft:chest";
552
552
  texture: string;
553
553
  openness?: number;
554
+ } | {
555
+ type: "shulker_box" | "minecraft:shulker_box";
556
+ texture: string;
557
+ openness?: number;
558
+ orientation?: "down" | "up" | "north" | "south" | "west" | "east";
554
559
  } | {
555
560
  type: "bed" | "minecraft:bed";
556
561
  texture: string;
@@ -1284,8 +1289,10 @@ interface SpecialItemPart {
1284
1289
  model: EntityModel;
1285
1290
  transform: Matrix4;
1286
1291
  rotations: Record<string, TripleArray>;
1292
+ /** Absolute named-part positions in the entity model's coordinate system. */
1293
+ positions?: Record<string, TripleArray>;
1287
1294
  }
1288
- /** Loads the entity geometry used by chest, bed, and supported mob-head item previews. */
1295
+ /** Loads the entity geometry used by chest, shulker-box, bed, and supported mob-head item previews. */
1289
1296
  declare class SpecialItems {
1290
1297
  /** Resolves the static entity parts drawn by a special item renderer, in model units. */
1291
1298
  static getParts(special: SpecialItemRenderer, root?: string): Promise<SpecialItemPart[]>;
@@ -1731,6 +1731,12 @@ var init_Models = __esm({
1731
1731
  if (!node.base || !node.model || typeof node.model !== "object") break;
1732
1732
  const special = node.model;
1733
1733
  switch (special.type) {
1734
+ case "shulker_box":
1735
+ case "minecraft:shulker_box":
1736
+ 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))) {
1737
+ return { model: node.base, special };
1738
+ }
1739
+ break;
1734
1740
  case "chest":
1735
1741
  case "minecraft:chest":
1736
1742
  case "bed":
@@ -5459,6 +5465,26 @@ var init_SpecialItems = __esm({
5459
5465
  chest.model = { ...chest.model, render: "solid", layers: void 0 };
5460
5466
  return [chest];
5461
5467
  }
5468
+ case "minecraft:shulker_box":
5469
+ case "shulker_box": {
5470
+ const openness = special.openness === void 0 ? 0 : special.openness;
5471
+ const orientation = special.orientation === void 0 ? "up" : special.orientation;
5472
+ const directions = {
5473
+ down: [Math.PI, 0, 0],
5474
+ up: [0, 0, 0],
5475
+ north: [Math.PI / 2, 0, Math.PI],
5476
+ south: [Math.PI / 2, 0, 0],
5477
+ west: [Math.PI / 2, 0, Math.PI / 2],
5478
+ east: [Math.PI / 2, 0, -Math.PI / 2]
5479
+ };
5480
+ if (!Object.prototype.hasOwnProperty.call(directions, orientation)) throw new Error(`Unsupported shulker-box orientation ${orientation}`);
5481
+ if (typeof openness !== "number" || !Number.isFinite(openness)) throw new Error("Shulker-box openness must be finite");
5482
+ if (typeof special.texture !== "string" || !special.texture) throw new Error("Shulker-box texture is required");
5483
+ 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));
5484
+ const box = await load("shulker_box", texture(special.texture, "shulker"), transform, { lid: [0, openness * Math.PI * 1.5, 0] });
5485
+ box.positions = { lid: [0, 24 - openness * 8, 0] };
5486
+ return [box];
5487
+ }
5462
5488
  case "minecraft:bed":
5463
5489
  case "bed": {
5464
5490
  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));
@@ -5747,6 +5773,9 @@ var init_ModelObject = __esm({
5747
5773
  for (const [name, rotation] of Object.entries(part.rotations)) {
5748
5774
  object3.getGroupByName(name)?.rotation.set(...rotation, "ZYX");
5749
5775
  }
5776
+ for (const [name, position] of Object.entries(part.positions ?? {})) {
5777
+ object3.getGroupByName(name)?.position.set(...position);
5778
+ }
5750
5779
  }
5751
5780
  } catch (error) {
5752
5781
  this.disposeAndRemoveAllChildren();