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/browser/index.mjs
CHANGED
|
@@ -1730,6 +1730,12 @@ var init_Models = __esm({
|
|
|
1730
1730
|
if (!node.base || !node.model || typeof node.model !== "object") break;
|
|
1731
1731
|
const special = node.model;
|
|
1732
1732
|
switch (special.type) {
|
|
1733
|
+
case "shulker_box":
|
|
1734
|
+
case "minecraft:shulker_box":
|
|
1735
|
+
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))) {
|
|
1736
|
+
return { model: node.base, special };
|
|
1737
|
+
}
|
|
1738
|
+
break;
|
|
1733
1739
|
case "chest":
|
|
1734
1740
|
case "minecraft:chest":
|
|
1735
1741
|
case "bed":
|
|
@@ -5428,7 +5434,7 @@ var init_ModelCulling = __esm({
|
|
|
5428
5434
|
});
|
|
5429
5435
|
|
|
5430
5436
|
// src/model/SpecialItems.ts
|
|
5431
|
-
import { Matrix4 as Matrix48 } from "three";
|
|
5437
|
+
import { Euler as Euler7, Matrix4 as Matrix48 } from "three";
|
|
5432
5438
|
var SpecialItems;
|
|
5433
5439
|
var init_SpecialItems = __esm({
|
|
5434
5440
|
"src/model/SpecialItems.ts"() {
|
|
@@ -5466,6 +5472,26 @@ var init_SpecialItems = __esm({
|
|
|
5466
5472
|
chest.model = { ...chest.model, render: "solid", layers: void 0 };
|
|
5467
5473
|
return [chest];
|
|
5468
5474
|
}
|
|
5475
|
+
case "minecraft:shulker_box":
|
|
5476
|
+
case "shulker_box": {
|
|
5477
|
+
const openness = special.openness === void 0 ? 0 : special.openness;
|
|
5478
|
+
const orientation = special.orientation === void 0 ? "up" : special.orientation;
|
|
5479
|
+
const directions = {
|
|
5480
|
+
down: [Math.PI, 0, 0],
|
|
5481
|
+
up: [0, 0, 0],
|
|
5482
|
+
north: [Math.PI / 2, 0, Math.PI],
|
|
5483
|
+
south: [Math.PI / 2, 0, 0],
|
|
5484
|
+
west: [Math.PI / 2, 0, Math.PI / 2],
|
|
5485
|
+
east: [Math.PI / 2, 0, -Math.PI / 2]
|
|
5486
|
+
};
|
|
5487
|
+
if (!Object.prototype.hasOwnProperty.call(directions, orientation)) throw new Error(`Unsupported shulker-box orientation ${orientation}`);
|
|
5488
|
+
if (typeof openness !== "number" || !Number.isFinite(openness)) throw new Error("Shulker-box openness must be finite");
|
|
5489
|
+
if (typeof special.texture !== "string" || !special.texture) throw new Error("Shulker-box texture is required");
|
|
5490
|
+
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));
|
|
5491
|
+
const box = await load("shulker_box", texture(special.texture, "shulker"), transform, { lid: [0, openness * Math.PI * 1.5, 0] });
|
|
5492
|
+
box.positions = { lid: [0, 24 - openness * 8, 0] };
|
|
5493
|
+
return [box];
|
|
5494
|
+
}
|
|
5469
5495
|
case "minecraft:bed":
|
|
5470
5496
|
case "bed": {
|
|
5471
5497
|
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));
|
|
@@ -5667,7 +5693,7 @@ var init_ItemTints = __esm({
|
|
|
5667
5693
|
});
|
|
5668
5694
|
|
|
5669
5695
|
// src/model/scene/ModelObject.ts
|
|
5670
|
-
import { BoxGeometry as BoxGeometry5, BufferAttribute as BufferAttribute5, Color as Color9, Euler as
|
|
5696
|
+
import { BoxGeometry as BoxGeometry5, BufferAttribute as BufferAttribute5, Color as Color9, Euler as Euler8, Matrix4 as Matrix49 } from "three";
|
|
5671
5697
|
function isModelObject(obj) {
|
|
5672
5698
|
return obj.isModelObject;
|
|
5673
5699
|
}
|
|
@@ -5754,6 +5780,9 @@ var init_ModelObject = __esm({
|
|
|
5754
5780
|
for (const [name, rotation] of Object.entries(part.rotations)) {
|
|
5755
5781
|
object3.getGroupByName(name)?.rotation.set(...rotation, "ZYX");
|
|
5756
5782
|
}
|
|
5783
|
+
for (const [name, position] of Object.entries(part.positions ?? {})) {
|
|
5784
|
+
object3.getGroupByName(name)?.position.set(...position);
|
|
5785
|
+
}
|
|
5757
5786
|
}
|
|
5758
5787
|
} catch (error) {
|
|
5759
5788
|
this.disposeAndRemoveAllChildren();
|
|
@@ -5796,7 +5825,7 @@ var init_ModelObject = __esm({
|
|
|
5796
5825
|
elGeo.clearGroups();
|
|
5797
5826
|
}
|
|
5798
5827
|
if (this.options.uvLockRotation) {
|
|
5799
|
-
UVMapper.lockUvs(elGeo, el.faces, this.atlas, new
|
|
5828
|
+
UVMapper.lockUvs(elGeo, el.faces, this.atlas, new Euler8(...this.options.uvLockRotation));
|
|
5800
5829
|
}
|
|
5801
5830
|
UVMapper.setAtlasUvBounds(elGeo, el.faces, this.atlas);
|
|
5802
5831
|
if (this.options.tints) {
|
|
@@ -10508,7 +10537,7 @@ init_SpecialItems();
|
|
|
10508
10537
|
init_BlockStates();
|
|
10509
10538
|
init_MineRenderError();
|
|
10510
10539
|
init_util();
|
|
10511
|
-
import { Euler as
|
|
10540
|
+
import { Euler as Euler9 } from "three";
|
|
10512
10541
|
function matchesCondition(condition, state) {
|
|
10513
10542
|
return Object.entries(condition).every(([key, value]) => {
|
|
10514
10543
|
if (Array.isArray(value)) {
|
|
@@ -10588,7 +10617,7 @@ var BlockStateResolver = class {
|
|
|
10588
10617
|
}
|
|
10589
10618
|
/** Converts blockstate rotations in degrees into the Euler rotation used by model rendering. */
|
|
10590
10619
|
static rotation(variant) {
|
|
10591
|
-
const rotation = new
|
|
10620
|
+
const rotation = new Euler9();
|
|
10592
10621
|
if (typeof variant.x !== "undefined") {
|
|
10593
10622
|
rotation.x = toRadians(clampRotationDegrees(variant.x));
|
|
10594
10623
|
}
|
|
@@ -10683,7 +10712,7 @@ var import_ts_deepmerge6 = __toESM(require_dist());
|
|
|
10683
10712
|
init_MineRenderError();
|
|
10684
10713
|
init_InstanceReference();
|
|
10685
10714
|
init_AssetKey();
|
|
10686
|
-
import { Euler as
|
|
10715
|
+
import { Euler as Euler10, Matrix4 as Matrix411, Quaternion as Quaternion5, Vector3 as Vector312 } from "three";
|
|
10687
10716
|
init_ModelCulling();
|
|
10688
10717
|
init_FluidGeometry();
|
|
10689
10718
|
init_Entities();
|
|
@@ -10825,7 +10854,7 @@ var _BlockObject = class _BlockObject extends SceneObject {
|
|
|
10825
10854
|
const scale = new Vector312();
|
|
10826
10855
|
this.getModelMatrix(model).decompose(position, rotation, scale);
|
|
10827
10856
|
if (position.distanceToSquared(this.position) > 1e-10 || scale.distanceToSquared(new Vector312(1, 1, 1)) > 1e-10) return 0;
|
|
10828
|
-
return ModelCulling.toLocalMask(worldMask, new
|
|
10857
|
+
return ModelCulling.toLocalMask(worldMask, new Euler10().setFromQuaternion(rotation));
|
|
10829
10858
|
}
|
|
10830
10859
|
async setCullMask(worldMask) {
|
|
10831
10860
|
worldMask &= 63;
|