@nodecraft/rendermite 1.6.5 → 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/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/{cli-AIYuxk4-.js → cli-BtVAPg1-.js} +1 -1
- package/dist/cli.js +2 -2
- package/dist/entities/geo-model.d.ts +1 -1
- package/dist/{entity-geo-B9QYodsa.js → entity-geo-Bh409352.js} +1 -1
- package/dist/{entity-models--KAShEPW.js → entity-models-Bkikeu3U.js} +1 -1
- package/dist/{export-DtLGTzd_.js → export-DFWU9IAs.js} +30 -10
- package/dist/{geo-Cl-1NZX5.js → geo-DEsTheXx.js} +2 -1
- package/dist/{geo-CmjrXu0G.d.ts → geo-Dpj_am7d.d.ts} +3 -1
- package/dist/{geo-blocks-DSqTryeM.js → geo-blocks-BG3cxCdf.js} +28 -10
- package/dist/index.js +2 -2
- package/dist/{pipeline-BO3ukdjt.js → pipeline-D5RhufFu.js} +1 -1
- package/dist/render/geo.d.ts +1 -1
- package/dist/render/geo.js +1 -1
- package/dist/render/pipeline.js +1 -1
- package/dist/{run-0EPZBeqT.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/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 };
|
|
@@ -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,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";
|
|
@@ -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";
|
|
@@ -5,8 +5,8 @@ import { a as parseBlockState, n as collectModels } from "./blockstate-eval-BRQ3
|
|
|
5
5
|
import { a as salvageJson, i as resolveTexture, t as ModelLoader } from "./loader-C-NuJaEi.js";
|
|
6
6
|
import { t as enderStorageBlockModel } from "./ender-storage-a36r-lF0.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-Bkikeu3U.js";
|
|
9
|
+
import { t as geoBlockModel } from "./geo-blocks-BG3cxCdf.js";
|
|
10
10
|
import { n as discoverItems } from "./discovery-CD0QqxSF.js";
|
|
11
11
|
import { t as collectItemSprites } from "./item-sprites-CnCH8YFv.js";
|
|
12
12
|
import { n as buildObjMesh } from "./obj-mesh-rnYbSbpv.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: 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);
|
|
431
451
|
}
|
|
432
452
|
for (const [id, references] of blockModels) {
|
|
433
453
|
const enderStorage = await enderStorageBlockModel(id, resources);
|
|
@@ -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
|
@@ -14,7 +14,7 @@ import { n as buildBlockTints, t as UNREGISTERED_TINTS } from "./tints-Cl0r-Ol3.
|
|
|
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 };
|
|
@@ -2,7 +2,7 @@ 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
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-
|
|
5
|
+
import { a as renderGeo, t as findGeoForItem } from "./geo-DEsTheXx.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";
|
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/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 };
|
|
@@ -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",
|