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/bundle.js CHANGED
@@ -43312,6 +43312,12 @@ void main() {
43312
43312
  if (!node.base || !node.model || typeof node.model !== "object") break;
43313
43313
  const special = node.model;
43314
43314
  switch (special.type) {
43315
+ case "shulker_box":
43316
+ case "minecraft:shulker_box":
43317
+ 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))) {
43318
+ return { model: node.base, special };
43319
+ }
43320
+ break;
43315
43321
  case "chest":
43316
43322
  case "minecraft:chest":
43317
43323
  case "bed":
@@ -90416,6 +90422,26 @@ ${key}` : key;
90416
90422
  chest.model = { ...chest.model, render: "solid", layers: void 0 };
90417
90423
  return [chest];
90418
90424
  }
90425
+ case "minecraft:shulker_box":
90426
+ case "shulker_box": {
90427
+ const openness = special.openness === void 0 ? 0 : special.openness;
90428
+ const orientation = special.orientation === void 0 ? "up" : special.orientation;
90429
+ const directions = {
90430
+ down: [Math.PI, 0, 0],
90431
+ up: [0, 0, 0],
90432
+ north: [Math.PI / 2, 0, Math.PI],
90433
+ south: [Math.PI / 2, 0, 0],
90434
+ west: [Math.PI / 2, 0, Math.PI / 2],
90435
+ east: [Math.PI / 2, 0, -Math.PI / 2]
90436
+ };
90437
+ if (!Object.prototype.hasOwnProperty.call(directions, orientation)) throw new Error(`Unsupported shulker-box orientation ${orientation}`);
90438
+ if (typeof openness !== "number" || !Number.isFinite(openness)) throw new Error("Shulker-box openness must be finite");
90439
+ if (typeof special.texture !== "string" || !special.texture) throw new Error("Shulker-box texture is required");
90440
+ const transform = new Matrix4().makeTranslation(8, 8, 8).multiply(new Matrix4().makeScale(0.9995, 0.9995, 0.9995)).multiply(new Matrix4().makeRotationFromEuler(new Euler(...directions[orientation], "XYZ"))).multiply(new Matrix4().makeScale(1, -1, -1)).multiply(new Matrix4().makeTranslation(0, -16, 0));
90441
+ const box = await load("shulker_box", texture(special.texture, "shulker"), transform, { lid: [0, openness * Math.PI * 1.5, 0] });
90442
+ box.positions = { lid: [0, 24 - openness * 8, 0] };
90443
+ return [box];
90444
+ }
90419
90445
  case "minecraft:bed":
90420
90446
  case "bed": {
90421
90447
  const transform = new Matrix4().makeTranslation(0, 9, 0).multiply(new Matrix4().makeRotationX(Math.PI / 2)).multiply(new Matrix4().makeTranslation(8, 8, 8)).multiply(new Matrix4().makeRotationZ(Math.PI)).multiply(new Matrix4().makeTranslation(-8, -8, -8));
@@ -90716,6 +90742,9 @@ ${shader.fragmentShader}`.replace(
90716
90742
  for (const [name2, rotation] of Object.entries(part.rotations)) {
90717
90743
  object3.getGroupByName(name2)?.rotation.set(...rotation, "ZYX");
90718
90744
  }
90745
+ for (const [name2, position] of Object.entries(part.positions ?? {})) {
90746
+ object3.getGroupByName(name2)?.position.set(...position);
90747
+ }
90719
90748
  }
90720
90749
  } catch (error2) {
90721
90750
  this.disposeAndRemoveAllChildren();