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.mjs
CHANGED
|
@@ -1780,6 +1780,12 @@ var init_Models = __esm({
|
|
|
1780
1780
|
if (!node.base || !node.model || typeof node.model !== "object") break;
|
|
1781
1781
|
const special = node.model;
|
|
1782
1782
|
switch (special.type) {
|
|
1783
|
+
case "shulker_box":
|
|
1784
|
+
case "minecraft:shulker_box":
|
|
1785
|
+
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))) {
|
|
1786
|
+
return { model: node.base, special };
|
|
1787
|
+
}
|
|
1788
|
+
break;
|
|
1783
1789
|
case "chest":
|
|
1784
1790
|
case "minecraft:chest":
|
|
1785
1791
|
case "bed":
|
|
@@ -5519,7 +5525,7 @@ var init_ModelCulling = __esm({
|
|
|
5519
5525
|
});
|
|
5520
5526
|
|
|
5521
5527
|
// src/model/SpecialItems.ts
|
|
5522
|
-
import { Matrix4 as Matrix48 } from "three";
|
|
5528
|
+
import { Euler as Euler7, Matrix4 as Matrix48 } from "three";
|
|
5523
5529
|
var SpecialItems;
|
|
5524
5530
|
var init_SpecialItems = __esm({
|
|
5525
5531
|
"src/model/SpecialItems.ts"() {
|
|
@@ -5557,6 +5563,26 @@ var init_SpecialItems = __esm({
|
|
|
5557
5563
|
chest.model = { ...chest.model, render: "solid", layers: void 0 };
|
|
5558
5564
|
return [chest];
|
|
5559
5565
|
}
|
|
5566
|
+
case "minecraft:shulker_box":
|
|
5567
|
+
case "shulker_box": {
|
|
5568
|
+
const openness = special.openness === void 0 ? 0 : special.openness;
|
|
5569
|
+
const orientation = special.orientation === void 0 ? "up" : special.orientation;
|
|
5570
|
+
const directions = {
|
|
5571
|
+
down: [Math.PI, 0, 0],
|
|
5572
|
+
up: [0, 0, 0],
|
|
5573
|
+
north: [Math.PI / 2, 0, Math.PI],
|
|
5574
|
+
south: [Math.PI / 2, 0, 0],
|
|
5575
|
+
west: [Math.PI / 2, 0, Math.PI / 2],
|
|
5576
|
+
east: [Math.PI / 2, 0, -Math.PI / 2]
|
|
5577
|
+
};
|
|
5578
|
+
if (!Object.prototype.hasOwnProperty.call(directions, orientation)) throw new Error(`Unsupported shulker-box orientation ${orientation}`);
|
|
5579
|
+
if (typeof openness !== "number" || !Number.isFinite(openness)) throw new Error("Shulker-box openness must be finite");
|
|
5580
|
+
if (typeof special.texture !== "string" || !special.texture) throw new Error("Shulker-box texture is required");
|
|
5581
|
+
const transform = new Matrix48().makeTranslation(8, 8, 8).multiply(new Matrix48().makeScale(0.9995, 0.9995, 0.9995)).multiply(new Matrix48().makeRotationFromEuler(new Euler7(...directions[orientation], "XYZ"))).multiply(new Matrix48().makeScale(1, -1, -1)).multiply(new Matrix48().makeTranslation(0, -16, 0));
|
|
5582
|
+
const box = await load("shulker_box", texture(special.texture, "shulker"), transform, { lid: [0, openness * Math.PI * 1.5, 0] });
|
|
5583
|
+
box.positions = { lid: [0, 24 - openness * 8, 0] };
|
|
5584
|
+
return [box];
|
|
5585
|
+
}
|
|
5560
5586
|
case "minecraft:bed":
|
|
5561
5587
|
case "bed": {
|
|
5562
5588
|
const transform = new Matrix48().makeTranslation(0, 9, 0).multiply(new Matrix48().makeRotationX(Math.PI / 2)).multiply(new Matrix48().makeTranslation(8, 8, 8)).multiply(new Matrix48().makeRotationZ(Math.PI)).multiply(new Matrix48().makeTranslation(-8, -8, -8));
|
|
@@ -5758,7 +5784,7 @@ var init_ItemTints = __esm({
|
|
|
5758
5784
|
});
|
|
5759
5785
|
|
|
5760
5786
|
// src/model/scene/ModelObject.ts
|
|
5761
|
-
import { BoxGeometry as BoxGeometry5, BufferAttribute as BufferAttribute5, Color as Color9, Euler as
|
|
5787
|
+
import { BoxGeometry as BoxGeometry5, BufferAttribute as BufferAttribute5, Color as Color9, Euler as Euler8, Matrix4 as Matrix49 } from "three";
|
|
5762
5788
|
function isModelObject(obj) {
|
|
5763
5789
|
return obj.isModelObject;
|
|
5764
5790
|
}
|
|
@@ -5848,6 +5874,9 @@ var init_ModelObject = __esm({
|
|
|
5848
5874
|
for (const [name, rotation] of Object.entries(part.rotations)) {
|
|
5849
5875
|
object3.getGroupByName(name)?.rotation.set(...rotation, "ZYX");
|
|
5850
5876
|
}
|
|
5877
|
+
for (const [name, position] of Object.entries(part.positions ?? {})) {
|
|
5878
|
+
object3.getGroupByName(name)?.position.set(...position);
|
|
5879
|
+
}
|
|
5851
5880
|
}
|
|
5852
5881
|
} catch (error) {
|
|
5853
5882
|
this.disposeAndRemoveAllChildren();
|
|
@@ -5890,7 +5919,7 @@ var init_ModelObject = __esm({
|
|
|
5890
5919
|
elGeo.clearGroups();
|
|
5891
5920
|
}
|
|
5892
5921
|
if (this.options.uvLockRotation) {
|
|
5893
|
-
UVMapper.lockUvs(elGeo, el.faces, this.atlas, new
|
|
5922
|
+
UVMapper.lockUvs(elGeo, el.faces, this.atlas, new Euler8(...this.options.uvLockRotation));
|
|
5894
5923
|
}
|
|
5895
5924
|
UVMapper.setAtlasUvBounds(elGeo, el.faces, this.atlas);
|
|
5896
5925
|
if (this.options.tints) {
|
|
@@ -10562,7 +10591,7 @@ init_SpecialItems();
|
|
|
10562
10591
|
init_BlockStates();
|
|
10563
10592
|
init_MineRenderError();
|
|
10564
10593
|
init_util();
|
|
10565
|
-
import { Euler as
|
|
10594
|
+
import { Euler as Euler9 } from "three";
|
|
10566
10595
|
function matchesCondition(condition, state) {
|
|
10567
10596
|
return Object.entries(condition).every(([key, value]) => {
|
|
10568
10597
|
if (Array.isArray(value)) {
|
|
@@ -10642,7 +10671,7 @@ var BlockStateResolver = class {
|
|
|
10642
10671
|
}
|
|
10643
10672
|
/** Converts blockstate rotations in degrees into the Euler rotation used by model rendering. */
|
|
10644
10673
|
static rotation(variant) {
|
|
10645
|
-
const rotation = new
|
|
10674
|
+
const rotation = new Euler9();
|
|
10646
10675
|
if (typeof variant.x !== "undefined") {
|
|
10647
10676
|
rotation.x = toRadians(clampRotationDegrees(variant.x));
|
|
10648
10677
|
}
|
|
@@ -10737,7 +10766,7 @@ var import_ts_deepmerge6 = __toESM(require_dist());
|
|
|
10737
10766
|
init_MineRenderError();
|
|
10738
10767
|
init_InstanceReference();
|
|
10739
10768
|
init_AssetKey();
|
|
10740
|
-
import { Euler as
|
|
10769
|
+
import { Euler as Euler10, Matrix4 as Matrix411, Quaternion as Quaternion5, Vector3 as Vector312 } from "three";
|
|
10741
10770
|
init_ModelCulling();
|
|
10742
10771
|
init_FluidGeometry();
|
|
10743
10772
|
init_Entities();
|
|
@@ -10884,7 +10913,7 @@ var BlockObject = class _BlockObject extends SceneObject {
|
|
|
10884
10913
|
const scale = new Vector312();
|
|
10885
10914
|
this.getModelMatrix(model).decompose(position, rotation, scale);
|
|
10886
10915
|
if (position.distanceToSquared(this.position) > 1e-10 || scale.distanceToSquared(new Vector312(1, 1, 1)) > 1e-10) return 0;
|
|
10887
|
-
return ModelCulling.toLocalMask(worldMask, new
|
|
10916
|
+
return ModelCulling.toLocalMask(worldMask, new Euler10().setFromQuaternion(rotation));
|
|
10888
10917
|
}
|
|
10889
10918
|
async setCullMask(worldMask) {
|
|
10890
10919
|
worldMask &= 63;
|