@nodecraft/rendermite 1.6.4 → 1.6.6
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.d.ts +10 -0
- package/dist/blocks/ender-storage.js +2 -0
- 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/item-sprites.js +1 -1
- package/dist/blocks/obj-mesh.js +1 -1
- package/dist/{cli-DUWWH_Rc.js → cli-BtVAPg1-.js} +1 -1
- package/dist/cli.js +2 -2
- package/dist/ender-storage-a36r-lF0.js +58 -0
- package/dist/entities/geo-model.d.ts +1 -1
- package/dist/{entity-fallback-BcJWh91-.js → entity-fallback-u9z3oQcv.js} +1 -1
- package/dist/{entity-geo-B2CkuMWx.js → entity-geo-Bh409352.js} +1 -1
- package/dist/{entity-models-D_QGok9j.js → entity-models-Bkikeu3U.js} +1 -1
- package/dist/{export-CBXWRbBw.js → export-DFWU9IAs.js} +58 -25
- package/dist/{geo-Desq-gRC.js → geo-DEsTheXx.js} +5 -4
- package/dist/{geo-CmjrXu0G.d.ts → geo-Dpj_am7d.d.ts} +3 -1
- package/dist/{geo-blocks-CzkfL4Li.js → geo-blocks-BG3cxCdf.js} +28 -10
- package/dist/index.js +5 -5
- package/dist/{obj-CJHEHpki.js → obj-bvs3gwex.js} +4 -4
- package/dist/{obj-mesh-JwPkZEWL.js → obj-mesh-rnYbSbpv.js} +1 -1
- package/dist/{pipeline-7rvL6vx1.js → pipeline-D5RhufFu.js} +4 -4
- package/dist/render/entity-fallback.js +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/obj.js +1 -1
- package/dist/render/pipeline.js +1 -1
- package/dist/render/renderer.js +1 -1
- package/dist/{run-BXAqZ5qY.js → run-IOLCDxk5.js} +1 -1
- package/dist/run.js +1 -1
- package/dist/workers/render-worker.js +1 -1
- package/package.json +1 -1
- package/dist/{face-B2JjWT46.js → face-CKHboPfh.js} +1 -1
- package/dist/{item-sprites-G-yikdfV.js → item-sprites-CnCH8YFv.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-BtVAPg1-.js";
|
|
2
2
|
export { runBlocksCli };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { a as ResourceManager } from "../manager-exOIcdyx.js";
|
|
2
|
+
import { f as BlockPackModel } from "../pack-format-QcVFxG_b.js";
|
|
3
|
+
//#region src/blocks/ender-storage.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Ender Storage feeds this OBJ through CodeChickenLib's `swapYZ`, translates it almost exactly onto
|
|
6
|
+
* the block centre, and takes a backfaced copy so its glass/frame can be seen from either side.
|
|
7
|
+
*/
|
|
8
|
+
declare function enderStorageBlockModel(blockId: string, resources: ResourceManager): Promise<BlockPackModel | null>;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { enderStorageBlockModel };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as findGeoForEntity } from "../entity-geo-
|
|
1
|
+
import { t as findGeoForEntity } from "../entity-geo-Bh409352.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-Bkikeu3U.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-DFWU9IAs.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-BG3cxCdf.js";
|
|
2
2
|
export { geoBlockModel };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as collectItemSprites } from "../item-sprites-
|
|
1
|
+
import { t as collectItemSprites } from "../item-sprites-CnCH8YFv.js";
|
|
2
2
|
export { collectItemSprites };
|
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-rnYbSbpv.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-DFWU9IAs.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-BtVAPg1-.js";
|
|
10
|
+
import { t as run } from "./run-IOLCDxk5.js";
|
|
11
11
|
import path from "node:path";
|
|
12
12
|
import os from "node:os";
|
|
13
13
|
import { parseArgs } from "node:util";
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { n as ResourceLocator } from "./locator-COMEtEn9.js";
|
|
2
|
+
import { r as parseObj } from "./obj-bvs3gwex.js";
|
|
3
|
+
//#region src/blocks/ender-storage.ts
|
|
4
|
+
/** Geometry for Ender Storage blocks whose shipped JSON model is only an empty Java-renderer hook. */
|
|
5
|
+
const BLOCK_UNITS = 16;
|
|
6
|
+
function rounded(value, places) {
|
|
7
|
+
const factor = 10 ** places;
|
|
8
|
+
return Math.round(value * factor) / factor;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Ender Storage feeds this OBJ through CodeChickenLib's `swapYZ`, translates it almost exactly onto
|
|
12
|
+
* the block centre, and takes a backfaced copy so its glass/frame can be seen from either side.
|
|
13
|
+
*/
|
|
14
|
+
async function enderStorageBlockModel(blockId, resources) {
|
|
15
|
+
if (blockId !== "enderstorage:ender_tank") return null;
|
|
16
|
+
const source = await resources.getResource("raw", new ResourceLocator("enderstorage", "models/endertank.obj"));
|
|
17
|
+
if (!source) return null;
|
|
18
|
+
const parsed = parseObj(source.toString("utf8"), true);
|
|
19
|
+
if (parsed.triangles.length === 0) return null;
|
|
20
|
+
const groups = /* @__PURE__ */ new Map();
|
|
21
|
+
for (const triangle of parsed.triangles) {
|
|
22
|
+
const object = triangle.object || void 0;
|
|
23
|
+
const key = object ?? "";
|
|
24
|
+
let group = groups.get(key);
|
|
25
|
+
if (!group) {
|
|
26
|
+
group = {
|
|
27
|
+
sprite: "enderstorage:endertank",
|
|
28
|
+
...object && { object },
|
|
29
|
+
positions: [],
|
|
30
|
+
uv: []
|
|
31
|
+
};
|
|
32
|
+
groups.set(key, group);
|
|
33
|
+
}
|
|
34
|
+
for (const order of [[
|
|
35
|
+
0,
|
|
36
|
+
1,
|
|
37
|
+
2
|
|
38
|
+
], [
|
|
39
|
+
2,
|
|
40
|
+
1,
|
|
41
|
+
0
|
|
42
|
+
]]) for (const corner of order) {
|
|
43
|
+
const [positionX, positionY, positionZ] = triangle.positions[corner];
|
|
44
|
+
group.positions.push(rounded((positionX - .0099) * BLOCK_UNITS, 3), rounded(positionZ * BLOCK_UNITS, 3), rounded((positionY - .0027) * BLOCK_UNITS, 3));
|
|
45
|
+
const [textureU, textureV] = triangle.uvs[corner];
|
|
46
|
+
group.uv.push(rounded(textureU * BLOCK_UNITS, 4), rounded(textureV * BLOCK_UNITS, 4));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
ao: true,
|
|
51
|
+
elements: [],
|
|
52
|
+
particle: "enderstorage:endertank",
|
|
53
|
+
mesh: groups.values().toArray().toSorted((left, right) => (left.object ?? "").localeCompare(right.object ?? "")),
|
|
54
|
+
renderType: "cutout"
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
export { enderStorageBlockModel as t };
|
|
@@ -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-bvs3gwex.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-DEsTheXx.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-Bh409352.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";
|
|
@@ -2,13 +2,14 @@ import { r as buildBiomeClimates } from "./biomes-5ZwYxMYe.js";
|
|
|
2
2
|
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
|
+
import { a as salvageJson, i as resolveTexture, t as ModelLoader } from "./loader-C-NuJaEi.js";
|
|
6
|
+
import { t as enderStorageBlockModel } from "./ender-storage-a36r-lF0.js";
|
|
5
7
|
import { t as collectEntities } from "./entities-DubtdM11.js";
|
|
6
|
-
import { t as collectEntityGeometry } from "./entity-models-
|
|
7
|
-
import { t as geoBlockModel } from "./geo-blocks-
|
|
8
|
+
import { t as collectEntityGeometry } from "./entity-models-Bkikeu3U.js";
|
|
9
|
+
import { t as geoBlockModel } from "./geo-blocks-BG3cxCdf.js";
|
|
8
10
|
import { n as discoverItems } from "./discovery-CD0QqxSF.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { n as buildObjMesh } from "./obj-mesh-JwPkZEWL.js";
|
|
11
|
+
import { t as collectItemSprites } from "./item-sprites-CnCH8YFv.js";
|
|
12
|
+
import { n as buildObjMesh } from "./obj-mesh-rnYbSbpv.js";
|
|
12
13
|
import { n as buildSpriteSheet, t as MISSING_SPRITE } from "./sprite-sheet-LQAEtGkp.js";
|
|
13
14
|
import { n as buildBlockTints, t as UNREGISTERED_TINTS } from "./tints-Cl0r-Ol3.js";
|
|
14
15
|
import { t as loadAtlasResolver } from "./registry-DlduyjtM.js";
|
|
@@ -77,22 +78,25 @@ const EXTRA_FLUID_SPRITES = ["minecraft:block/water_overlay"];
|
|
|
77
78
|
* models are therefore unreachable from `collectModels`, even though a consumer has enough NBT to
|
|
78
79
|
* reconstruct it. Keep the small, stable texture vocabulary in the atlas for that renderer.
|
|
79
80
|
*/
|
|
80
|
-
const DYNAMIC_BLOCK_ENTITY_SPRITES = {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
81
|
+
const DYNAMIC_BLOCK_ENTITY_SPRITES = {
|
|
82
|
+
ae2: [
|
|
83
|
+
"ae2:part/cable/glass/transparent",
|
|
84
|
+
"ae2:part/cable/covered/transparent",
|
|
85
|
+
"ae2:part/cable/smart/transparent",
|
|
86
|
+
"ae2:part/cable/dense_covered/transparent",
|
|
87
|
+
"ae2:part/cable/dense_smart/transparent",
|
|
88
|
+
"ae2:part/storage_bus",
|
|
89
|
+
"ae2:part/storage_bus_back",
|
|
90
|
+
"ae2:part/storage_bus_sides",
|
|
91
|
+
"ae2:part/import_bus",
|
|
92
|
+
"ae2:part/import_bus_sides",
|
|
93
|
+
"ae2:part/export_bus",
|
|
94
|
+
"ae2:part/export_bus_sides",
|
|
95
|
+
"ae2:part/monitor_back",
|
|
96
|
+
"ae2:part/monitor_sides_status"
|
|
97
|
+
],
|
|
98
|
+
enderstorage: ["enderstorage:buttons", "enderstorage:hedronmap"]
|
|
99
|
+
};
|
|
96
100
|
/**
|
|
97
101
|
* Vanilla's `BlockElement.uvsByFace`: the UV a face gets when the model states
|
|
98
102
|
* none. Deliberately not `render/geometry.ts`'s auto-UVs — those are in the
|
|
@@ -416,14 +420,43 @@ async function exportBlockPack(options) {
|
|
|
416
420
|
modelTintIndices.set(reference, tintIndices);
|
|
417
421
|
for (const sprite of sprites) spriteIds.add(sprite);
|
|
418
422
|
}
|
|
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: 270,
|
|
436
|
+
south: 180,
|
|
437
|
+
west: 90
|
|
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);
|
|
451
|
+
}
|
|
419
452
|
for (const [id, references] of blockModels) {
|
|
420
|
-
const
|
|
421
|
-
if (!
|
|
453
|
+
const enderStorage = await enderStorageBlockModel(id, resources);
|
|
454
|
+
if (!enderStorage) continue;
|
|
422
455
|
for (const reference of references) {
|
|
423
|
-
emittedModels[reference] =
|
|
456
|
+
emittedModels[reference] = enderStorage;
|
|
424
457
|
modelTintIndices.set(reference, /* @__PURE__ */ new Set());
|
|
425
458
|
}
|
|
426
|
-
for (const group of
|
|
459
|
+
for (const group of enderStorage.mesh ?? []) spriteIds.add(group.sprite);
|
|
427
460
|
}
|
|
428
461
|
for (const [id, references] of blockModels) {
|
|
429
462
|
if (references.some((reference) => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { n as ResourceLocator } from "./locator-COMEtEn9.js";
|
|
2
2
|
import { l as toFloatTexture } from "./blend-KXMclcHk.js";
|
|
3
|
-
import { t as combineFaceBuffers } from "./compose-BGsNFR12.js";
|
|
4
|
-
import { i as createFaceBuffer } from "./rasterizer-DcVJzkxz.js";
|
|
5
3
|
import { n as displayMatrix } from "./vector-CCxLae_T.js";
|
|
6
|
-
import { n as faceMaxZ, r as renderFace, t as createShadeCache } from "./face-B2JjWT46.js";
|
|
7
4
|
import { c as lightsForProfile } from "./lighting--5myudVu.js";
|
|
5
|
+
import { i as createFaceBuffer } from "./rasterizer-DcVJzkxz.js";
|
|
6
|
+
import { t as combineFaceBuffers } from "./compose-BGsNFR12.js";
|
|
7
|
+
import { n as faceMaxZ, r as renderFace, t as createShadeCache } from "./face-CKHboPfh.js";
|
|
8
8
|
//#region src/render/geo.ts
|
|
9
9
|
/**
|
|
10
10
|
* Bedrock-format geometry (`.geo.json`) rendering, best-effort. GeckoLib mods
|
|
@@ -160,7 +160,7 @@ function boxFaces(origin, size, u, v) {
|
|
|
160
160
|
];
|
|
161
161
|
}
|
|
162
162
|
/** Convert a parsed geo into face geometry, unit-cube fitted with gui pose. */
|
|
163
|
-
function geoToFaces(geo) {
|
|
163
|
+
function geoToFaces(geo, options = {}) {
|
|
164
164
|
const bonesByName = /* @__PURE__ */ new Map();
|
|
165
165
|
for (const bone of geo.bones) if (bone.name) bonesByName.set(bone.name, bone);
|
|
166
166
|
const boneChain = (bone) => {
|
|
@@ -249,6 +249,7 @@ function geoToFaces(geo) {
|
|
|
249
249
|
}
|
|
250
250
|
const extent = Math.max(max[0] - min[0], max[1] - min[1], max[2] - min[2]);
|
|
251
251
|
if (!Number.isFinite(extent) || extent <= 0) return [];
|
|
252
|
+
if (options.fit === false) return faces;
|
|
252
253
|
const scale = 1 / extent;
|
|
253
254
|
const center = [
|
|
254
255
|
(min[0] + max[0]) / 2,
|
|
@@ -44,7 +44,9 @@ interface ParsedGeo {
|
|
|
44
44
|
/** Handles both the modern (1.12+) and legacy (`geometry.name` keyed) layouts. */
|
|
45
45
|
declare function parseGeo(json: GeoFile): ParsedGeo | null;
|
|
46
46
|
/** Convert a parsed geo into face geometry, unit-cube fitted with gui pose. */
|
|
47
|
-
declare function geoToFaces(geo: ParsedGeo
|
|
47
|
+
declare function geoToFaces(geo: ParsedGeo, options?: {
|
|
48
|
+
fit?: boolean;
|
|
49
|
+
}): FaceGeometry[];
|
|
48
50
|
/** Conventional locations GeckoLib mods keep item geometry and textures. */
|
|
49
51
|
declare function findGeoForItem(resources: ResourceManager, id: string): Promise<{
|
|
50
52
|
geo: ParsedGeo;
|
|
@@ -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-DEsTheXx.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,7 +52,7 @@ async function geoBlockModel(blockId, resources) {
|
|
|
38
52
|
positions: [],
|
|
39
53
|
uv: []
|
|
40
54
|
};
|
|
41
|
-
for (const face of geoToFaces(geo)) {
|
|
55
|
+
for (const face of geoToFaces(geo, { fit: false })) {
|
|
42
56
|
const uvs = [
|
|
43
57
|
[face.uv1[0], face.uv1[1]],
|
|
44
58
|
[face.uv1[0], face.uv2[1]],
|
|
@@ -46,17 +60,21 @@ async function geoBlockModel(blockId, resources) {
|
|
|
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
|
package/dist/index.js
CHANGED
|
@@ -3,18 +3,18 @@ import { n as ResourceLocator, t as InvalidResourceLocatorError } from "./locato
|
|
|
3
3
|
import { a as parseBlockState, i as matchesCondition, n as collectModels, o as weightedVariantIndex, r as evaluateBlockState, t as BlockStateError } from "./blockstate-eval-BRQ3NWY2.js";
|
|
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
|
+
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-bvs3gwex.js";
|
|
6
8
|
import { a as defaultProperties, i as UNKNOWN_MODEL, n as InvalidItemDefinitionError, o as evaluateItemModel } from "./definition-ColsvWrH.js";
|
|
7
9
|
import { i as resolveItem, n as discoverItems, t as ItemResolutionError } from "./discovery-CD0QqxSF.js";
|
|
8
|
-
import { a as salvageJson, i as resolveTexture, n as ModelResolutionError, t as ModelLoader } from "./loader-C-NuJaEi.js";
|
|
9
10
|
import { a as resolveTints, i as resolveTint, n as InvalidTinterDefinitionError, r as parseTintValue, t as DYE_COLORS } from "./tints-B3WQcPtx.js";
|
|
10
|
-
import {
|
|
11
|
-
import { n as buildObjMesh, t as ObjMeshError } from "./obj-mesh-JwPkZEWL.js";
|
|
11
|
+
import { n as buildObjMesh, t as ObjMeshError } from "./obj-mesh-rnYbSbpv.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-DFWU9IAs.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-IOLCDxk5.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 };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { n as ResourceLocator } from "./locator-COMEtEn9.js";
|
|
2
2
|
import { l as toFloatTexture, n as cloneFloatTexture, r as darkenTexture, s as tintTexture, t as blendPixel } from "./blend-KXMclcHk.js";
|
|
3
|
-
import { t as combineFaceBuffers } from "./compose-BGsNFR12.js";
|
|
4
|
-
import { a as drawTexturedTriangle, i as createFaceBuffer, n as clearFaceBuffer, o as phpRound, t as RowCursor } from "./rasterizer-DcVJzkxz.js";
|
|
5
3
|
import { c as normalize, g as transformVector, m as sub, n as displayMatrix, o as identity, r as dot, s as multiply, t as cross } from "./vector-CCxLae_T.js";
|
|
6
|
-
import { n as faceMaxZ, r as renderFace, t as createShadeCache } from "./face-B2JjWT46.js";
|
|
7
4
|
import { c as lightsForProfile } from "./lighting--5myudVu.js";
|
|
8
|
-
import { i as
|
|
5
|
+
import { a as drawTexturedTriangle, i as createFaceBuffer, n as clearFaceBuffer, o as phpRound, t as RowCursor } from "./rasterizer-DcVJzkxz.js";
|
|
6
|
+
import { t as combineFaceBuffers } from "./compose-BGsNFR12.js";
|
|
7
|
+
import { n as faceMaxZ, r as renderFace, t as createShadeCache } from "./face-CKHboPfh.js";
|
|
9
8
|
import { t as paintBucketFluid } from "./fluid-bucket-B-I4ZYHl.js";
|
|
10
9
|
import { r as buildElementFaces } from "./geometry-Bi-Bf5rb.js";
|
|
10
|
+
import { i as resolveTexture } from "./loader-C-NuJaEi.js";
|
|
11
11
|
//#region src/render/renderer.ts
|
|
12
12
|
/**
|
|
13
13
|
* Item rendering entry: flat generated items (2D layer compositing) and 3D
|
|
@@ -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-bvs3gwex.js";
|
|
3
3
|
//#region src/blocks/obj-mesh.ts
|
|
4
4
|
/**
|
|
5
5
|
* OBJ geometry as pack data.
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { n as ResourceLocator } from "./locator-COMEtEn9.js";
|
|
2
2
|
import { l as toFloatTexture, t as blendPixel } from "./blend-KXMclcHk.js";
|
|
3
|
-
import {
|
|
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-bvs3gwex.js";
|
|
5
|
+
import { a as renderGeo, t as findGeoForItem } from "./geo-DEsTheXx.js";
|
|
4
6
|
import { a as defaultProperties } from "./definition-ColsvWrH.js";
|
|
5
7
|
import { i as resolveItem } from "./discovery-CD0QqxSF.js";
|
|
6
|
-
import { t as ModelLoader } from "./loader-C-NuJaEi.js";
|
|
7
8
|
import { a as resolveTints } from "./tints-B3WQcPtx.js";
|
|
8
|
-
import { c as renderModel, l as renderModelFrames, o as boxDownscale, s as pointResize } from "./obj-CJHEHpki.js";
|
|
9
9
|
import { t as loadAtlasResolver } from "./registry-DlduyjtM.js";
|
|
10
10
|
import { n as LayeredResourceManager, t as FolderResourceManager } from "./manager-BNibYkmI.js";
|
|
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-u9z3oQcv.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";
|
|
@@ -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-u9z3oQcv.js";
|
|
2
2
|
export { dyeVariantName, dyedVariantTint, renderDyedVariantFallback, renderEntityFallback, spawnEggTints };
|
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-CKHboPfh.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-Dpj_am7d.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-DEsTheXx.js";
|
|
2
2
|
export { findGeoForItem, geoToFaces, nameTokens, parseGeo, renderGeo };
|
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-bvs3gwex.js";
|
|
2
2
|
export { materialTexture, parseMtl, parseObj, renderObjModel };
|
package/dist/render/pipeline.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as ItemPipeline } from "../pipeline-
|
|
1
|
+
import { t as ItemPipeline } from "../pipeline-D5RhufFu.js";
|
|
2
2
|
export { ItemPipeline };
|
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-bvs3gwex.js";
|
|
2
2
|
export { ItemRenderError, boxDownscale, pointResize, renderModel, renderModelFrames };
|
|
@@ -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-D5RhufFu.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.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as ItemPipeline } from "../pipeline-
|
|
1
|
+
import { t as ItemPipeline } from "../pipeline-D5RhufFu.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.6",
|
|
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",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as scaleTextureAlpha, n as cloneFloatTexture, r as darkenTexture, s as tintTexture, u as uvWindow } from "./blend-KXMclcHk.js";
|
|
2
|
-
import { a as drawTexturedTriangle, i as createFaceBuffer, n as clearFaceBuffer, o as phpRound, r as compactFaceBuffer, t as RowCursor } from "./rasterizer-DcVJzkxz.js";
|
|
3
2
|
import { c as normalize, g as transformVector, h as transformDirection, m as sub, r as dot, t as cross } from "./vector-CCxLae_T.js";
|
|
3
|
+
import { a as drawTexturedTriangle, i as createFaceBuffer, n as clearFaceBuffer, o as phpRound, r as compactFaceBuffer, t as RowCursor } from "./rasterizer-DcVJzkxz.js";
|
|
4
4
|
//#region src/render/face.ts
|
|
5
5
|
/**
|
|
6
6
|
* Face rendering: cull, transform, project, tint, darken, rasterize — a faithful
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as resolveItem, r as langRegistry } from "./discovery-CD0QqxSF.js";
|
|
2
1
|
import { i as resolveTexture } from "./loader-C-NuJaEi.js";
|
|
2
|
+
import { i as resolveItem, r as langRegistry } from "./discovery-CD0QqxSF.js";
|
|
3
3
|
import { a as resolveTints } from "./tints-B3WQcPtx.js";
|
|
4
4
|
//#region src/blocks/item-sprites.ts
|
|
5
5
|
/**
|