@nodecraft/rendermite 1.6.5 → 1.6.7
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/blocks/cli.js +1 -1
- package/dist/blocks/ender-storage.js +1 -1
- package/dist/blocks/entity-geo.js +1 -1
- package/dist/blocks/entity-models.js +1 -1
- package/dist/blocks/export.js +1 -1
- package/dist/blocks/geo-blocks.d.ts +7 -3
- package/dist/blocks/geo-blocks.js +1 -1
- package/dist/blocks/obj-mesh.js +1 -1
- package/dist/{cli-AIYuxk4-.js → cli-FiMsJbQx.js} +1 -1
- package/dist/cli.js +2 -2
- package/dist/{ender-storage-a36r-lF0.js → ender-storage-C8i6Rxlq.js} +1 -1
- package/dist/entities/geo-model.d.ts +1 -1
- package/dist/{entity-fallback-u9z3oQcv.js → entity-fallback-BRMFKPlM.js} +1 -1
- package/dist/{entity-geo-B9QYodsa.js → entity-geo-DbTtMlPL.js} +1 -1
- package/dist/{entity-models--KAShEPW.js → entity-models-DSZHxCx1.js} +1 -1
- package/dist/{export-DtLGTzd_.js → export-CxocMT1x.js} +32 -12
- package/dist/{face-CuC_Wnx9.d.ts → face-1cIObOfs.d.ts} +1 -1
- package/dist/{face-CKHboPfh.js → face-DbyyYmzp.js} +17 -5
- package/dist/{geo-CmjrXu0G.d.ts → geo-BjvgFB90.d.ts} +6 -3
- package/dist/{geo-Cl-1NZX5.js → geo-BoDxwvz5.js} +95 -45
- package/dist/{geo-blocks-DSqTryeM.js → geo-blocks-BcSEBhko.js} +29 -11
- package/dist/{geometry-Bkur58Vi.d.ts → geometry--UzHu1Vh.d.ts} +2 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -4
- package/dist/{obj-bvs3gwex.js → obj-LWuJIAIM.js} +2 -2
- package/dist/{obj-mesh-rnYbSbpv.js → obj-mesh-CZsmCk-p.js} +1 -1
- package/dist/{pipeline-BwToOnuZ.d.ts → pipeline-C7pN0yko.d.ts} +1 -1
- package/dist/{pipeline-BO3ukdjt.js → pipeline-CjRcZB63.js} +3 -3
- package/dist/render/entity-fallback.d.ts +2 -2
- package/dist/render/entity-fallback.js +1 -1
- package/dist/render/face.d.ts +1 -1
- package/dist/render/face.js +1 -1
- package/dist/render/geo.d.ts +1 -1
- package/dist/render/geo.js +1 -1
- package/dist/render/geometry.d.ts +1 -1
- package/dist/render/geometry.js +1 -1
- package/dist/render/legacy-tints.d.ts +1 -1
- package/dist/render/obj.d.ts +1 -1
- package/dist/render/obj.js +1 -1
- package/dist/render/pipeline.d.ts +1 -1
- package/dist/render/pipeline.js +1 -1
- package/dist/render/renderer.d.ts +1 -1
- package/dist/render/renderer.js +1 -1
- package/dist/render/tints.d.ts +1 -1
- package/dist/{renderer-C_DFi8DF.d.ts → renderer-CjreM6tk.d.ts} +1 -1
- package/dist/{run-Bblci_CC.d.ts → run-BgXZp8VQ.d.ts} +1 -1
- package/dist/{run-0EPZBeqT.js → run-CGcHj_qq.js} +1 -1
- package/dist/run.d.ts +1 -1
- package/dist/run.js +1 -1
- package/dist/{tints-6z6ysGUs.d.ts → tints-iPf8hSKX.d.ts} +1 -1
- package/dist/workers/render-worker.d.ts +1 -1
- package/dist/workers/render-worker.js +1 -1
- package/package.json +1 -1
- package/dist/{geometry-Bi-Bf5rb.js → geometry-bUDBhncX.js} +1 -1
package/dist/blocks/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as runBlocksCli } from "../cli-
|
|
1
|
+
import { t as runBlocksCli } from "../cli-FiMsJbQx.js";
|
|
2
2
|
export { runBlocksCli };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as enderStorageBlockModel } from "../ender-storage-
|
|
1
|
+
import { t as enderStorageBlockModel } from "../ender-storage-C8i6Rxlq.js";
|
|
2
2
|
export { enderStorageBlockModel };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as findGeoForEntity } from "../entity-geo-
|
|
1
|
+
import { t as findGeoForEntity } from "../entity-geo-DbTtMlPL.js";
|
|
2
2
|
export { findGeoForEntity };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as collectEntityGeometry } from "../entity-models
|
|
1
|
+
import { t as collectEntityGeometry } from "../entity-models-DSZHxCx1.js";
|
|
2
2
|
export { collectEntityGeometry };
|
package/dist/blocks/export.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as exportBlockPack } from "../export-
|
|
1
|
+
import { t as exportBlockPack } from "../export-CxocMT1x.js";
|
|
2
2
|
export { exportBlockPack };
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { a as ResourceManager } from "../manager-exOIcdyx.js";
|
|
2
2
|
import { f as BlockPackModel } from "../pack-format-QcVFxG_b.js";
|
|
3
3
|
//#region src/blocks/geo-blocks.d.ts
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
interface GeoBlockOverride {
|
|
5
|
+
model: BlockPackModel;
|
|
6
|
+
javaFacing: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** Converts a Java-rendered Gecko block into a world-scale 0–16 triangle mesh. */
|
|
9
|
+
declare function geoBlockModel(blockId: string, resources: ResourceManager): Promise<GeoBlockOverride | null>;
|
|
6
10
|
//#endregion
|
|
7
|
-
export { geoBlockModel };
|
|
11
|
+
export { GeoBlockOverride, geoBlockModel };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as geoBlockModel } from "../geo-blocks-
|
|
1
|
+
import { t as geoBlockModel } from "../geo-blocks-BcSEBhko.js";
|
|
2
2
|
export { geoBlockModel };
|
package/dist/blocks/obj-mesh.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as buildObjMesh, t as ObjMeshError } from "../obj-mesh-
|
|
1
|
+
import { n as buildObjMesh, t as ObjMeshError } from "../obj-mesh-CZsmCk-p.js";
|
|
2
2
|
export { ObjMeshError, buildObjMesh };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as builtinPackPath } from "./builtin-WkWjATeh.js";
|
|
2
2
|
import { n as LayeredResourceManager, t as FolderResourceManager } from "./manager-BNibYkmI.js";
|
|
3
|
-
import { t as exportBlockPack } from "./export-
|
|
3
|
+
import { t as exportBlockPack } from "./export-CxocMT1x.js";
|
|
4
4
|
import { n as layeredClasses, t as JarClassReader } from "./jar-classes-3GVCJZT7.js";
|
|
5
5
|
import { n as prepareModResources } from "./prepare-Myd_ec4v.js";
|
|
6
6
|
import { t as downloadClientJar } from "./download-1wAfrGKx.js";
|
package/dist/cli.js
CHANGED
|
@@ -6,8 +6,8 @@ import { t as curatedModelOverrides } from "./models-CZjCOjs4.js";
|
|
|
6
6
|
import { n as harvestTintOverrides, t as curatedTintOverrides } from "./tints-BspVCz2G.js";
|
|
7
7
|
import { t as downloadClientJar } from "./download-1wAfrGKx.js";
|
|
8
8
|
import { a as prepareVersionResources, i as eraForVersion, n as GEOMETRY_DONOR_VERSIONS } from "./prepare-D49Gu4Lv.js";
|
|
9
|
-
import { t as runBlocksCli } from "./cli-
|
|
10
|
-
import { t as run } from "./run-
|
|
9
|
+
import { t as runBlocksCli } from "./cli-FiMsJbQx.js";
|
|
10
|
+
import { t as run } from "./run-CGcHj_qq.js";
|
|
11
11
|
import path from "node:path";
|
|
12
12
|
import os from "node:os";
|
|
13
13
|
import { parseArgs } from "node:util";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as ResourceLocator } from "./locator-COMEtEn9.js";
|
|
2
|
-
import { r as parseObj } from "./obj-
|
|
2
|
+
import { r as parseObj } from "./obj-LWuJIAIM.js";
|
|
3
3
|
//#region src/blocks/ender-storage.ts
|
|
4
4
|
/** Geometry for Ender Storage blocks whose shipped JSON model is only an empty Java-renderer hook. */
|
|
5
5
|
const BLOCK_UNITS = 16;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as ResourceLocator } from "./locator-COMEtEn9.js";
|
|
2
2
|
import { a as findBedTexture, f as tokens, i as coversSheet, n as HEAD_LAYOUTS, o as findChestTexture, s as findEntityTexture, t as DYE_COLORS, u as findMobTexture } from "./entity-textures-4XXT8jVI.js";
|
|
3
|
-
import { c as renderModel } from "./obj-
|
|
3
|
+
import { c as renderModel } from "./obj-LWuJIAIM.js";
|
|
4
4
|
//#region src/render/entity-fallback.ts
|
|
5
5
|
/**
|
|
6
6
|
* Heuristic rendering for mod items that parent `builtin/entity` — chests,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as ResourceLocator } from "./locator-COMEtEn9.js";
|
|
2
2
|
import { t as geoToModel } from "./geo-model-Bo1gpEwX.js";
|
|
3
|
-
import { i as parseGeo, r as nameTokens } from "./geo-
|
|
3
|
+
import { i as parseGeo, r as nameTokens } from "./geo-BoDxwvz5.js";
|
|
4
4
|
//#region src/blocks/entity-geo.ts
|
|
5
5
|
/**
|
|
6
6
|
* Finding the `.geo.json` a GeckoLib entity is drawn from.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as findGeoForEntity } from "./entity-geo-
|
|
1
|
+
import { t as findGeoForEntity } from "./entity-geo-DbTtMlPL.js";
|
|
2
2
|
import { n as extractInheritedModel } from "./inherit-C5Ifg3SM.js";
|
|
3
3
|
import { a as linkEntityModel, i as classReader, r as buildModelNameIndex } from "./link-5GmBLTzk.js";
|
|
4
4
|
import { s as resolveMappings, t as MappingsUnavailableError } from "./mappings-BEPVaiwE.js";
|
|
@@ -3,13 +3,13 @@ import { n as ResourceLocator } from "./locator-COMEtEn9.js";
|
|
|
3
3
|
import { n as blockEntityGeometry, r as synthesizeVariants, t as INVISIBLE_BLOCKS } from "./block-entities-XAynAVUE.js";
|
|
4
4
|
import { a as parseBlockState, n as collectModels } from "./blockstate-eval-BRQ3NWY2.js";
|
|
5
5
|
import { a as salvageJson, i as resolveTexture, t as ModelLoader } from "./loader-C-NuJaEi.js";
|
|
6
|
-
import { t as enderStorageBlockModel } from "./ender-storage-
|
|
6
|
+
import { t as enderStorageBlockModel } from "./ender-storage-C8i6Rxlq.js";
|
|
7
7
|
import { t as collectEntities } from "./entities-DubtdM11.js";
|
|
8
|
-
import { t as collectEntityGeometry } from "./entity-models
|
|
9
|
-
import { t as geoBlockModel } from "./geo-blocks-
|
|
8
|
+
import { t as collectEntityGeometry } from "./entity-models-DSZHxCx1.js";
|
|
9
|
+
import { t as geoBlockModel } from "./geo-blocks-BcSEBhko.js";
|
|
10
10
|
import { n as discoverItems } from "./discovery-CD0QqxSF.js";
|
|
11
11
|
import { t as collectItemSprites } from "./item-sprites-CnCH8YFv.js";
|
|
12
|
-
import { n as buildObjMesh } from "./obj-mesh-
|
|
12
|
+
import { n as buildObjMesh } from "./obj-mesh-CZsmCk-p.js";
|
|
13
13
|
import { n as buildSpriteSheet, t as MISSING_SPRITE } from "./sprite-sheet-LQAEtGkp.js";
|
|
14
14
|
import { n as buildBlockTints, t as UNREGISTERED_TINTS } from "./tints-Cl0r-Ol3.js";
|
|
15
15
|
import { t as loadAtlasResolver } from "./registry-DlduyjtM.js";
|
|
@@ -420,14 +420,34 @@ async function exportBlockPack(options) {
|
|
|
420
420
|
modelTintIndices.set(reference, tintIndices);
|
|
421
421
|
for (const sprite of sprites) spriteIds.add(sprite);
|
|
422
422
|
}
|
|
423
|
-
for (const [id
|
|
424
|
-
const
|
|
425
|
-
if (!
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
423
|
+
for (const [id] of blockModels) {
|
|
424
|
+
const override = await geoBlockModel(id, resources);
|
|
425
|
+
if (!override) continue;
|
|
426
|
+
const block = ResourceLocator.parse(id);
|
|
427
|
+
const reference = `rendermite:block/${block.namespace}/${block.path}_geo`;
|
|
428
|
+
emittedModels[reference] = override.model;
|
|
429
|
+
modelTintIndices.set(reference, /* @__PURE__ */ new Set());
|
|
430
|
+
const definition = definitions.get(id);
|
|
431
|
+
if (!definition) continue;
|
|
432
|
+
for (const part of definition.cases) for (const variant of part.apply) variant.model = reference;
|
|
433
|
+
if (override.javaFacing && definition.kind === "variants" && !definition.cases.some((part) => part.when.facing !== void 0)) for (const [facing, y] of Object.entries({
|
|
434
|
+
north: 0,
|
|
435
|
+
east: 90,
|
|
436
|
+
south: 180,
|
|
437
|
+
west: 270
|
|
438
|
+
})) definition.cases.push({
|
|
439
|
+
when: { facing },
|
|
440
|
+
apply: [{
|
|
441
|
+
model: reference,
|
|
442
|
+
x: 0,
|
|
443
|
+
y,
|
|
444
|
+
z: 0,
|
|
445
|
+
uvlock: false,
|
|
446
|
+
weight: 1
|
|
447
|
+
}]
|
|
448
|
+
});
|
|
449
|
+
blockModels.set(id, [reference]);
|
|
450
|
+
for (const group of override.model.mesh ?? []) spriteIds.add(group.sprite);
|
|
431
451
|
}
|
|
432
452
|
for (const [id, references] of blockModels) {
|
|
433
453
|
const enderStorage = await enderStorageBlockModel(id, resources);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as FloatTexture } from "./blend-eT64Z6qm.js";
|
|
2
2
|
import { t as Mat4 } from "./vector-DRKRi4--.js";
|
|
3
|
-
import { n as FaceGeometry } from "./geometry
|
|
3
|
+
import { n as FaceGeometry } from "./geometry--UzHu1Vh.js";
|
|
4
4
|
import { r as LightSource } from "./lighting-3FGRC3Af.js";
|
|
5
5
|
import { n as FaceBuffer } from "./rasterizer-BFAHGtdT.js";
|
|
6
6
|
//#region src/render/face.d.ts
|
|
@@ -58,10 +58,22 @@ function renderFace(face, width, height, transformation, scratch, shadeCache) {
|
|
|
58
58
|
y: phpRound(height - ((v[1] - .5) * height + height / 2))
|
|
59
59
|
};
|
|
60
60
|
});
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
const explicitUvs = geometry.uvs;
|
|
62
|
+
const normalizedBounds = explicitUvs ? [
|
|
63
|
+
Math.min(...explicitUvs.map((uv) => uv[0])),
|
|
64
|
+
Math.min(...explicitUvs.map((uv) => uv[1])),
|
|
65
|
+
Math.max(...explicitUvs.map((uv) => uv[0])),
|
|
66
|
+
Math.max(...explicitUvs.map((uv) => uv[1]))
|
|
67
|
+
] : [
|
|
68
|
+
geometry.uv1[0],
|
|
69
|
+
geometry.uv1[1],
|
|
70
|
+
geometry.uv2[0],
|
|
71
|
+
geometry.uv2[1]
|
|
72
|
+
];
|
|
73
|
+
const absU1 = normalizedBounds[0] * face.texture.width;
|
|
74
|
+
const absV1 = normalizedBounds[1] * face.texture.height;
|
|
75
|
+
const absU2 = normalizedBounds[2] * face.texture.width;
|
|
76
|
+
const absV2 = normalizedBounds[3] * face.texture.height;
|
|
65
77
|
const tint = geometry.tintIndex !== null ? face.tint : null;
|
|
66
78
|
const darkness = geometry.emissive ? 0 : 1 - face.light.lightLevelForNormal(shadeDirection);
|
|
67
79
|
const [windowX1, windowY1, windowX2, windowY2] = uvWindow(face.texture, absU1, absV1, absU2, absV2);
|
|
@@ -94,7 +106,7 @@ function renderFace(face, width, height, transformation, scratch, shadeCache) {
|
|
|
94
106
|
texture = shaded;
|
|
95
107
|
shading = null;
|
|
96
108
|
}
|
|
97
|
-
const uvs = [
|
|
109
|
+
const uvs = explicitUvs?.map((uv) => [uv[0], uv[1]]) ?? [
|
|
98
110
|
[geometry.uv1[0], geometry.uv1[1]],
|
|
99
111
|
[geometry.uv1[0] + uvWidth, geometry.uv1[1]],
|
|
100
112
|
[geometry.uv1[0] + uvWidth, geometry.uv1[1] + uvHeight],
|
|
@@ -2,8 +2,8 @@ import { n as ResourceLocator } from "./locator-jDbdUeTd.js";
|
|
|
2
2
|
import { a as ResourceManager } from "./manager-exOIcdyx.js";
|
|
3
3
|
import { i as TextureLoader } from "./loader-DUlx29PC.js";
|
|
4
4
|
import { n as FloatTexture } from "./blend-eT64Z6qm.js";
|
|
5
|
-
import { n as FaceGeometry } from "./geometry
|
|
6
|
-
import { i as RenderOptions } from "./renderer-
|
|
5
|
+
import { n as FaceGeometry } from "./geometry--UzHu1Vh.js";
|
|
6
|
+
import { i as RenderOptions } from "./renderer-CjreM6tk.js";
|
|
7
7
|
//#region src/render/geo.d.ts
|
|
8
8
|
interface GeoCube {
|
|
9
9
|
origin?: number[];
|
|
@@ -11,6 +11,7 @@ interface GeoCube {
|
|
|
11
11
|
uv?: number[] | Record<string, {
|
|
12
12
|
uv: number[];
|
|
13
13
|
uv_size?: number[];
|
|
14
|
+
uv_rotation?: number;
|
|
14
15
|
}>;
|
|
15
16
|
inflate?: number;
|
|
16
17
|
/** Bedrock mirrors a box's texture rather than its geometry, so only a consumer's UVs care. */
|
|
@@ -44,7 +45,9 @@ interface ParsedGeo {
|
|
|
44
45
|
/** Handles both the modern (1.12+) and legacy (`geometry.name` keyed) layouts. */
|
|
45
46
|
declare function parseGeo(json: GeoFile): ParsedGeo | null;
|
|
46
47
|
/** Convert a parsed geo into face geometry, unit-cube fitted with gui pose. */
|
|
47
|
-
declare function geoToFaces(geo: ParsedGeo
|
|
48
|
+
declare function geoToFaces(geo: ParsedGeo, options?: {
|
|
49
|
+
fit?: boolean;
|
|
50
|
+
}): FaceGeometry[];
|
|
48
51
|
/** Conventional locations GeckoLib mods keep item geometry and textures. */
|
|
49
52
|
declare function findGeoForItem(resources: ResourceManager, id: string): Promise<{
|
|
50
53
|
geo: ParsedGeo;
|
|
@@ -4,7 +4,7 @@ import { n as displayMatrix } from "./vector-CCxLae_T.js";
|
|
|
4
4
|
import { c as lightsForProfile } from "./lighting--5myudVu.js";
|
|
5
5
|
import { i as createFaceBuffer } from "./rasterizer-DcVJzkxz.js";
|
|
6
6
|
import { t as combineFaceBuffers } from "./compose-BGsNFR12.js";
|
|
7
|
-
import { n as faceMaxZ, r as renderFace, t as createShadeCache } from "./face-
|
|
7
|
+
import { n as faceMaxZ, r as renderFace, t as createShadeCache } from "./face-DbyyYmzp.js";
|
|
8
8
|
//#region src/render/geo.ts
|
|
9
9
|
/**
|
|
10
10
|
* Bedrock-format geometry (`.geo.json`) rendering, best-effort. GeckoLib mods
|
|
@@ -54,8 +54,8 @@ function rotatePoint(point, pivot, rotation) {
|
|
|
54
54
|
z + pivot[2]
|
|
55
55
|
];
|
|
56
56
|
}
|
|
57
|
-
/**
|
|
58
|
-
function boxFaces(origin, size
|
|
57
|
+
/** Bedrock cube vertices in source space; X is mirrored after cube and bone rotations. */
|
|
58
|
+
function boxFaces(origin, size) {
|
|
59
59
|
const [ox, oy, oz] = origin;
|
|
60
60
|
const [sx, sy, sz] = size;
|
|
61
61
|
const x1 = ox + sx;
|
|
@@ -74,12 +74,6 @@ function boxFaces(origin, size, u, v) {
|
|
|
74
74
|
corner(x1, y1, oz),
|
|
75
75
|
corner(x1, y1, z1),
|
|
76
76
|
corner(ox, y1, z1)
|
|
77
|
-
],
|
|
78
|
-
uv: [
|
|
79
|
-
u + sz,
|
|
80
|
-
v,
|
|
81
|
-
u + sz + sx,
|
|
82
|
-
v + sz
|
|
83
77
|
]
|
|
84
78
|
},
|
|
85
79
|
{
|
|
@@ -89,12 +83,6 @@ function boxFaces(origin, size, u, v) {
|
|
|
89
83
|
corner(x1, oy, z1),
|
|
90
84
|
corner(x1, oy, oz),
|
|
91
85
|
corner(ox, oy, oz)
|
|
92
|
-
],
|
|
93
|
-
uv: [
|
|
94
|
-
u + sz + sx,
|
|
95
|
-
v,
|
|
96
|
-
u + sz + sx + sx,
|
|
97
|
-
v + sz
|
|
98
86
|
]
|
|
99
87
|
},
|
|
100
88
|
{
|
|
@@ -104,12 +92,6 @@ function boxFaces(origin, size, u, v) {
|
|
|
104
92
|
corner(ox, y1, oz),
|
|
105
93
|
corner(ox, oy, oz),
|
|
106
94
|
corner(x1, oy, oz)
|
|
107
|
-
],
|
|
108
|
-
uv: [
|
|
109
|
-
u + sz,
|
|
110
|
-
v + sz,
|
|
111
|
-
u + sz + sx,
|
|
112
|
-
v + sz + sy
|
|
113
95
|
]
|
|
114
96
|
},
|
|
115
97
|
{
|
|
@@ -119,12 +101,6 @@ function boxFaces(origin, size, u, v) {
|
|
|
119
101
|
corner(x1, y1, z1),
|
|
120
102
|
corner(x1, oy, z1),
|
|
121
103
|
corner(ox, oy, z1)
|
|
122
|
-
],
|
|
123
|
-
uv: [
|
|
124
|
-
u + sz + sx + sz,
|
|
125
|
-
v + sz,
|
|
126
|
-
u + sz + sx + sz + sx,
|
|
127
|
-
v + sz + sy
|
|
128
104
|
]
|
|
129
105
|
},
|
|
130
106
|
{
|
|
@@ -134,12 +110,6 @@ function boxFaces(origin, size, u, v) {
|
|
|
134
110
|
corner(x1, y1, oz),
|
|
135
111
|
corner(x1, oy, oz),
|
|
136
112
|
corner(x1, oy, z1)
|
|
137
|
-
],
|
|
138
|
-
uv: [
|
|
139
|
-
u,
|
|
140
|
-
v + sz,
|
|
141
|
-
u + sz,
|
|
142
|
-
v + sz + sy
|
|
143
113
|
]
|
|
144
114
|
},
|
|
145
115
|
{
|
|
@@ -149,18 +119,69 @@ function boxFaces(origin, size, u, v) {
|
|
|
149
119
|
corner(ox, y1, z1),
|
|
150
120
|
corner(ox, oy, z1),
|
|
151
121
|
corner(ox, oy, oz)
|
|
152
|
-
],
|
|
153
|
-
uv: [
|
|
154
|
-
u + sz + sx,
|
|
155
|
-
v + sz,
|
|
156
|
-
u + sz + sx + sz,
|
|
157
|
-
v + sz + sy
|
|
158
122
|
]
|
|
159
123
|
}
|
|
160
124
|
];
|
|
161
125
|
}
|
|
126
|
+
function compactUv(direction, size, u, v) {
|
|
127
|
+
const [sx, sy, sz] = size;
|
|
128
|
+
if (direction === "west") return [
|
|
129
|
+
u + sz + sx,
|
|
130
|
+
v + sz,
|
|
131
|
+
u + sz + sx + sz,
|
|
132
|
+
v + sz + sy
|
|
133
|
+
];
|
|
134
|
+
if (direction === "east") return [
|
|
135
|
+
u,
|
|
136
|
+
v + sz,
|
|
137
|
+
u + sz,
|
|
138
|
+
v + sz + sy
|
|
139
|
+
];
|
|
140
|
+
if (direction === "north") return [
|
|
141
|
+
u + sz,
|
|
142
|
+
v + sz,
|
|
143
|
+
u + sz + sx,
|
|
144
|
+
v + sz + sy
|
|
145
|
+
];
|
|
146
|
+
if (direction === "south") return [
|
|
147
|
+
u + sz + sx + sz,
|
|
148
|
+
v + sz,
|
|
149
|
+
u + sz + sx + sz + sx,
|
|
150
|
+
v + sz + sy
|
|
151
|
+
];
|
|
152
|
+
if (direction === "up") return [
|
|
153
|
+
u + sz,
|
|
154
|
+
v,
|
|
155
|
+
u + sz + sx,
|
|
156
|
+
v + sz
|
|
157
|
+
];
|
|
158
|
+
return [
|
|
159
|
+
u + sz + sx,
|
|
160
|
+
v + sz,
|
|
161
|
+
u + sz + sx + sx,
|
|
162
|
+
v
|
|
163
|
+
];
|
|
164
|
+
}
|
|
165
|
+
function mirroredDirection(direction) {
|
|
166
|
+
if (direction === "east") return "west";
|
|
167
|
+
if (direction === "west") return "east";
|
|
168
|
+
return direction;
|
|
169
|
+
}
|
|
170
|
+
function faceUvSize(direction, size) {
|
|
171
|
+
if (direction === "west" || direction === "east") return [size[2], size[1]];
|
|
172
|
+
if (direction === "up" || direction === "down") return [size[0], size[2]];
|
|
173
|
+
return [size[0], size[1]];
|
|
174
|
+
}
|
|
175
|
+
function rotateUvs(uvs, degrees) {
|
|
176
|
+
const rotated = [...uvs];
|
|
177
|
+
for (let step = 0; step < Math.floor((degrees % 360 + 360) % 360 / 90); step++) {
|
|
178
|
+
const last = rotated.pop();
|
|
179
|
+
if (last) rotated.unshift(last);
|
|
180
|
+
}
|
|
181
|
+
return rotated;
|
|
182
|
+
}
|
|
162
183
|
/** Convert a parsed geo into face geometry, unit-cube fitted with gui pose. */
|
|
163
|
-
function geoToFaces(geo) {
|
|
184
|
+
function geoToFaces(geo, options = {}) {
|
|
164
185
|
const bonesByName = /* @__PURE__ */ new Map();
|
|
165
186
|
for (const bone of geo.bones) if (bone.name) bonesByName.set(bone.name, bone);
|
|
166
187
|
const boneChain = (bone) => {
|
|
@@ -189,6 +210,11 @@ function geoToFaces(geo) {
|
|
|
189
210
|
for (const cube of bone.cubes ?? []) {
|
|
190
211
|
if (!cube.origin || !cube.size) continue;
|
|
191
212
|
const inflate = cube.inflate ?? 0;
|
|
213
|
+
const rawSize = [
|
|
214
|
+
cube.size[0],
|
|
215
|
+
cube.size[1],
|
|
216
|
+
cube.size[2]
|
|
217
|
+
];
|
|
192
218
|
const origin = [
|
|
193
219
|
cube.origin[0] - inflate,
|
|
194
220
|
cube.origin[1] - inflate,
|
|
@@ -201,19 +227,35 @@ function geoToFaces(geo) {
|
|
|
201
227
|
];
|
|
202
228
|
const uvBase = Array.isArray(cube.uv) ? cube.uv : null;
|
|
203
229
|
const perFace = !Array.isArray(cube.uv) && cube.uv ? cube.uv : null;
|
|
204
|
-
for (const spec of boxFaces(origin, size
|
|
205
|
-
|
|
230
|
+
for (const spec of boxFaces(origin, size)) {
|
|
231
|
+
const direction = mirroredDirection(spec.direction);
|
|
232
|
+
let uvRect = compactUv(direction, rawSize, uvBase?.[0] ?? 0, uvBase?.[1] ?? 0);
|
|
233
|
+
let uvRotation = 0;
|
|
206
234
|
if (perFace) {
|
|
207
|
-
const entry = perFace[
|
|
235
|
+
const entry = perFace[direction];
|
|
208
236
|
if (!entry) continue;
|
|
209
|
-
const uvSize = entry.uv_size ??
|
|
237
|
+
const uvSize = entry.uv_size ?? faceUvSize(direction, rawSize);
|
|
210
238
|
uvRect = [
|
|
211
239
|
entry.uv[0],
|
|
212
240
|
entry.uv[1],
|
|
213
241
|
entry.uv[0] + uvSize[0],
|
|
214
242
|
entry.uv[1] + uvSize[1]
|
|
215
243
|
];
|
|
244
|
+
uvRotation = entry.uv_rotation ?? 0;
|
|
216
245
|
}
|
|
246
|
+
const [u1, v1, u2, v2] = uvRect;
|
|
247
|
+
let uvs = cube.mirror ? [
|
|
248
|
+
[u1, v1],
|
|
249
|
+
[u2, v1],
|
|
250
|
+
[u2, v2],
|
|
251
|
+
[u1, v2]
|
|
252
|
+
] : [
|
|
253
|
+
[u2, v1],
|
|
254
|
+
[u1, v1],
|
|
255
|
+
[u1, v2],
|
|
256
|
+
[u2, v2]
|
|
257
|
+
];
|
|
258
|
+
uvs = rotateUvs(uvs, uvRotation);
|
|
217
259
|
let corners = spec.corners.map((point) => [...point]);
|
|
218
260
|
if (cube.rotation && cube.pivot) corners = corners.map((point) => rotatePoint(point, cube.pivot, cube.rotation));
|
|
219
261
|
for (const link of chain) if (link.rotation && link.pivot) corners = corners.map((point) => rotatePoint(point, link.pivot, link.rotation));
|
|
@@ -228,15 +270,22 @@ function geoToFaces(geo) {
|
|
|
228
270
|
corners[2],
|
|
229
271
|
corners[1]
|
|
230
272
|
];
|
|
273
|
+
uvs = [
|
|
274
|
+
uvs[0],
|
|
275
|
+
uvs[3],
|
|
276
|
+
uvs[2],
|
|
277
|
+
uvs[1]
|
|
278
|
+
];
|
|
231
279
|
for (const point of corners) for (let axis = 0; axis < 3; axis++) {
|
|
232
280
|
min[axis] = Math.min(min[axis], point[axis]);
|
|
233
281
|
max[axis] = Math.max(max[axis], point[axis]);
|
|
234
282
|
}
|
|
235
283
|
faces.push({
|
|
236
|
-
direction
|
|
284
|
+
direction,
|
|
237
285
|
vertices: corners,
|
|
238
286
|
uv1: [uvRect[0] / geo.textureWidth, uvRect[1] / geo.textureHeight],
|
|
239
287
|
uv2: [uvRect[2] / geo.textureWidth, uvRect[3] / geo.textureHeight],
|
|
288
|
+
uvs: uvs.map((uv) => [uv[0] / geo.textureWidth, uv[1] / geo.textureHeight]),
|
|
240
289
|
textureRef: "#geo",
|
|
241
290
|
rotation: 0,
|
|
242
291
|
tintIndex: null,
|
|
@@ -249,6 +298,7 @@ function geoToFaces(geo) {
|
|
|
249
298
|
}
|
|
250
299
|
const extent = Math.max(max[0] - min[0], max[1] - min[1], max[2] - min[2]);
|
|
251
300
|
if (!Number.isFinite(extent) || extent <= 0) return [];
|
|
301
|
+
if (options.fit === false) return faces;
|
|
252
302
|
const scale = 1 / extent;
|
|
253
303
|
const center = [
|
|
254
304
|
(min[0] + max[0]) / 2,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as ResourceLocator } from "./locator-COMEtEn9.js";
|
|
2
|
-
import { i as parseGeo, n as geoToFaces } from "./geo-
|
|
2
|
+
import { i as parseGeo, n as geoToFaces } from "./geo-BoDxwvz5.js";
|
|
3
3
|
//#region src/blocks/geo-blocks.ts
|
|
4
4
|
/** GeckoLib block geometry selected by a Java block-entity renderer rather than its placeholder JSON. */
|
|
5
5
|
/** Blocks whose ordinary cube model exists only for particles/breaking and is replaced in Java. */
|
|
@@ -25,9 +25,23 @@ const TRIANGLE_CORNERS = [
|
|
|
25
25
|
2,
|
|
26
26
|
3
|
|
27
27
|
];
|
|
28
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Exact convention used by GeckoLib block renderers such as Oritech's: the block, geometry and skin
|
|
30
|
+
* share a name. Requiring both assets avoids treating an unrelated same-named entity geo as a block.
|
|
31
|
+
*/
|
|
32
|
+
async function conventionalResource(blockId, resources) {
|
|
33
|
+
const block = ResourceLocator.parse(blockId);
|
|
34
|
+
const resource = {
|
|
35
|
+
geo: `${block.namespace}:geo/block/models/${block.path}.geo.json`,
|
|
36
|
+
texture: `${block.namespace}:block/models/${block.path}`,
|
|
37
|
+
javaFacing: true
|
|
38
|
+
};
|
|
39
|
+
const [geo, texture] = await Promise.all([resources.hasResource("raw", ResourceLocator.parse(resource.geo)), resources.hasResource("texture", ResourceLocator.parse(resource.texture))]);
|
|
40
|
+
return geo && texture ? resource : null;
|
|
41
|
+
}
|
|
42
|
+
/** Converts a Java-rendered Gecko block into a world-scale 0–16 triangle mesh. */
|
|
29
43
|
async function geoBlockModel(blockId, resources) {
|
|
30
|
-
const resource = GEO_BLOCKS[blockId];
|
|
44
|
+
const resource = GEO_BLOCKS[blockId] ?? await conventionalResource(blockId, resources);
|
|
31
45
|
if (!resource) return null;
|
|
32
46
|
const raw = await resources.getResource("raw", ResourceLocator.parse(resource.geo));
|
|
33
47
|
if (!raw) return null;
|
|
@@ -38,25 +52,29 @@ async function geoBlockModel(blockId, resources) {
|
|
|
38
52
|
positions: [],
|
|
39
53
|
uv: []
|
|
40
54
|
};
|
|
41
|
-
for (const face of geoToFaces(geo)) {
|
|
42
|
-
const uvs = [
|
|
55
|
+
for (const face of geoToFaces(geo, { fit: false })) {
|
|
56
|
+
const uvs = face.uvs ?? [
|
|
43
57
|
[face.uv1[0], face.uv1[1]],
|
|
44
58
|
[face.uv1[0], face.uv2[1]],
|
|
45
59
|
[face.uv2[0], face.uv2[1]],
|
|
46
60
|
[face.uv2[0], face.uv1[1]]
|
|
47
61
|
];
|
|
48
62
|
for (const corner of TRIANGLE_CORNERS) {
|
|
49
|
-
|
|
63
|
+
const vertex = face.vertices[corner];
|
|
64
|
+
group.positions.push(vertex[0] + 8, vertex[1], vertex[2] + 8);
|
|
50
65
|
group.uv.push(uvs[corner][0] * 16, uvs[corner][1] * 16);
|
|
51
66
|
}
|
|
52
67
|
}
|
|
53
68
|
if (group.positions.length === 0) return null;
|
|
54
69
|
return {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
70
|
+
model: {
|
|
71
|
+
ao: false,
|
|
72
|
+
elements: [],
|
|
73
|
+
mesh: [group],
|
|
74
|
+
particle: resource.texture,
|
|
75
|
+
renderType: "cutout"
|
|
76
|
+
},
|
|
77
|
+
javaFacing: resource.javaFacing ?? false
|
|
60
78
|
};
|
|
61
79
|
}
|
|
62
80
|
//#endregion
|
|
@@ -8,6 +8,8 @@ interface FaceGeometry {
|
|
|
8
8
|
/** Normalized UV rect corners (0–1). */
|
|
9
9
|
uv1: [number, number];
|
|
10
10
|
uv2: [number, number];
|
|
11
|
+
/** Explicit v0..v3 UVs for formats whose face mapping is not representable by a rectangle rotation. */
|
|
12
|
+
uvs?: [[number, number], [number, number], [number, number], [number, number]];
|
|
11
13
|
textureRef: string;
|
|
12
14
|
/** Degrees 0/90/180/270 — rotates the UV corner assignment. */
|
|
13
15
|
rotation: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -12,15 +12,15 @@ import { i as exportBlockPack, n as BlockPackResult, r as ExportBlockPackOptions
|
|
|
12
12
|
import { s as builtinDynamicResources } from "./generators-BnIzAftW.js";
|
|
13
13
|
import { d as toFloatTexture, n as FloatTexture, u as toByteTexture } from "./blend-eT64Z6qm.js";
|
|
14
14
|
import { a as LightingProfileName, i as LightingProfile, r as LightSource, u as lightsForProfile } from "./lighting-3FGRC3Af.js";
|
|
15
|
-
import { a as RenderedFrames, c as renderModel, i as RenderOptions, l as renderModelFrames, o as boxDownscale, r as ItemRenderError, s as pointResize } from "./renderer-
|
|
15
|
+
import { a as RenderedFrames, c as renderModel, i as RenderOptions, l as renderModelFrames, o as boxDownscale, r as ItemRenderError, s as pointResize } from "./renderer-CjreM6tk.js";
|
|
16
16
|
import { c as defaultProperties, i as ItemRenderInstruction, l as evaluateItemModel, n as InvalidItemDefinitionError, o as TintDefinition, r as ItemProperties, s as UNKNOWN_MODEL } from "./definition-ricL7Jqf.js";
|
|
17
17
|
import { i as discoverItems, n as ItemDiscoveryOptions, o as resolveItem, r as ItemResolutionError, t as DiscoveredItem } from "./discovery-Cmir3QfC.js";
|
|
18
|
-
import { a as resolveTint, i as parseTintValue, n as InvalidTinterDefinitionError, o as resolveTints, t as DYE_COLORS } from "./tints-
|
|
18
|
+
import { a as resolveTint, i as parseTintValue, n as InvalidTinterDefinitionError, o as resolveTints, t as DYE_COLORS } from "./tints-iPf8hSKX.js";
|
|
19
19
|
import { i as EncodedIcon, n as EncodeOptions, o as encodeAnimatedIcon, r as EncodedAnimatedIcon, s as encodeIcon, t as AnimatedEncodeOptions } from "./encode-Cf8hI5OY.js";
|
|
20
20
|
import { t as minifyStylesheet } from "./minify-CIV6enbr.js";
|
|
21
21
|
import { a as compareVersions, o as eraForVersion, s as prepareVersionResources } from "./prepare-6pH3CNpg.js";
|
|
22
22
|
import { i as prepareModResources } from "./prepare-OS7wL3jv.js";
|
|
23
23
|
import { i as itemClass, n as StylesheetOptions, r as generateStylesheet, t as ItemStyle } from "./stylesheet-i-t_7sZ7.js";
|
|
24
|
-
import { i as run, n as RunOptions, r as RunResult, t as ItemFailure } from "./run-
|
|
24
|
+
import { i as run, n as RunOptions, r as RunResult, t as ItemFailure } from "./run-BgXZp8VQ.js";
|
|
25
25
|
import { n as UnsafeJarError, r as isUnsafeEntryPath, t as JarResourceManager } from "./jar-B5iRZQeL.js";
|
|
26
26
|
export { type AnimatedEncodeOptions, AnimatedTexture, type AtlasResolver, type AtlasSource, AtlasSourceError, type BiomeClimate, type BiomeClimatePack, type BlockModelVariant, type BlockPackFailure, type BlockPackResult, type BlockProperties, type BlockStateDefinition, BlockStateError, type BlockStateMultipartCase, type BlockStateVariantCase, type BlockTint, type BlockTintPack, DEFAULT_WATER_COLOR, DYE_COLORS, type DiscoveredItem, type EncodeOptions, type EncodedAnimatedIcon, type EncodedIcon, type ExportBlockPackOptions, type FloatTexture, FolderResourceManager, InvalidItemDefinitionError, InvalidResourceLocatorError, InvalidTinterDefinitionError, type ItemDiscoveryOptions, type ItemFailure, type ItemProperties, ItemRenderError, type ItemRenderInstruction, ItemResolutionError, type ItemStyle, JarResourceManager, LayeredResourceManager, type LightSource, LightingProfile, type LightingProfileName, type MeshGroup, ModelLoader, ModelResolutionError, type MultipartCondition, type ObjMesh, ObjMeshError, type PackEntry, type PackOptions, type PackedAtlas, type PackedPage, type PackedRect, type RenderOptions, type RenderedFrames, type ResolvedModel, type ResolvedSprite, ResourceKind, type ResourceKindName, ResourceLocator, type ResourceManager, type RunOptions, type RunResult, type StylesheetOptions, type Texture, TextureLoader, type TextureMeta, TextureResolutionError, type TintDefinition, UNKNOWN_MODEL, UNREGISTERED_TINTS, UnsafeJarError, VANILLA_BIOME_CLIMATES, boxDownscale, buildBiomeClimates, buildBlockTints, buildObjMesh, builtinDynamicResources, collectModels, compareVersions, createAtlasResolver, defaultProperties, discoverItems, encodeAnimatedIcon, encodeIcon, eraForVersion, evaluateBlockState, evaluateItemModel, exportBlockPack, generateStylesheet, isUnsafeEntryPath, itemClass, lightsForProfile, matchesCondition, minifyStylesheet, packAtlas, parseAtlasSources, parseBiomeClimate, parseBlockState, parseTintValue, pointResize, prepareModResources, prepareVersionResources, renderModel, renderModelFrames, resolveItem, resolveTexture, resolveTint, resolveTints, run, salvageJson, toByteTexture, toFloatTexture, weightedVariantIndex };
|
package/dist/index.js
CHANGED
|
@@ -4,17 +4,17 @@ import { a as parseBlockState, i as matchesCondition, n as collectModels, o as w
|
|
|
4
4
|
import { c as toByteTexture, l as toFloatTexture } from "./blend-KXMclcHk.js";
|
|
5
5
|
import { c as lightsForProfile, r as LightingProfile } from "./lighting--5myudVu.js";
|
|
6
6
|
import { a as salvageJson, i as resolveTexture, n as ModelResolutionError, t as ModelLoader } from "./loader-C-NuJaEi.js";
|
|
7
|
-
import { a as ItemRenderError, c as renderModel, l as renderModelFrames, o as boxDownscale, s as pointResize } from "./obj-
|
|
7
|
+
import { a as ItemRenderError, c as renderModel, l as renderModelFrames, o as boxDownscale, s as pointResize } from "./obj-LWuJIAIM.js";
|
|
8
8
|
import { a as defaultProperties, i as UNKNOWN_MODEL, n as InvalidItemDefinitionError, o as evaluateItemModel } from "./definition-ColsvWrH.js";
|
|
9
9
|
import { i as resolveItem, n as discoverItems, t as ItemResolutionError } from "./discovery-CD0QqxSF.js";
|
|
10
10
|
import { a as resolveTints, i as resolveTint, n as InvalidTinterDefinitionError, r as parseTintValue, t as DYE_COLORS } from "./tints-B3WQcPtx.js";
|
|
11
|
-
import { n as buildObjMesh, t as ObjMeshError } from "./obj-mesh-
|
|
11
|
+
import { n as buildObjMesh, t as ObjMeshError } from "./obj-mesh-CZsmCk-p.js";
|
|
12
12
|
import { t as packAtlas } from "./atlas-pack-CoOih7By.js";
|
|
13
13
|
import { n as buildBlockTints, t as UNREGISTERED_TINTS } from "./tints-Cl0r-Ol3.js";
|
|
14
14
|
import { o as createAtlasResolver, s as parseAtlasSources, t as AtlasSourceError } from "./sources-BlUriDCs.js";
|
|
15
15
|
import { n as LayeredResourceManager, r as ResourceKind, t as FolderResourceManager } from "./manager-BNibYkmI.js";
|
|
16
16
|
import { n as TextureLoader, r as TextureResolutionError, t as AnimatedTexture } from "./loader-C18GpurU.js";
|
|
17
|
-
import { t as exportBlockPack } from "./export-
|
|
17
|
+
import { t as exportBlockPack } from "./export-CxocMT1x.js";
|
|
18
18
|
import { n as UnsafeJarError, r as isUnsafeEntryPath, t as JarResourceManager } from "./jar-W2cV2ZVO.js";
|
|
19
19
|
import { n as prepareModResources } from "./prepare-Myd_ec4v.js";
|
|
20
20
|
import { a as prepareVersionResources, i as eraForVersion, r as compareVersions } from "./prepare-D49Gu4Lv.js";
|
|
@@ -22,5 +22,5 @@ import { n as encodeIcon, t as encodeAnimatedIcon } from "./encode-LR9wxigC.js";
|
|
|
22
22
|
import { a as builtinDynamicResources } from "./generators-BCZVlWig.js";
|
|
23
23
|
import { t as minifyStylesheet } from "./minify-bjMRmr5J.js";
|
|
24
24
|
import { n as itemClass, t as generateStylesheet } from "./stylesheet-CovT3B2S.js";
|
|
25
|
-
import { t as run } from "./run-
|
|
25
|
+
import { t as run } from "./run-CGcHj_qq.js";
|
|
26
26
|
export { AnimatedTexture, AtlasSourceError, BlockStateError, DEFAULT_WATER_COLOR, DYE_COLORS, FolderResourceManager, InvalidItemDefinitionError, InvalidResourceLocatorError, InvalidTinterDefinitionError, ItemRenderError, ItemResolutionError, JarResourceManager, LayeredResourceManager, LightingProfile, ModelLoader, ModelResolutionError, ObjMeshError, ResourceKind, ResourceLocator, TextureLoader, TextureResolutionError, UNKNOWN_MODEL, UNREGISTERED_TINTS, UnsafeJarError, VANILLA_BIOME_CLIMATES, boxDownscale, buildBiomeClimates, buildBlockTints, buildObjMesh, builtinDynamicResources, collectModels, compareVersions, createAtlasResolver, defaultProperties, discoverItems, encodeAnimatedIcon, encodeIcon, eraForVersion, evaluateBlockState, evaluateItemModel, exportBlockPack, generateStylesheet, isUnsafeEntryPath, itemClass, lightsForProfile, matchesCondition, minifyStylesheet, packAtlas, parseAtlasSources, parseBiomeClimate, parseBlockState, parseTintValue, pointResize, prepareModResources, prepareVersionResources, renderModel, renderModelFrames, resolveItem, resolveTexture, resolveTint, resolveTints, run, salvageJson, toByteTexture, toFloatTexture, weightedVariantIndex };
|
|
@@ -4,9 +4,9 @@ import { c as normalize, g as transformVector, m as sub, n as displayMatrix, o a
|
|
|
4
4
|
import { c as lightsForProfile } from "./lighting--5myudVu.js";
|
|
5
5
|
import { a as drawTexturedTriangle, i as createFaceBuffer, n as clearFaceBuffer, o as phpRound, t as RowCursor } from "./rasterizer-DcVJzkxz.js";
|
|
6
6
|
import { t as combineFaceBuffers } from "./compose-BGsNFR12.js";
|
|
7
|
-
import { n as faceMaxZ, r as renderFace, t as createShadeCache } from "./face-
|
|
7
|
+
import { n as faceMaxZ, r as renderFace, t as createShadeCache } from "./face-DbyyYmzp.js";
|
|
8
8
|
import { t as paintBucketFluid } from "./fluid-bucket-B-I4ZYHl.js";
|
|
9
|
-
import { r as buildElementFaces } from "./geometry-
|
|
9
|
+
import { r as buildElementFaces } from "./geometry-bUDBhncX.js";
|
|
10
10
|
import { i as resolveTexture } from "./loader-C-NuJaEi.js";
|
|
11
11
|
//#region src/render/renderer.ts
|
|
12
12
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as ResourceLocator } from "./locator-COMEtEn9.js";
|
|
2
|
-
import { n as parseMtl, r as parseObj, t as materialTexture } from "./obj-
|
|
2
|
+
import { n as parseMtl, r as parseObj, t as materialTexture } from "./obj-LWuJIAIM.js";
|
|
3
3
|
//#region src/blocks/obj-mesh.ts
|
|
4
4
|
/**
|
|
5
5
|
* OBJ geometry as pack data.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as ResourceManager } from "./manager-exOIcdyx.js";
|
|
2
2
|
import { n as FloatTexture } from "./blend-eT64Z6qm.js";
|
|
3
3
|
import { a as LightingProfileName } from "./lighting-3FGRC3Af.js";
|
|
4
|
-
import { n as AnimationLimits } from "./renderer-
|
|
4
|
+
import { n as AnimationLimits } from "./renderer-CjreM6tk.js";
|
|
5
5
|
//#region src/render/pipeline.d.ts
|
|
6
6
|
interface PipelineSettings {
|
|
7
7
|
builtin?: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as ResourceLocator } from "./locator-COMEtEn9.js";
|
|
2
2
|
import { l as toFloatTexture, t as blendPixel } from "./blend-KXMclcHk.js";
|
|
3
3
|
import { t as ModelLoader } from "./loader-C-NuJaEi.js";
|
|
4
|
-
import { c as renderModel, l as renderModelFrames, o as boxDownscale, s as pointResize } from "./obj-
|
|
5
|
-
import { a as renderGeo, t as findGeoForItem } from "./geo-
|
|
4
|
+
import { c as renderModel, l as renderModelFrames, o as boxDownscale, s as pointResize } from "./obj-LWuJIAIM.js";
|
|
5
|
+
import { a as renderGeo, t as findGeoForItem } from "./geo-BoDxwvz5.js";
|
|
6
6
|
import { a as defaultProperties } from "./definition-ColsvWrH.js";
|
|
7
7
|
import { i as resolveItem } from "./discovery-CD0QqxSF.js";
|
|
8
8
|
import { a as resolveTints } from "./tints-B3WQcPtx.js";
|
|
@@ -11,7 +11,7 @@ import { n as LayeredResourceManager, t as FolderResourceManager } from "./manag
|
|
|
11
11
|
import { n as TextureLoader } from "./loader-C18GpurU.js";
|
|
12
12
|
import { t as encodeAnimatedIcon } from "./encode-LR9wxigC.js";
|
|
13
13
|
import { a as builtinDynamicResources } from "./generators-BCZVlWig.js";
|
|
14
|
-
import { a as spawnEggTints, i as renderEntityFallback, n as dyedVariantTint, r as renderDyedVariantFallback, t as dyeVariantName } from "./entity-fallback-
|
|
14
|
+
import { a as spawnEggTints, i as renderEntityFallback, n as dyedVariantTint, r as renderDyedVariantFallback, t as dyeVariantName } from "./entity-fallback-BRMFKPlM.js";
|
|
15
15
|
import { t as legacyTintsForChain } from "./legacy-tints-l-541wgI.js";
|
|
16
16
|
import { n as defaultBlockStateModel, t as blockStateTransform } from "./blockstate-DVb8Mhxc.js";
|
|
17
17
|
import path from "node:path";
|
|
@@ -2,8 +2,8 @@ import { a as ResourceManager } from "../manager-exOIcdyx.js";
|
|
|
2
2
|
import { i as TextureLoader } from "../loader-DUlx29PC.js";
|
|
3
3
|
import { t as ModelLoader } from "../loader-DSir1-P0.js";
|
|
4
4
|
import { n as FloatTexture } from "../blend-eT64Z6qm.js";
|
|
5
|
-
import { r as TintColor } from "../face-
|
|
6
|
-
import { i as RenderOptions } from "../renderer-
|
|
5
|
+
import { r as TintColor } from "../face-1cIObOfs.js";
|
|
6
|
+
import { i as RenderOptions } from "../renderer-CjreM6tk.js";
|
|
7
7
|
//#region src/render/entity-fallback.d.ts
|
|
8
8
|
/** The dye name a `<dye>_<thing>` mod item is prefixed with, or null. */
|
|
9
9
|
declare function dyeVariantName(id: string): string | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as spawnEggTints, i as renderEntityFallback, n as dyedVariantTint, r as renderDyedVariantFallback, t as dyeVariantName } from "../entity-fallback-
|
|
1
|
+
import { a as spawnEggTints, i as renderEntityFallback, n as dyedVariantTint, r as renderDyedVariantFallback, t as dyeVariantName } from "../entity-fallback-BRMFKPlM.js";
|
|
2
2
|
export { dyeVariantName, dyedVariantTint, renderDyedVariantFallback, renderEntityFallback, spawnEggTints };
|
package/dist/render/face.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as faceMaxZ, i as createShadeCache, n as RenderableFace, o as renderFace, r as TintColor, t as FaceShadeCache } from "../face-
|
|
1
|
+
import { a as faceMaxZ, i as createShadeCache, n as RenderableFace, o as renderFace, r as TintColor, t as FaceShadeCache } from "../face-1cIObOfs.js";
|
|
2
2
|
export { FaceShadeCache, RenderableFace, TintColor, createShadeCache, faceMaxZ, renderFace };
|
package/dist/render/face.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as faceMaxZ, r as renderFace, t as createShadeCache } from "../face-
|
|
1
|
+
import { n as faceMaxZ, r as renderFace, t as createShadeCache } from "../face-DbyyYmzp.js";
|
|
2
2
|
export { createShadeCache, faceMaxZ, renderFace };
|
package/dist/render/geo.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as parseGeo, i as nameTokens, n as findGeoForItem, o as renderGeo, r as geoToFaces, t as ParsedGeo } from "../geo-
|
|
1
|
+
import { a as parseGeo, i as nameTokens, n as findGeoForItem, o as renderGeo, r as geoToFaces, t as ParsedGeo } from "../geo-BjvgFB90.js";
|
|
2
2
|
export { ParsedGeo, findGeoForItem, geoToFaces, nameTokens, parseGeo, renderGeo };
|
package/dist/render/geo.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as renderGeo, i as parseGeo, n as geoToFaces, r as nameTokens, t as findGeoForItem } from "../geo-
|
|
1
|
+
import { a as renderGeo, i as parseGeo, n as geoToFaces, r as nameTokens, t as findGeoForItem } from "../geo-BoDxwvz5.js";
|
|
2
2
|
export { findGeoForItem, geoToFaces, nameTokens, parseGeo, renderGeo };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as buildElementFaces, n as FaceGeometry, r as applyElementRotation, t as FACE_NORMALS } from "../geometry
|
|
1
|
+
import { i as buildElementFaces, n as FaceGeometry, r as applyElementRotation, t as FACE_NORMALS } from "../geometry--UzHu1Vh.js";
|
|
2
2
|
export { FACE_NORMALS, FaceGeometry, applyElementRotation, buildElementFaces };
|
package/dist/render/geometry.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as applyElementRotation, r as buildElementFaces, t as FACE_NORMALS } from "../geometry-
|
|
1
|
+
import { n as applyElementRotation, r as buildElementFaces, t as FACE_NORMALS } from "../geometry-bUDBhncX.js";
|
|
2
2
|
export { FACE_NORMALS, applyElementRotation, buildElementFaces };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as TextureLoader } from "../loader-DUlx29PC.js";
|
|
2
|
-
import { r as TintColor } from "../face-
|
|
2
|
+
import { r as TintColor } from "../face-1cIObOfs.js";
|
|
3
3
|
//#region src/render/legacy-tints.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Tints for a model rendered without an item definition (pre-1.21.4 eras and
|
package/dist/render/obj.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { i as TextureLoader } from "../loader-DUlx29PC.js";
|
|
|
4
4
|
import { r as ResolvedModel } from "../loader-DSir1-P0.js";
|
|
5
5
|
import { n as FloatTexture } from "../blend-eT64Z6qm.js";
|
|
6
6
|
import { n as Vec3 } from "../vector-DRKRi4--.js";
|
|
7
|
-
import { i as RenderOptions } from "../renderer-
|
|
7
|
+
import { i as RenderOptions } from "../renderer-CjreM6tk.js";
|
|
8
8
|
//#region src/render/obj.d.ts
|
|
9
9
|
interface ObjTriangle {
|
|
10
10
|
positions: [Vec3, Vec3, Vec3];
|
package/dist/render/obj.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as renderObjModel, n as parseMtl, r as parseObj, t as materialTexture } from "../obj-
|
|
1
|
+
import { i as renderObjModel, n as parseMtl, r as parseObj, t as materialTexture } from "../obj-LWuJIAIM.js";
|
|
2
2
|
export { materialTexture, parseMtl, parseObj, renderObjModel };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as RenderedFrames, n as ItemRenderOutcome, r as PipelineSettings, t as ItemPipeline } from "../pipeline-
|
|
1
|
+
import { i as RenderedFrames, n as ItemRenderOutcome, r as PipelineSettings, t as ItemPipeline } from "../pipeline-C7pN0yko.js";
|
|
2
2
|
export { ItemPipeline, ItemRenderOutcome, PipelineSettings, RenderedFrames };
|
package/dist/render/pipeline.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as ItemPipeline } from "../pipeline-
|
|
1
|
+
import { t as ItemPipeline } from "../pipeline-CjRcZB63.js";
|
|
2
2
|
export { ItemPipeline };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as RenderedFrames, c as renderModel, i as RenderOptions, l as renderModelFrames, n as AnimationLimits, o as boxDownscale, r as ItemRenderError, s as pointResize, t as AnimationDiagnostics } from "../renderer-
|
|
1
|
+
import { a as RenderedFrames, c as renderModel, i as RenderOptions, l as renderModelFrames, n as AnimationLimits, o as boxDownscale, r as ItemRenderError, s as pointResize, t as AnimationDiagnostics } from "../renderer-CjreM6tk.js";
|
|
2
2
|
export { AnimationDiagnostics, AnimationLimits, ItemRenderError, RenderOptions, RenderedFrames, boxDownscale, pointResize, renderModel, renderModelFrames };
|
package/dist/render/renderer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ItemRenderError, c as renderModel, l as renderModelFrames, o as boxDownscale, s as pointResize } from "../obj-
|
|
1
|
+
import { a as ItemRenderError, c as renderModel, l as renderModelFrames, o as boxDownscale, s as pointResize } from "../obj-LWuJIAIM.js";
|
|
2
2
|
export { ItemRenderError, boxDownscale, pointResize, renderModel, renderModelFrames };
|
package/dist/render/tints.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as resolveTint, i as parseTintValue, n as InvalidTinterDefinitionError, o as resolveTints, r as TintContext, t as DYE_COLORS } from "../tints-
|
|
1
|
+
import { a as resolveTint, i as parseTintValue, n as InvalidTinterDefinitionError, o as resolveTints, r as TintContext, t as DYE_COLORS } from "../tints-iPf8hSKX.js";
|
|
2
2
|
export { DYE_COLORS, InvalidTinterDefinitionError, TintContext, parseTintValue, resolveTint, resolveTints };
|
|
@@ -4,7 +4,7 @@ import { r as ResolvedModel } from "./loader-DSir1-P0.js";
|
|
|
4
4
|
import { n as FloatTexture } from "./blend-eT64Z6qm.js";
|
|
5
5
|
import { t as Mat4 } from "./vector-DRKRi4--.js";
|
|
6
6
|
import { a as LightingProfileName } from "./lighting-3FGRC3Af.js";
|
|
7
|
-
import { r as TintColor } from "./face-
|
|
7
|
+
import { r as TintColor } from "./face-1cIObOfs.js";
|
|
8
8
|
//#region src/render/renderer.d.ts
|
|
9
9
|
interface AnimationLimits {
|
|
10
10
|
/** Emitted frames per icon (default 128). */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as ResourceManager } from "./manager-exOIcdyx.js";
|
|
2
2
|
import { a as LightingProfileName } from "./lighting-3FGRC3Af.js";
|
|
3
|
-
import { n as AnimationLimits } from "./renderer-
|
|
3
|
+
import { n as AnimationLimits } from "./renderer-CjreM6tk.js";
|
|
4
4
|
//#region src/run.d.ts
|
|
5
5
|
interface RunOptions {
|
|
6
6
|
resources: ResourceManager;
|
|
@@ -6,7 +6,7 @@ import { r as encodeRasterAsset } from "./encode-LR9wxigC.js";
|
|
|
6
6
|
import { t as classifyItemStyle } from "./item-styles-DjYRdyHi.js";
|
|
7
7
|
import { t as minifyStylesheet } from "./minify-bjMRmr5J.js";
|
|
8
8
|
import { t as generateStylesheet } from "./stylesheet-CovT3B2S.js";
|
|
9
|
-
import { t as ItemPipeline } from "./pipeline-
|
|
9
|
+
import { t as ItemPipeline } from "./pipeline-CjRcZB63.js";
|
|
10
10
|
import { t as describeResources } from "./descriptor-JyXhfd-c.js";
|
|
11
11
|
import { t as WorkerRenderPool } from "./pool-CKGp1qup.js";
|
|
12
12
|
import path from "node:path";
|
package/dist/run.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { l as evaluateItemModel } from "./definition-ricL7Jqf.js";
|
|
2
|
-
import { i as run, n as RunOptions, r as RunResult, t as ItemFailure } from "./run-
|
|
2
|
+
import { i as run, n as RunOptions, r as RunResult, t as ItemFailure } from "./run-BgXZp8VQ.js";
|
|
3
3
|
export { ItemFailure, RunOptions, RunResult, evaluateItemModel, run };
|
package/dist/run.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as TextureLoader } from "./loader-DUlx29PC.js";
|
|
2
|
-
import { r as TintColor } from "./face-
|
|
2
|
+
import { r as TintColor } from "./face-1cIObOfs.js";
|
|
3
3
|
import { o as TintDefinition } from "./definition-ricL7Jqf.js";
|
|
4
4
|
//#region src/render/tints.d.ts
|
|
5
5
|
declare class InvalidTinterDefinitionError extends Error {}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { s as ResourceDescriptor } from "../manager-exOIcdyx.js";
|
|
2
|
-
import { n as ItemRenderOutcome, r as PipelineSettings } from "../pipeline-
|
|
2
|
+
import { n as ItemRenderOutcome, r as PipelineSettings } from "../pipeline-C7pN0yko.js";
|
|
3
3
|
//#region src/workers/render-worker.d.ts
|
|
4
4
|
interface RenderWorkerData {
|
|
5
5
|
resources: ResourceDescriptor;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as ItemPipeline } from "../pipeline-
|
|
1
|
+
import { t as ItemPipeline } from "../pipeline-CjRcZB63.js";
|
|
2
2
|
import { n as restoreResources } from "../descriptor-JyXhfd-c.js";
|
|
3
3
|
import sharp from "sharp";
|
|
4
4
|
import { parentPort, workerData } from "node:worker_threads";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nodecraft/rendermite",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.7",
|
|
4
4
|
"description": "Minecraft item icon renderer: renders inventory-identical item icons from vanilla and modded assets across game versions, outputting optimized PNG/WebP/AVIF plus CSS and a JSON item library.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -192,11 +192,11 @@ function applyElementRotation(rotation, corners) {
|
|
|
192
192
|
rotation.origin[2] / 16
|
|
193
193
|
];
|
|
194
194
|
const toRadians = Math.PI / 180;
|
|
195
|
-
const multiAxis = rotation;
|
|
196
195
|
if (rotation.axis !== void 0 && rotation.angle !== void 0) {
|
|
197
196
|
rotateAll(corners, origin, rotation.axis, rotation.angle * toRadians);
|
|
198
197
|
return;
|
|
199
198
|
}
|
|
199
|
+
const multiAxis = rotation;
|
|
200
200
|
for (const axis of [
|
|
201
201
|
"x",
|
|
202
202
|
"y",
|