@nodecraft/rendermite 1.10.1 → 1.10.2
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/README.md +8 -7
- package/dist/{block-overrides-XtxICunI.js → block-overrides-BhuJIxKC.js} +1 -1
- package/dist/blocks/block-overrides.js +1 -1
- 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/entity-sizes.js +1 -1
- package/dist/blocks/export.js +1 -1
- package/dist/blocks/game-rules.js +1 -1
- package/dist/blocks/geo-blocks.js +1 -1
- package/dist/blocks/light-bytecode.js +1 -1
- package/dist/blocks/light.js +1 -1
- package/dist/blocks/obj-mesh.js +1 -1
- package/dist/blocks/sprite-sheet.js +1 -1
- package/dist/cached-BOX3n1Dl.js +54 -0
- package/dist/{cli-2mzPC8cy.js → cli--LNKFich.js} +1 -1
- package/dist/cli.js +2 -2
- package/dist/{compose-BGsNFR12.js → compose-CuIKcRpx.js} +1 -1
- package/dist/{encode-LR9wxigC.js → encode-TzYXOEId.js} +5 -4
- package/dist/{ender-storage-Dgomp6r2.js → ender-storage-CKDiYgYc.js} +1 -1
- package/dist/entities/mappings.js +1 -1
- package/dist/entities/model-code.js +1 -1
- package/dist/{entity-fallback-BucEf6WB.js → entity-fallback-BEzCbJq0.js} +1 -1
- package/dist/{entity-geo-DbTtMlPL.js → entity-geo-DcrcN8TE.js} +1 -1
- package/dist/{entity-models-vFl_EwfA.js → entity-models-D6AMLAy6.js} +3 -3
- package/dist/{entity-sizes-DspxgSUA.js → entity-sizes-Dmr4w0vu.js} +4 -3
- package/dist/{export-DgB0e5sB.js → export-Btg1y70w.js} +10 -9
- package/dist/{face-DbyyYmzp.js → face-D6SfTISC.js} +1 -1
- package/dist/{game-rules-BDPTopVW.js → game-rules-Dehe210A.js} +4 -3
- package/dist/{geo-BoDxwvz5.js → geo-BOYYFFQn.js} +3 -3
- package/dist/{geo-blocks-W79q5A0f.js → geo-blocks-BQqFfAQT.js} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/{light-BnaYFouC.js → light-BtV-VxAi.js} +25 -9
- package/dist/{light-bytecode-hhkkjMVi.js → light-bytecode-Bx3XLTRI.js} +1 -1
- package/dist/{mappings-DEl_7xxQ.js → mappings-CTB7_uZa.js} +16 -1
- package/dist/{model-code-BmA5ilgt.js → model-code-C5Au_FKU.js} +4 -3
- package/dist/{obj-DPEK_xee.js → obj-NxBaySXt.js} +67 -33
- package/dist/{obj-mesh-BFhtTBXX.js → obj-mesh-BBSLG2Fv.js} +1 -1
- package/dist/output/encode.js +1 -1
- package/dist/output/item-styles.d.ts +1 -1
- package/dist/output/stylesheet.d.ts +1 -1
- package/dist/output/stylesheet.js +1 -1
- package/dist/{pipeline-Q_185kY6.js → pipeline-CCfkRth7.js} +7 -6
- package/dist/{rasterizer-DcVJzkxz.js → rasterizer-M9Y7mn-W.js} +13 -5
- package/dist/read-ahead-BlSzTexs.js +31 -0
- package/dist/render/compose.js +1 -1
- package/dist/render/entity-fallback.js +1 -1
- package/dist/render/face.js +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/rasterizer.js +1 -1
- package/dist/render/renderer.js +1 -1
- package/dist/resources/cached.d.ts +27 -0
- package/dist/resources/cached.js +2 -0
- package/dist/resources/read-ahead.d.ts +12 -0
- package/dist/resources/read-ahead.js +2 -0
- package/dist/{run-5yX5KRiI.js → run-Bf5TLTJw.js} +7 -6
- package/dist/run.js +1 -1
- package/dist/{sprite-sheet-LQAEtGkp.js → sprite-sheet-BWsLl0Vd.js} +4 -2
- package/dist/{stylesheet-CovT3B2S.js → stylesheet-C61VrCAV.js} +6 -4
- package/dist/{stylesheet-i-t_7sZ7.d.ts → stylesheet-DxHkk4qA.d.ts} +2 -0
- package/dist/workers/render-worker.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -116,13 +116,14 @@ Benchmarked against PHP renderchest v5.1.0 on the same machine, rendering the sa
|
|
|
116
116
|
|
|
117
117
|
| | wall time | items written | silent drops | throughput |
|
|
118
118
|
| --- | --- | --- | --- | --- |
|
|
119
|
-
| renderchest (docker, 8
|
|
120
|
-
| rendermite (one Node process,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
119
|
+
| renderchest (docker, 8 cores) | 186s | 1,573 | 33 | ~506/min |
|
|
120
|
+
| rendermite (one Node process, 8 worker threads) | 12.1s | 2,035 | 0 | ~10,070/min |
|
|
121
|
+
|
|
122
|
+
15x faster with 29% more items rendered. renderchest logged 1,606 items as rendered and exited 0,
|
|
123
|
+
but wrote 1,573 of them; rendermite reports every item it could not draw in
|
|
124
|
+
`rc-minecraft-failures.json`. Both run with `--size 64 --format webp --fallback --item-list`,
|
|
125
|
+
median of warm runs, measured September 2026. Run `npm run bench` for current numbers on your
|
|
126
|
+
machine; CI runs the same suite and comments the delta on pull requests.
|
|
126
127
|
|
|
127
128
|
## Testing
|
|
128
129
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as instructions } from "./entity-sizes-
|
|
1
|
+
import { n as instructions } from "./entity-sizes-Dmr4w0vu.js";
|
|
2
2
|
//#region src/blocks/block-overrides.ts
|
|
3
3
|
/**
|
|
4
4
|
* Where a block's own class answers a question itself, rather than leaving it to its `Properties`.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as overrideOf, n as constantFluidOf, r as constantsReadBy, t as alwaysInvisible } from "../block-overrides-
|
|
1
|
+
import { i as overrideOf, n as constantFluidOf, r as constantsReadBy, t as alwaysInvisible } from "../block-overrides-BhuJIxKC.js";
|
|
2
2
|
export { alwaysInvisible, constantFluidOf, constantsReadBy, overrideOf };
|
package/dist/blocks/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as runBlocksCli } from "../cli
|
|
1
|
+
import { t as runBlocksCli } from "../cli--LNKFich.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-CKDiYgYc.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-DcrcN8TE.js";
|
|
2
2
|
export { findGeoForEntity };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as collectEntityGeometry, r as collectEquipment, t as collectArmourTrims } from "../entity-models-
|
|
1
|
+
import { n as collectEntityGeometry, r as collectEquipment, t as collectArmourTrims } from "../entity-models-D6AMLAy6.js";
|
|
2
2
|
export { collectArmourTrims, collectEntityGeometry, collectEquipment };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as instructions, t as collectEntitySizes } from "../entity-sizes-
|
|
1
|
+
import { n as instructions, t as collectEntitySizes } from "../entity-sizes-Dmr4w0vu.js";
|
|
2
2
|
export { collectEntitySizes, instructions };
|
package/dist/blocks/export.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as exportBlockPack } from "../export-
|
|
1
|
+
import { t as exportBlockPack } from "../export-Btg1y70w.js";
|
|
2
2
|
export { exportBlockPack };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as collectGameRules } from "../game-rules-
|
|
1
|
+
import { t as collectGameRules } from "../game-rules-Dehe210A.js";
|
|
2
2
|
export { collectGameRules };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as geoBlockModel } from "../geo-blocks-
|
|
1
|
+
import { t as geoBlockModel } from "../geo-blocks-BQqFfAQT.js";
|
|
2
2
|
export { geoBlockModel };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as extractBlockLight } from "../light-bytecode-
|
|
1
|
+
import { t as extractBlockLight } from "../light-bytecode-Bx3XLTRI.js";
|
|
2
2
|
export { extractBlockLight };
|
package/dist/blocks/light.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as collectBlockLight, r as vanillaLightAt, t as VANILLA_LIGHT } from "../light-
|
|
1
|
+
import { n as collectBlockLight, r as vanillaLightAt, t as VANILLA_LIGHT } from "../light-BtV-VxAi.js";
|
|
2
2
|
export { VANILLA_LIGHT, collectBlockLight, vanillaLightAt };
|
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-BBSLG2Fv.js";
|
|
2
2
|
export { ObjMeshError, buildObjMesh };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as missingTexture, n as buildSpriteSheet, r as inferRenderLayer, t as MISSING_SPRITE } from "../sprite-sheet-
|
|
1
|
+
import { i as missingTexture, n as buildSpriteSheet, r as inferRenderLayer, t as MISSING_SPRITE } from "../sprite-sheet-BWsLl0Vd.js";
|
|
2
2
|
export { MISSING_SPRITE, buildSpriteSheet, inferRenderLayer, missingTexture };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
//#region src/resources/cached.ts
|
|
2
|
+
/**
|
|
3
|
+
* Remembers directory listings for the lifetime of one render or export.
|
|
4
|
+
*
|
|
5
|
+
* Fallback lookups (mob heads, chests, geo files, sprite fallbacks) scan a
|
|
6
|
+
* whole namespace per item, and every scan re-walked the jar index, re-read
|
|
7
|
+
* the builtin pack from disk and re-deduplicated thousands of locators across
|
|
8
|
+
* layers: one block export listed `minecraft` textures 849 times. The model
|
|
9
|
+
* and texture caches beside it already assume the tree is fixed for the run,
|
|
10
|
+
* so this assumes the same and no more. Reads pass straight through.
|
|
11
|
+
*/
|
|
12
|
+
var CachedListingResourceManager = class {
|
|
13
|
+
inner;
|
|
14
|
+
listings = /* @__PURE__ */ new Map();
|
|
15
|
+
namespaces = null;
|
|
16
|
+
constructor(inner) {
|
|
17
|
+
this.inner = inner;
|
|
18
|
+
}
|
|
19
|
+
getResource(kind, locator) {
|
|
20
|
+
return this.inner.getResource(kind, locator);
|
|
21
|
+
}
|
|
22
|
+
getAllResources(kind, locator) {
|
|
23
|
+
return this.inner.getAllResources(kind, locator);
|
|
24
|
+
}
|
|
25
|
+
hasResource(kind, locator) {
|
|
26
|
+
return this.inner.hasResource(kind, locator);
|
|
27
|
+
}
|
|
28
|
+
async listResources(kind, namespace) {
|
|
29
|
+
const key = `${kind} ${namespace}`;
|
|
30
|
+
let listing = this.listings.get(key);
|
|
31
|
+
if (!listing) {
|
|
32
|
+
listing = this.inner.listResources(kind, namespace);
|
|
33
|
+
this.listings.set(key, listing);
|
|
34
|
+
listing.catch(() => this.listings.delete(key));
|
|
35
|
+
}
|
|
36
|
+
return [...await listing];
|
|
37
|
+
}
|
|
38
|
+
async listNamespaces() {
|
|
39
|
+
if (!this.namespaces) {
|
|
40
|
+
const pending = this.inner.listNamespaces();
|
|
41
|
+
this.namespaces = pending;
|
|
42
|
+
pending.catch(() => {
|
|
43
|
+
this.namespaces = null;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return [...await this.namespaces];
|
|
47
|
+
}
|
|
48
|
+
describe() {
|
|
49
|
+
const describable = this.inner;
|
|
50
|
+
return typeof describable.describe === "function" ? describable.describe() : null;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
//#endregion
|
|
54
|
+
export { CachedListingResourceManager as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as builtinPackPath } from "./builtin-WkWjATeh.js";
|
|
2
2
|
import { n as LayeredResourceManager, t as FolderResourceManager } from "./manager-D6zXmFrO.js";
|
|
3
3
|
import { a as prepareVersionResources, r as compareVersions } from "./prepare-DkJkZXuQ.js";
|
|
4
|
-
import { t as exportBlockPack } from "./export-
|
|
4
|
+
import { t as exportBlockPack } from "./export-Btg1y70w.js";
|
|
5
5
|
import { n as layeredClasses, t as JarClassReader } from "./jar-classes-0wqWbTax.js";
|
|
6
6
|
import { n as prepareModResources } from "./prepare-sj36BP90.js";
|
|
7
7
|
import { t as downloadClientJar } from "./download-1wAfrGKx.js";
|
package/dist/cli.js
CHANGED
|
@@ -6,8 +6,8 @@ import { a as prepareVersionResources, i as eraForVersion, n as GEOMETRY_DONOR_V
|
|
|
6
6
|
import { t as curatedModelOverrides } from "./models-BsYA-NZg.js";
|
|
7
7
|
import { n as harvestTintOverrides, t as curatedTintOverrides } from "./tints-CZeyKzMv.js";
|
|
8
8
|
import { t as downloadClientJar } from "./download-1wAfrGKx.js";
|
|
9
|
-
import { t as runBlocksCli } from "./cli
|
|
10
|
-
import { t as run } from "./run-
|
|
9
|
+
import { t as runBlocksCli } from "./cli--LNKFich.js";
|
|
10
|
+
import { t as run } from "./run-Bf5TLTJw.js";
|
|
11
11
|
import path from "node:path";
|
|
12
12
|
import os from "node:os";
|
|
13
13
|
import { parseArgs } from "node:util";
|
|
@@ -68,7 +68,7 @@ function combineFaceBuffers(width, height, faces) {
|
|
|
68
68
|
deep[slotIndex] = index;
|
|
69
69
|
deepDepth[slotIndex] = depth;
|
|
70
70
|
deepRank[slotIndex] = rank[index];
|
|
71
|
-
} else {
|
|
71
|
+
} else if (face.colors[localPixel * 4 + 3] > 0) {
|
|
72
72
|
let slotIndex = flatCount++;
|
|
73
73
|
while (slotIndex > 0 && flatRank[slotIndex - 1] > rank[index]) {
|
|
74
74
|
flat[slotIndex] = flat[slotIndex - 1];
|
|
@@ -103,22 +103,23 @@ function countColors(data, cap) {
|
|
|
103
103
|
}
|
|
104
104
|
async function encodeIcon(texture, options = {}) {
|
|
105
105
|
const bytes = toByteTexture(texture);
|
|
106
|
-
const
|
|
106
|
+
const pixels = Buffer.from(bytes.data.buffer, bytes.data.byteOffset, bytes.data.length);
|
|
107
|
+
const raw = () => sharp(pixels, { raw: {
|
|
107
108
|
width: bytes.width,
|
|
108
109
|
height: bytes.height,
|
|
109
110
|
channels: 4
|
|
110
111
|
} });
|
|
111
112
|
const paletteSafe = countColors(bytes.data, 256) <= 256;
|
|
112
|
-
const pngPromise = raw
|
|
113
|
+
const pngPromise = raw().png({
|
|
113
114
|
compressionLevel: 9,
|
|
114
115
|
effort: 10,
|
|
115
116
|
palette: paletteSafe
|
|
116
117
|
}).toBuffer();
|
|
117
|
-
const webpPromise = options.webp !== false ? raw
|
|
118
|
+
const webpPromise = options.webp !== false ? raw().webp({
|
|
118
119
|
lossless: true,
|
|
119
120
|
effort: STATIC_WEBP_EFFORT
|
|
120
121
|
}).toBuffer() : Promise.resolve(void 0);
|
|
121
|
-
const avifPromise = options.avif ? raw
|
|
122
|
+
const avifPromise = options.avif ? raw().avif({
|
|
122
123
|
lossless: true,
|
|
123
124
|
effort: 6
|
|
124
125
|
}).toBuffer() : Promise.resolve(void 0);
|
|
@@ -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-NxBaySXt.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,2 +1,2 @@
|
|
|
1
|
-
import { a as loadMappings, c as resolveMappings, i as isObfuscated, n as downloadClientMappings, o as parseMappings, r as identityMappings, s as remapDescriptor, t as MappingsUnavailableError } from "../mappings-
|
|
1
|
+
import { a as loadMappings, c as resolveMappings, i as isObfuscated, n as downloadClientMappings, o as parseMappings, r as identityMappings, s as remapDescriptor, t as MappingsUnavailableError } from "../mappings-CTB7_uZa.js";
|
|
2
2
|
export { MappingsUnavailableError, downloadClientMappings, identityMappings, isObfuscated, loadMappings, parseMappings, remapDescriptor, resolveMappings };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as loadModelCode, t as isModelCode } from "../model-code-
|
|
1
|
+
import { n as loadModelCode, t as isModelCode } from "../model-code-C5Au_FKU.js";
|
|
2
2
|
export { isModelCode, loadModelCode };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as ResourceLocator } from "./locator-COMEtEn9.js";
|
|
2
2
|
import { c as findEntityTexture, d as findMobTexture, h as tokens, m as resolveChestSheets, n as HEAD_LAYOUTS, o as findBedTexture, p as layerAccentSheet, t as DYE_COLORS } from "./entity-textures-DG6NUNyp.js";
|
|
3
|
-
import { c as renderModel } from "./obj-
|
|
3
|
+
import { c as renderModel } from "./obj-NxBaySXt.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-BOYYFFQn.js";
|
|
4
4
|
//#region src/blocks/entity-geo.ts
|
|
5
5
|
/**
|
|
6
6
|
* Finding the `.geo.json` a GeckoLib entity is drawn from.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { n as ResourceLocator } from "./locator-COMEtEn9.js";
|
|
2
|
-
import { t as findGeoForEntity } from "./entity-geo-
|
|
2
|
+
import { t as findGeoForEntity } from "./entity-geo-DcrcN8TE.js";
|
|
3
3
|
import { t as EQUIPMENT_SLOTS } from "./pack-format-BP5dJMYY.js";
|
|
4
4
|
import { t as parseClassFile } from "./classfile-BJSs3JH0.js";
|
|
5
5
|
import { n as extractModel, t as extractArmourMesh } from "./model-bytecode-CXYAZ5dX.js";
|
|
6
6
|
import { n as extractInheritedModel, t as ancestryOf } from "./inherit-DJ45bOB_.js";
|
|
7
7
|
import { a as linkEntityModel, i as classReader, r as buildModelNameIndex } from "./link-IDjVJ2Ij.js";
|
|
8
|
-
import { c as resolveMappings, t as MappingsUnavailableError } from "./mappings-
|
|
9
|
-
import { n as loadModelCode } from "./model-code-
|
|
8
|
+
import { c as resolveMappings, t as MappingsUnavailableError } from "./mappings-CTB7_uZa.js";
|
|
9
|
+
import { n as loadModelCode } from "./model-code-C5Au_FKU.js";
|
|
10
10
|
//#region src/blocks/entity-models.ts
|
|
11
11
|
/**
|
|
12
12
|
* Entity geometry for the pack: link each entity to the class that builds it, read that class's
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { t as parseClassFile } from "./classfile-BJSs3JH0.js";
|
|
2
|
-
import { c as resolveMappings, t as MappingsUnavailableError } from "./mappings-
|
|
2
|
+
import { c as resolveMappings, t as MappingsUnavailableError } from "./mappings-CTB7_uZa.js";
|
|
3
|
+
import { t as readAhead } from "./read-ahead-BlSzTexs.js";
|
|
3
4
|
//#region src/blocks/entity-sizes.ts
|
|
4
5
|
/**
|
|
5
6
|
* Each entity type's hitbox, read out of the code that registers it.
|
|
@@ -119,8 +120,8 @@ async function collectEntitySizes(options) {
|
|
|
119
120
|
}
|
|
120
121
|
const originalName = (owner, name, descriptor) => mappings.nameOf?.get(`${owner.replaceAll("/", ".")}.${name}${descriptor}`) ?? name;
|
|
121
122
|
const parsed = [];
|
|
122
|
-
for (const
|
|
123
|
-
const bytes = await
|
|
123
|
+
for (const [, pending] of readAhead(names, (internal) => options.classes.read(internal))) {
|
|
124
|
+
const bytes = await pending;
|
|
124
125
|
if (!bytes) continue;
|
|
125
126
|
try {
|
|
126
127
|
parsed.push(parseClassFile(bytes));
|
|
@@ -5,21 +5,22 @@ import { n as blockEntityGeometry, r as synthesizeVariants, t as INVISIBLE_BLOCK
|
|
|
5
5
|
import { a as parseBlockState, n as collectModels } from "./blockstate-eval-CV_LwUwj.js";
|
|
6
6
|
import { t as collectDatapack } from "./datapack-D6eH46ay.js";
|
|
7
7
|
import { a as salvageJson, i as resolveTexture, t as ModelLoader } from "./loader-qOH0Jynq.js";
|
|
8
|
-
import { t as enderStorageBlockModel } from "./ender-storage-
|
|
8
|
+
import { t as enderStorageBlockModel } from "./ender-storage-CKDiYgYc.js";
|
|
9
9
|
import { t as collectEntities } from "./entities-rQ4TZjEo.js";
|
|
10
|
-
import { n as collectEntityGeometry } from "./entity-models-
|
|
11
|
-
import { t as collectEntitySizes } from "./entity-sizes-
|
|
12
|
-
import { t as collectGameRules } from "./game-rules-
|
|
13
|
-
import { t as geoBlockModel } from "./geo-blocks-
|
|
10
|
+
import { n as collectEntityGeometry } from "./entity-models-D6AMLAy6.js";
|
|
11
|
+
import { t as collectEntitySizes } from "./entity-sizes-Dmr4w0vu.js";
|
|
12
|
+
import { t as collectGameRules } from "./game-rules-Dehe210A.js";
|
|
13
|
+
import { t as geoBlockModel } from "./geo-blocks-BQqFfAQT.js";
|
|
14
14
|
import { n as discoverItems } from "./discovery-CD0QqxSF.js";
|
|
15
15
|
import { t as collectItemSprites } from "./item-sprites-CwiEBEAJ.js";
|
|
16
|
-
import { n as collectBlockLight } from "./light-
|
|
16
|
+
import { n as collectBlockLight } from "./light-BtV-VxAi.js";
|
|
17
17
|
import { t as collectNames } from "./names-GLa5TyL7.js";
|
|
18
|
-
import { n as buildObjMesh } from "./obj-mesh-
|
|
19
|
-
import { n as buildSpriteSheet, t as MISSING_SPRITE } from "./sprite-sheet-
|
|
18
|
+
import { n as buildObjMesh } from "./obj-mesh-BBSLG2Fv.js";
|
|
19
|
+
import { n as buildSpriteSheet, t as MISSING_SPRITE } from "./sprite-sheet-BWsLl0Vd.js";
|
|
20
20
|
import { t as readBlockStates } from "./states-BvoZA-ql.js";
|
|
21
21
|
import { n as buildBlockTints, t as UNREGISTERED_TINTS } from "./tints-Cl0r-Ol3.js";
|
|
22
22
|
import { t as loadAtlasResolver } from "./registry-DafxsAhG.js";
|
|
23
|
+
import { t as CachedListingResourceManager } from "./cached-BOX3n1Dl.js";
|
|
23
24
|
import { n as TextureLoader } from "./loader-CsgtBuBo.js";
|
|
24
25
|
import path from "node:path";
|
|
25
26
|
import { createHash } from "node:crypto";
|
|
@@ -315,7 +316,7 @@ function bakeModel(id, model, failures) {
|
|
|
315
316
|
}
|
|
316
317
|
async function exportBlockPack(options) {
|
|
317
318
|
const { output, version } = options;
|
|
318
|
-
const resources = options.builtin ? new LayeredResourceManager([options.resources, new FolderResourceManager(options.builtin)]) : options.resources;
|
|
319
|
+
const resources = new CachedListingResourceManager(options.builtin ? new LayeredResourceManager([options.resources, new FolderResourceManager(options.builtin)]) : options.resources);
|
|
319
320
|
const namespaces = options.namespaces ?? ["minecraft"];
|
|
320
321
|
const failures = [];
|
|
321
322
|
const report = (stage, done, total) => options.onProgress?.(stage, done, total);
|
|
@@ -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
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-
|
|
3
|
+
import { a as drawTexturedTriangle, i as createFaceBuffer, n as clearFaceBuffer, o as phpRound, r as compactFaceBuffer, t as RowCursor } from "./rasterizer-M9Y7mn-W.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,6 @@
|
|
|
1
1
|
import { t as parseClassFile } from "./classfile-BJSs3JH0.js";
|
|
2
|
-
import {
|
|
2
|
+
import { t as readAhead } from "./read-ahead-BlSzTexs.js";
|
|
3
|
+
import { n as instructions } from "./entity-sizes-Dmr4w0vu.js";
|
|
3
4
|
//#region src/blocks/game-rules.ts
|
|
4
5
|
/**
|
|
5
6
|
* The version's game rules: each one's name, whether it is on/off or a number, and its default.
|
|
@@ -32,8 +33,8 @@ function valueKind(descriptor) {
|
|
|
32
33
|
*/
|
|
33
34
|
async function collectGameRules(classes) {
|
|
34
35
|
let best = {};
|
|
35
|
-
for (const
|
|
36
|
-
const bytes = await
|
|
36
|
+
for (const [, pending] of readAhead(await classes.list(), (internal) => classes.read(internal))) {
|
|
37
|
+
const bytes = await pending;
|
|
37
38
|
if (!bytes || ![...MARKERS].some((marker) => Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength).includes(marker))) continue;
|
|
38
39
|
let classFile;
|
|
39
40
|
try {
|
|
@@ -2,9 +2,9 @@ import { n as ResourceLocator } from "./locator-COMEtEn9.js";
|
|
|
2
2
|
import { l as toFloatTexture } from "./blend-KXMclcHk.js";
|
|
3
3
|
import { n as displayMatrix } from "./vector-CCxLae_T.js";
|
|
4
4
|
import { c as lightsForProfile } from "./lighting--5myudVu.js";
|
|
5
|
-
import { i as createFaceBuffer } from "./rasterizer-
|
|
6
|
-
import { t as combineFaceBuffers } from "./compose-
|
|
7
|
-
import { n as faceMaxZ, r as renderFace, t as createShadeCache } from "./face-
|
|
5
|
+
import { i as createFaceBuffer } from "./rasterizer-M9Y7mn-W.js";
|
|
6
|
+
import { t as combineFaceBuffers } from "./compose-CuIKcRpx.js";
|
|
7
|
+
import { n as faceMaxZ, r as renderFace, t as createShadeCache } from "./face-D6SfTISC.js";
|
|
8
8
|
//#region src/render/geo.ts
|
|
9
9
|
/**
|
|
10
10
|
* Bedrock-format geometry (`.geo.json`) rendering, best-effort. GeckoLib mods
|
|
@@ -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-BOYYFFQn.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. */
|
package/dist/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ import { i as EncodedIcon, n as EncodeOptions, o as encodeAnimatedIcon, r as Enc
|
|
|
20
20
|
import { t as minifyStylesheet } from "./minify-CIV6enbr.js";
|
|
21
21
|
import { a as compareVersions, o as eraForVersion, s as prepareVersionResources } from "./prepare-Ce5SpR7Y.js";
|
|
22
22
|
import { i as prepareModResources } from "./prepare-BPzsZI_S.js";
|
|
23
|
-
import { i as itemClass, n as StylesheetOptions, r as generateStylesheet, t as ItemStyle } from "./stylesheet-
|
|
23
|
+
import { i as itemClass, n as StylesheetOptions, r as generateStylesheet, t as ItemStyle } from "./stylesheet-DxHkk4qA.js";
|
|
24
24
|
import { i as run, n as RunOptions, r as RunResult, t as ItemFailure } from "./run-CxB1qabg.js";
|
|
25
25
|
import { n as UnsafeJarError, r as isUnsafeEntryPath, t as JarResourceManager } from "./jar-4Jg7ufWK.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, LEGACY_BIOMES, LayeredResourceManager, type LightSource, LightingProfile, type LightingProfileName, type MeshGroup, ModelLoader, ModelResolutionError, type MultipartCondition, type ObjMesh, ObjMeshError, PRE_JAR_BIOMES, 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, vanillaBiomesFor, weightedVariantIndex };
|
package/dist/index.js
CHANGED
|
@@ -7,20 +7,20 @@ import { a as parseBlockState, i as matchesCondition, n as collectModels, o as w
|
|
|
7
7
|
import { c as toByteTexture, l as toFloatTexture } from "./blend-KXMclcHk.js";
|
|
8
8
|
import { c as lightsForProfile, r as LightingProfile } from "./lighting--5myudVu.js";
|
|
9
9
|
import { a as salvageJson, i as resolveTexture, n as ModelResolutionError, t as ModelLoader } from "./loader-qOH0Jynq.js";
|
|
10
|
-
import { a as ItemRenderError, c as renderModel, l as renderModelFrames, o as boxDownscale, s as pointResize } from "./obj-
|
|
10
|
+
import { a as ItemRenderError, c as renderModel, l as renderModelFrames, o as boxDownscale, s as pointResize } from "./obj-NxBaySXt.js";
|
|
11
11
|
import { a as defaultProperties, i as UNKNOWN_MODEL, n as InvalidItemDefinitionError, o as evaluateItemModel } from "./definition-ColsvWrH.js";
|
|
12
12
|
import { i as resolveItem, n as discoverItems, t as ItemResolutionError } from "./discovery-CD0QqxSF.js";
|
|
13
13
|
import { a as resolveTints, i as resolveTint, n as InvalidTinterDefinitionError, r as parseTintValue, t as DYE_COLORS } from "./tints-B3WQcPtx.js";
|
|
14
|
-
import { n as buildObjMesh, t as ObjMeshError } from "./obj-mesh-
|
|
14
|
+
import { n as buildObjMesh, t as ObjMeshError } from "./obj-mesh-BBSLG2Fv.js";
|
|
15
15
|
import { t as packAtlas } from "./atlas-pack-CoOih7By.js";
|
|
16
16
|
import { n as buildBlockTints, t as UNREGISTERED_TINTS } from "./tints-Cl0r-Ol3.js";
|
|
17
17
|
import { o as createAtlasResolver, s as parseAtlasSources, t as AtlasSourceError } from "./sources-DYY5Qu-t.js";
|
|
18
18
|
import { n as TextureLoader, r as TextureResolutionError, t as AnimatedTexture } from "./loader-CsgtBuBo.js";
|
|
19
|
-
import { t as exportBlockPack } from "./export-
|
|
19
|
+
import { t as exportBlockPack } from "./export-Btg1y70w.js";
|
|
20
20
|
import { n as prepareModResources } from "./prepare-sj36BP90.js";
|
|
21
|
-
import { n as encodeIcon, t as encodeAnimatedIcon } from "./encode-
|
|
21
|
+
import { n as encodeIcon, t as encodeAnimatedIcon } from "./encode-TzYXOEId.js";
|
|
22
22
|
import { a as builtinDynamicResources } from "./generators-D6giKoab.js";
|
|
23
23
|
import { t as minifyStylesheet } from "./minify-bjMRmr5J.js";
|
|
24
|
-
import { n as itemClass, t as generateStylesheet } from "./stylesheet-
|
|
25
|
-
import { t as run } from "./run-
|
|
24
|
+
import { n as itemClass, t as generateStylesheet } from "./stylesheet-C61VrCAV.js";
|
|
25
|
+
import { t as run } from "./run-Bf5TLTJw.js";
|
|
26
26
|
export { AnimatedTexture, AtlasSourceError, BlockStateError, DEFAULT_WATER_COLOR, DYE_COLORS, FolderResourceManager, InvalidItemDefinitionError, InvalidResourceLocatorError, InvalidTinterDefinitionError, ItemRenderError, ItemResolutionError, JarResourceManager, LEGACY_BIOMES, LayeredResourceManager, LightingProfile, ModelLoader, ModelResolutionError, ObjMeshError, PRE_JAR_BIOMES, 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, vanillaBiomesFor, weightedVariantIndex };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { r as compareVersions } from "./prepare-DkJkZXuQ.js";
|
|
2
2
|
import { t as parseClassFile } from "./classfile-BJSs3JH0.js";
|
|
3
|
-
import { c as resolveMappings, s as remapDescriptor, t as MappingsUnavailableError } from "./mappings-
|
|
3
|
+
import { c as resolveMappings, s as remapDescriptor, t as MappingsUnavailableError } from "./mappings-CTB7_uZa.js";
|
|
4
|
+
import { t as readAhead } from "./read-ahead-BlSzTexs.js";
|
|
4
5
|
import { t as blockBehaviour } from "./block-behaviour-DVjqeSkv.js";
|
|
5
|
-
import { i as overrideOf, n as constantFluidOf, t as alwaysInvisible } from "./block-overrides-
|
|
6
|
-
import { t as extractBlockLight } from "./light-bytecode-
|
|
6
|
+
import { i as overrideOf, n as constantFluidOf, t as alwaysInvisible } from "./block-overrides-BhuJIxKC.js";
|
|
7
|
+
import { t as extractBlockLight } from "./light-bytecode-Bx3XLTRI.js";
|
|
7
8
|
//#region src/blocks/light.ts
|
|
8
9
|
/**
|
|
9
10
|
* Block light emission for the exported pack: `light.json`.
|
|
@@ -191,9 +192,15 @@ function findLightGetters(roots, propsClasses, resolve, notes) {
|
|
|
191
192
|
}
|
|
192
193
|
/** Reference renaming through the mappings: a mod's original names onto an obfuscated client's. */
|
|
193
194
|
function remapper(mappings, superOf = () => null) {
|
|
195
|
+
const remappedClasses = /* @__PURE__ */ new Map();
|
|
194
196
|
const remapClass = (internalName) => {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
+
let remapped = remappedClasses.get(internalName);
|
|
198
|
+
if (remapped === void 0) {
|
|
199
|
+
const mapped = mappings.obfuscatedOf.get(internalName.replaceAll("/", "."));
|
|
200
|
+
remapped = mapped ? mapped.replaceAll(".", "/") : internalName;
|
|
201
|
+
remappedClasses.set(internalName, remapped);
|
|
202
|
+
}
|
|
203
|
+
return remapped;
|
|
197
204
|
};
|
|
198
205
|
const remap = (reference, field) => {
|
|
199
206
|
const dotted = reference.owner.replaceAll("/", ".");
|
|
@@ -206,15 +213,24 @@ function remapper(mappings, superOf = () => null) {
|
|
|
206
213
|
descriptor: remapDescriptor(reference.descriptor, mappings.obfuscatedOf)
|
|
207
214
|
};
|
|
208
215
|
};
|
|
216
|
+
const memberNames = /* @__PURE__ */ new Map();
|
|
209
217
|
const nameOf = (reference, field) => {
|
|
218
|
+
const key = field ? `field ${reference.owner}.${reference.name}` : `method ${reference.owner}.${reference.name}${reference.descriptor}`;
|
|
219
|
+
let name = memberNames.get(key);
|
|
220
|
+
if (name !== void 0) return name;
|
|
221
|
+
name = reference.name;
|
|
210
222
|
let owner = reference.owner;
|
|
211
223
|
for (let hops = 0; owner && hops < 8; hops++) {
|
|
212
224
|
const dotted = owner.replaceAll("/", ".");
|
|
213
225
|
const found = mappings.nameOf?.get(field ? `${dotted}.${reference.name}` : `${dotted}.${reference.name}${reference.descriptor}`);
|
|
214
|
-
if (found)
|
|
226
|
+
if (found) {
|
|
227
|
+
name = found;
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
215
230
|
owner = superOf(owner);
|
|
216
231
|
}
|
|
217
|
-
|
|
232
|
+
memberNames.set(key, name);
|
|
233
|
+
return name;
|
|
218
234
|
};
|
|
219
235
|
return {
|
|
220
236
|
remap,
|
|
@@ -243,8 +259,8 @@ async function collectBlockLight(options) {
|
|
|
243
259
|
const { remap, remapClass } = remapper(mappings);
|
|
244
260
|
const isClearJar = names.some((name) => name.replaceAll(".", "/") === "net/minecraft/world/level/block/Blocks");
|
|
245
261
|
const bytes = /* @__PURE__ */ new Map();
|
|
246
|
-
for (const name of names) {
|
|
247
|
-
const read = await
|
|
262
|
+
for (const [name, pending] of readAhead(names, (internal) => classes.read(internal))) {
|
|
263
|
+
const read = await pending;
|
|
248
264
|
if (read) bytes.set(name.replaceAll(".", "/"), read);
|
|
249
265
|
}
|
|
250
266
|
const parsed = /* @__PURE__ */ new Map();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as parseDescriptor } from "./model-bytecode-CXYAZ5dX.js";
|
|
2
|
-
import { n as instructions } from "./entity-sizes-
|
|
2
|
+
import { n as instructions } from "./entity-sizes-Dmr4w0vu.js";
|
|
3
3
|
import { n as statedMapColor } from "./block-behaviour-DVjqeSkv.js";
|
|
4
4
|
//#region src/blocks/light-bytecode.ts
|
|
5
5
|
/**
|
|
@@ -160,8 +160,23 @@ function parseMappings(text) {
|
|
|
160
160
|
nameOf
|
|
161
161
|
};
|
|
162
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* The last file parsed. An export reads one version's mappings from light, entity sizes and entity
|
|
165
|
+
* geometry in turn, and each parse is most of a second; one slot keeps a seed across versions bounded.
|
|
166
|
+
*/
|
|
167
|
+
let lastParsed = null;
|
|
163
168
|
async function loadMappings(version, cacheDir) {
|
|
164
|
-
|
|
169
|
+
const file = await downloadClientMappings(version, cacheDir);
|
|
170
|
+
if (lastParsed?.file === file) return lastParsed.mappings;
|
|
171
|
+
const entry = {
|
|
172
|
+
file,
|
|
173
|
+
mappings: readFile(file, "utf8").then((text) => parseMappings(text))
|
|
174
|
+
};
|
|
175
|
+
lastParsed = entry;
|
|
176
|
+
entry.mappings.catch(() => {
|
|
177
|
+
if (lastParsed === entry) lastParsed = null;
|
|
178
|
+
});
|
|
179
|
+
return entry.mappings;
|
|
165
180
|
}
|
|
166
181
|
/**
|
|
167
182
|
* Mappings for a jar that was never obfuscated: every class maps to itself.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { t as parseClassFile } from "./classfile-BJSs3JH0.js";
|
|
2
|
+
import { t as readAhead } from "./read-ahead-BlSzTexs.js";
|
|
2
3
|
//#region src/entities/model-code.ts
|
|
3
4
|
/**
|
|
4
5
|
* Which classes in a jar count as model code, and their parsed form.
|
|
@@ -24,9 +25,9 @@ function isModelCode(name) {
|
|
|
24
25
|
*/
|
|
25
26
|
async function loadModelCode(names, read, originalOf) {
|
|
26
27
|
const code = /* @__PURE__ */ new Map();
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const bytes = await
|
|
28
|
+
const modelNames = Iterator.from(names).filter((name) => isModelCode(originalOf?.(name) ?? name));
|
|
29
|
+
for (const [name, pending] of readAhead(modelNames, read)) {
|
|
30
|
+
const bytes = await pending;
|
|
30
31
|
if (bytes) code.set(name.replaceAll(".", "/"), bytes);
|
|
31
32
|
}
|
|
32
33
|
const parsed = /* @__PURE__ */ new Map();
|
|
@@ -2,9 +2,9 @@ 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
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";
|
|
4
4
|
import { c as lightsForProfile } from "./lighting--5myudVu.js";
|
|
5
|
-
import { a as drawTexturedTriangle, i as createFaceBuffer, n as clearFaceBuffer, o as phpRound, t as RowCursor } from "./rasterizer-
|
|
6
|
-
import { t as combineFaceBuffers } from "./compose-
|
|
7
|
-
import { n as faceMaxZ, r as renderFace, t as createShadeCache } from "./face-
|
|
5
|
+
import { a as drawTexturedTriangle, i as createFaceBuffer, n as clearFaceBuffer, o as phpRound, t as RowCursor } from "./rasterizer-M9Y7mn-W.js";
|
|
6
|
+
import { t as combineFaceBuffers } from "./compose-CuIKcRpx.js";
|
|
7
|
+
import { n as faceMaxZ, r as renderFace, t as createShadeCache } from "./face-D6SfTISC.js";
|
|
8
8
|
import { t as paintBucketFluid } from "./fluid-bucket-B-I4ZYHl.js";
|
|
9
9
|
import { r as buildElementFaces } from "./geometry-bUDBhncX.js";
|
|
10
10
|
import { i as resolveTexture } from "./loader-qOH0Jynq.js";
|
|
@@ -226,10 +226,14 @@ async function renderGeneratedItemWith(model, supplier, renderSize, tints) {
|
|
|
226
226
|
const float = toFloatTexture(texture);
|
|
227
227
|
const tint = tints?.[layerIndex] ?? null;
|
|
228
228
|
if (tint) tintTexture(float, tint.r, tint.g, tint.b);
|
|
229
|
-
const
|
|
230
|
-
for (let
|
|
231
|
-
const
|
|
232
|
-
|
|
229
|
+
const srcXs = pointColumns(float.width, renderSize);
|
|
230
|
+
for (let y = 0; y < renderSize; y++) {
|
|
231
|
+
const srcRow = pointRow(float.height, renderSize, y) * float.width;
|
|
232
|
+
for (let x = 0; x < renderSize; x++) {
|
|
233
|
+
const src = (srcRow + srcXs[x]) * 4;
|
|
234
|
+
const alpha = float.data[src + 3];
|
|
235
|
+
if (alpha > 0) blendPixel(out, (y * renderSize + x) * 4, float.data[src], float.data[src + 1], float.data[src + 2], alpha);
|
|
236
|
+
}
|
|
233
237
|
}
|
|
234
238
|
}
|
|
235
239
|
return {
|
|
@@ -336,18 +340,29 @@ async function renderElementModelWith(model, supplier, renderSize, options, sess
|
|
|
336
340
|
}
|
|
337
341
|
return combineFaceBuffers(renderSize, renderSize, buffers);
|
|
338
342
|
}
|
|
339
|
-
/**
|
|
340
|
-
|
|
341
|
-
|
|
343
|
+
/**
|
|
344
|
+
* Source column for every destination column of a point resize. The mapping is
|
|
345
|
+
* identical for every row, so computing it once avoids width * height redundant
|
|
346
|
+
* Math.floor + division calls.
|
|
347
|
+
*/
|
|
348
|
+
function pointColumns(sourceWidth, width) {
|
|
342
349
|
const srcXs = new Int32Array(width);
|
|
343
350
|
for (let x = 0; x < width; x++) {
|
|
344
|
-
const srcX = Math.floor((x + .5) *
|
|
345
|
-
srcXs[x] = srcX >=
|
|
351
|
+
const srcX = Math.floor((x + .5) * sourceWidth / width);
|
|
352
|
+
srcXs[x] = srcX >= sourceWidth ? sourceWidth - 1 : srcX;
|
|
346
353
|
}
|
|
354
|
+
return srcXs;
|
|
355
|
+
}
|
|
356
|
+
function pointRow(sourceHeight, height, y) {
|
|
357
|
+
const srcY = Math.floor((y + .5) * sourceHeight / height);
|
|
358
|
+
return srcY >= sourceHeight ? sourceHeight - 1 : srcY;
|
|
359
|
+
}
|
|
360
|
+
/** Nearest-neighbour resize matching Imagick FILTER_POINT (destination-center sampling). */
|
|
361
|
+
function pointResize(texture, width, height) {
|
|
362
|
+
const data = new Float64Array(width * height * 4);
|
|
363
|
+
const srcXs = pointColumns(texture.width, width);
|
|
347
364
|
for (let y = 0; y < height; y++) {
|
|
348
|
-
|
|
349
|
-
srcY = srcY >= texture.height ? texture.height - 1 : srcY;
|
|
350
|
-
const srcRow = srcY * texture.width;
|
|
365
|
+
const srcRow = pointRow(texture.height, height, y) * texture.width;
|
|
351
366
|
const dstRow = y * width;
|
|
352
367
|
for (let x = 0; x < width; x++) {
|
|
353
368
|
const src = (srcRow + srcXs[x]) * 4;
|
|
@@ -371,29 +386,48 @@ function pointResize(texture, width, height) {
|
|
|
371
386
|
* Q16 quantum with round-half-up. Verified against Imagick FILTER_BOX output.
|
|
372
387
|
*/
|
|
373
388
|
function boxDownscale(texture, factor) {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
const
|
|
378
|
-
|
|
389
|
+
const { width: sourceWidth, height: sourceHeight, data: src } = texture;
|
|
390
|
+
const width = Math.round(sourceWidth / factor);
|
|
391
|
+
const height = Math.round(sourceHeight / factor);
|
|
392
|
+
const quanta = new Float64Array(width * sourceHeight * 4);
|
|
393
|
+
for (let y = 0; y < sourceHeight; y++) for (let x = 0; x < width; x++) {
|
|
394
|
+
const start = (y * sourceWidth + x * factor) * 4;
|
|
395
|
+
let alphaSum = 0;
|
|
396
|
+
for (let i = 0, srcOffset = start; i < factor; i++, srcOffset += 4) alphaSum += Math.round(src[srcOffset + 3] * 65535);
|
|
397
|
+
const dst = (y * width + x) * 4;
|
|
398
|
+
if (alphaSum > 0) {
|
|
399
|
+
let r = 0;
|
|
400
|
+
let g = 0;
|
|
401
|
+
let b = 0;
|
|
402
|
+
for (let i = 0, srcOffset = start; i < factor; i++, srcOffset += 4) {
|
|
403
|
+
const alpha = Math.round(src[srcOffset + 3] * 65535);
|
|
404
|
+
r += Math.round(src[srcOffset] * 65535) * alpha;
|
|
405
|
+
g += Math.round(src[srcOffset + 1] * 65535) * alpha;
|
|
406
|
+
b += Math.round(src[srcOffset + 2] * 65535) * alpha;
|
|
407
|
+
}
|
|
408
|
+
quanta[dst] = clampQuantum(r / alphaSum);
|
|
409
|
+
quanta[dst + 1] = clampQuantum(g / alphaSum);
|
|
410
|
+
quanta[dst + 2] = clampQuantum(b / alphaSum);
|
|
411
|
+
}
|
|
412
|
+
quanta[dst + 3] = clampQuantum(alphaSum / factor);
|
|
413
|
+
}
|
|
379
414
|
const data = new Float64Array(width * height * 4);
|
|
380
|
-
const
|
|
415
|
+
const rowStride = width * 4;
|
|
381
416
|
for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
|
|
382
|
-
|
|
383
|
-
let g = 0;
|
|
384
|
-
let b = 0;
|
|
417
|
+
const start = (y * factor * width + x) * 4;
|
|
385
418
|
let alphaSum = 0;
|
|
386
|
-
for (let i = 0; i < factor; i
|
|
387
|
-
const srcX = isHorizontal ? x * factor + i : x;
|
|
388
|
-
const srcOffset = ((isHorizontal ? y : y * factor + i) * texture.width + srcX) * 4;
|
|
389
|
-
const alpha = Math.round(src[srcOffset + 3] * 65535);
|
|
390
|
-
r += Math.round(src[srcOffset] * 65535) * alpha;
|
|
391
|
-
g += Math.round(src[srcOffset + 1] * 65535) * alpha;
|
|
392
|
-
b += Math.round(src[srcOffset + 2] * 65535) * alpha;
|
|
393
|
-
alphaSum += alpha;
|
|
394
|
-
}
|
|
419
|
+
for (let i = 0, srcOffset = start; i < factor; i++, srcOffset += rowStride) alphaSum += quanta[srcOffset + 3];
|
|
395
420
|
const dst = (y * width + x) * 4;
|
|
396
421
|
if (alphaSum > 0) {
|
|
422
|
+
let r = 0;
|
|
423
|
+
let g = 0;
|
|
424
|
+
let b = 0;
|
|
425
|
+
for (let i = 0, srcOffset = start; i < factor; i++, srcOffset += rowStride) {
|
|
426
|
+
const alpha = quanta[srcOffset + 3];
|
|
427
|
+
r += quanta[srcOffset] * alpha;
|
|
428
|
+
g += quanta[srcOffset + 1] * alpha;
|
|
429
|
+
b += quanta[srcOffset + 2] * alpha;
|
|
430
|
+
}
|
|
397
431
|
data[dst] = clampQuantum(r / alphaSum) / 65535;
|
|
398
432
|
data[dst + 1] = clampQuantum(g / alphaSum) / 65535;
|
|
399
433
|
data[dst + 2] = clampQuantum(b / alphaSum) / 65535;
|
|
@@ -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-NxBaySXt.js";
|
|
3
3
|
//#region src/blocks/obj-mesh.ts
|
|
4
4
|
/**
|
|
5
5
|
* OBJ geometry as pack data.
|
package/dist/output/encode.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as encodeIcon, r as encodeRasterAsset, t as encodeAnimatedIcon } from "../encode-
|
|
1
|
+
import { n as encodeIcon, r as encodeRasterAsset, t as encodeAnimatedIcon } from "../encode-TzYXOEId.js";
|
|
2
2
|
export { encodeAnimatedIcon, encodeIcon, encodeRasterAsset };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as itemClass, n as StylesheetOptions, r as generateStylesheet, t as ItemStyle } from "../stylesheet-
|
|
1
|
+
import { i as itemClass, n as StylesheetOptions, r as generateStylesheet, t as ItemStyle } from "../stylesheet-DxHkk4qA.js";
|
|
2
2
|
export { ItemStyle, StylesheetOptions, generateStylesheet, itemClass };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as itemClass, t as generateStylesheet } from "../stylesheet-
|
|
1
|
+
import { n as itemClass, t as generateStylesheet } from "../stylesheet-C61VrCAV.js";
|
|
2
2
|
export { generateStylesheet, itemClass };
|
|
@@ -2,16 +2,17 @@ import { n as ResourceLocator } from "./locator-COMEtEn9.js";
|
|
|
2
2
|
import { n as LayeredResourceManager, t as FolderResourceManager } from "./manager-D6zXmFrO.js";
|
|
3
3
|
import { l as toFloatTexture, t as blendPixel } from "./blend-KXMclcHk.js";
|
|
4
4
|
import { t as ModelLoader } from "./loader-qOH0Jynq.js";
|
|
5
|
-
import { c as renderModel, l as renderModelFrames, o as boxDownscale, s as pointResize } from "./obj-
|
|
6
|
-
import { a as renderGeo, t as findGeoForItem } from "./geo-
|
|
5
|
+
import { c as renderModel, l as renderModelFrames, o as boxDownscale, s as pointResize } from "./obj-NxBaySXt.js";
|
|
6
|
+
import { a as renderGeo, t as findGeoForItem } from "./geo-BOYYFFQn.js";
|
|
7
7
|
import { a as defaultProperties } from "./definition-ColsvWrH.js";
|
|
8
8
|
import { i as resolveItem } from "./discovery-CD0QqxSF.js";
|
|
9
9
|
import { a as resolveTints } from "./tints-B3WQcPtx.js";
|
|
10
10
|
import { t as loadAtlasResolver } from "./registry-DafxsAhG.js";
|
|
11
|
+
import { t as CachedListingResourceManager } from "./cached-BOX3n1Dl.js";
|
|
11
12
|
import { n as TextureLoader } from "./loader-CsgtBuBo.js";
|
|
12
|
-
import { t as encodeAnimatedIcon } from "./encode-
|
|
13
|
+
import { t as encodeAnimatedIcon } from "./encode-TzYXOEId.js";
|
|
13
14
|
import { a as builtinDynamicResources } from "./generators-D6giKoab.js";
|
|
14
|
-
import { a as spawnEggTints, i as renderEntityFallback, n as dyedVariantTint, r as renderDyedVariantFallback, t as dyeVariantName } from "./entity-fallback-
|
|
15
|
+
import { a as spawnEggTints, i as renderEntityFallback, n as dyedVariantTint, r as renderDyedVariantFallback, t as dyeVariantName } from "./entity-fallback-BEzCbJq0.js";
|
|
15
16
|
import { t as legacyTintsForChain } from "./legacy-tints-l-541wgI.js";
|
|
16
17
|
import { n as defaultBlockStateModel, t as blockStateTransform } from "./blockstate-DVb8Mhxc.js";
|
|
17
18
|
import path from "node:path";
|
|
@@ -27,11 +28,11 @@ import { mkdir, writeFile } from "node:fs/promises";
|
|
|
27
28
|
var ItemPipeline = class ItemPipeline {
|
|
28
29
|
static async create(base, settings) {
|
|
29
30
|
const dynamic = settings.builtin ? builtinDynamicResources() : null;
|
|
30
|
-
const resources = settings.builtin && dynamic ? new LayeredResourceManager([
|
|
31
|
+
const resources = new CachedListingResourceManager(settings.builtin && dynamic ? new LayeredResourceManager([
|
|
31
32
|
new FolderResourceManager(settings.builtin),
|
|
32
33
|
dynamic.layer,
|
|
33
34
|
base
|
|
34
|
-
]) : base;
|
|
35
|
+
]) : base);
|
|
35
36
|
const pipeline = new ItemPipeline(resources, dynamic?.items.map((item) => item.id) ?? null, settings);
|
|
36
37
|
pipeline.textures.setAtlasResolver(await loadAtlasResolver(resources, (locator) => pipeline.textures.load(locator)));
|
|
37
38
|
return pipeline;
|
|
@@ -48,12 +48,20 @@ function compactFaceBuffer(buffer) {
|
|
|
48
48
|
let minY = buffer.height;
|
|
49
49
|
let maxX = -1;
|
|
50
50
|
let maxY = -1;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
const source = buffer.colors;
|
|
52
|
+
const startX = Math.max(buffer.dirty.minX, 0);
|
|
53
|
+
const endX = Math.min(buffer.dirty.maxX, buffer.width - 1);
|
|
54
|
+
for (let y = Math.max(buffer.dirty.minY, 0); y <= Math.min(buffer.dirty.maxY, buffer.height - 1); y++) {
|
|
55
|
+
const row = y * buffer.width;
|
|
56
|
+
let first = startX;
|
|
57
|
+
while (first <= endX && source[(row + first) * 4 + 3] <= 0) first++;
|
|
58
|
+
if (first > endX) continue;
|
|
59
|
+
let last = endX;
|
|
60
|
+
while (last > first && source[(row + last) * 4 + 3] <= 0) last--;
|
|
61
|
+
minX = Math.min(minX, first);
|
|
62
|
+
maxX = Math.max(maxX, last);
|
|
54
63
|
minY = Math.min(minY, y);
|
|
55
|
-
|
|
56
|
-
maxY = Math.max(maxY, y);
|
|
64
|
+
maxY = y;
|
|
57
65
|
}
|
|
58
66
|
if (maxX < minX || maxY < minY) return null;
|
|
59
67
|
const width = maxX - minX + 1;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region src/resources/read-ahead.ts
|
|
2
|
+
/** Loads kept running ahead of the caller: enough to overlap one entry's decode with the next one's I/O. */
|
|
3
|
+
const WINDOW = 32;
|
|
4
|
+
/**
|
|
5
|
+
* Each item paired with its load, already started, in the order given; a fixed number of loads run
|
|
6
|
+
* ahead of the one the caller is awaiting.
|
|
7
|
+
*
|
|
8
|
+
* Whole-jar sweeps and atlas builds awaited one entry at a time, so every read paid its disk round trip
|
|
9
|
+
* and decode in series. The caller still awaits each load in order, so results, progress and the first
|
|
10
|
+
* failure land exactly where the one-at-a-time loop put them.
|
|
11
|
+
*/
|
|
12
|
+
function* readAhead(items, load) {
|
|
13
|
+
const iterator = items[Symbol.iterator]();
|
|
14
|
+
const pending = [];
|
|
15
|
+
const fill = () => {
|
|
16
|
+
while (pending.length < WINDOW) {
|
|
17
|
+
const next = iterator.next();
|
|
18
|
+
if (next.done) return;
|
|
19
|
+
const result = Promise.try(load, next.value);
|
|
20
|
+
result.catch(() => {});
|
|
21
|
+
pending.push([next.value, result]);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
fill();
|
|
25
|
+
for (let entry = pending.shift(); entry; entry = pending.shift()) {
|
|
26
|
+
yield entry;
|
|
27
|
+
fill();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { readAhead as t };
|
package/dist/render/compose.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as combineFaceBuffers } from "../compose-
|
|
1
|
+
import { t as combineFaceBuffers } from "../compose-CuIKcRpx.js";
|
|
2
2
|
export { combineFaceBuffers };
|
|
@@ -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-BEzCbJq0.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-D6SfTISC.js";
|
|
2
2
|
export { createShadeCache, faceMaxZ, renderFace };
|
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-BOYYFFQn.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-NxBaySXt.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-CCfkRth7.js";
|
|
2
2
|
export { ItemPipeline };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as drawTexturedTriangle, i as createFaceBuffer, n as clearFaceBuffer, o as phpRound, r as compactFaceBuffer, t as RowCursor } from "../rasterizer-
|
|
1
|
+
import { a as drawTexturedTriangle, i as createFaceBuffer, n as clearFaceBuffer, o as phpRound, r as compactFaceBuffer, t as RowCursor } from "../rasterizer-M9Y7mn-W.js";
|
|
2
2
|
export { RowCursor, clearFaceBuffer, compactFaceBuffer, createFaceBuffer, drawTexturedTriangle, phpRound };
|
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-NxBaySXt.js";
|
|
2
2
|
export { ItemRenderError, boxDownscale, pointResize, renderModel, renderModelFrames };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { n as ResourceLocator } from "../locator-jDbdUeTd.js";
|
|
2
|
+
import { a as ResourceManager, i as ResourceKindName, s as ResourceDescriptor } from "../manager-Ct0dEOMg.js";
|
|
3
|
+
//#region src/resources/cached.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Remembers directory listings for the lifetime of one render or export.
|
|
6
|
+
*
|
|
7
|
+
* Fallback lookups (mob heads, chests, geo files, sprite fallbacks) scan a
|
|
8
|
+
* whole namespace per item, and every scan re-walked the jar index, re-read
|
|
9
|
+
* the builtin pack from disk and re-deduplicated thousands of locators across
|
|
10
|
+
* layers: one block export listed `minecraft` textures 849 times. The model
|
|
11
|
+
* and texture caches beside it already assume the tree is fixed for the run,
|
|
12
|
+
* so this assumes the same and no more. Reads pass straight through.
|
|
13
|
+
*/
|
|
14
|
+
declare class CachedListingResourceManager implements ResourceManager {
|
|
15
|
+
private readonly inner;
|
|
16
|
+
private readonly listings;
|
|
17
|
+
private namespaces;
|
|
18
|
+
constructor(inner: ResourceManager);
|
|
19
|
+
getResource(kind: ResourceKindName, locator: ResourceLocator): Promise<Buffer | null>;
|
|
20
|
+
getAllResources(kind: ResourceKindName, locator: ResourceLocator): Promise<Buffer[]>;
|
|
21
|
+
hasResource(kind: ResourceKindName, locator: ResourceLocator): Promise<boolean>;
|
|
22
|
+
listResources(kind: ResourceKindName, namespace: string): Promise<ResourceLocator[]>;
|
|
23
|
+
listNamespaces(): Promise<string[]>;
|
|
24
|
+
describe(): ResourceDescriptor | null;
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { CachedListingResourceManager };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/resources/read-ahead.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Each item paired with its load, already started, in the order given; a fixed number of loads run
|
|
4
|
+
* ahead of the one the caller is awaiting.
|
|
5
|
+
*
|
|
6
|
+
* Whole-jar sweeps and atlas builds awaited one entry at a time, so every read paid its disk round trip
|
|
7
|
+
* and decode in series. The caller still awaits each load in order, so results, progress and the first
|
|
8
|
+
* failure land exactly where the one-at-a-time loop put them.
|
|
9
|
+
*/
|
|
10
|
+
declare function readAhead<Item, Result>(items: Iterable<Item>, load: (item: Item) => Promise<Result>): Generator<[Item, Promise<Result>]>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { readAhead };
|
|
@@ -2,11 +2,11 @@ import { n as ResourceLocator } from "./locator-COMEtEn9.js";
|
|
|
2
2
|
import { n as LayeredResourceManager } from "./manager-D6zXmFrO.js";
|
|
3
3
|
import { n as discoverItems } from "./discovery-CD0QqxSF.js";
|
|
4
4
|
import { t as curatedModelOverrides } from "./models-BsYA-NZg.js";
|
|
5
|
-
import { r as encodeRasterAsset } from "./encode-
|
|
5
|
+
import { r as encodeRasterAsset } from "./encode-TzYXOEId.js";
|
|
6
6
|
import { t as classifyItemStyle } from "./item-styles-BAeneY1R.js";
|
|
7
7
|
import { t as minifyStylesheet } from "./minify-bjMRmr5J.js";
|
|
8
|
-
import { t as generateStylesheet } from "./stylesheet-
|
|
9
|
-
import { t as ItemPipeline } from "./pipeline-
|
|
8
|
+
import { t as generateStylesheet } from "./stylesheet-C61VrCAV.js";
|
|
9
|
+
import { t as ItemPipeline } from "./pipeline-CCfkRth7.js";
|
|
10
10
|
import { t as describeResources } from "./descriptor-Dz2cR-BH.js";
|
|
11
11
|
import { t as WorkerRenderPool } from "./pool-CKGp1qup.js";
|
|
12
12
|
import path from "node:path";
|
|
@@ -62,8 +62,8 @@ async function run(options) {
|
|
|
62
62
|
});
|
|
63
63
|
const { resources } = pipeline;
|
|
64
64
|
const glint = await resolveEnchantmentGlint(resources);
|
|
65
|
-
if (!glint)
|
|
66
|
-
const encodedGlint = await encodeRasterAsset(glint, fallback ? ["png", format] : [format]);
|
|
65
|
+
if (!glint) options.onProgress?.(0, 0, "enchantment glint", "Missing enchantment glint texture (minecraft:misc/enchanted_glint_item or enchanted_item_glint); the stylesheet has no glint overlay");
|
|
66
|
+
const encodedGlint = glint ? await encodeRasterAsset(glint, fallback ? ["png", format] : [format]) : /* @__PURE__ */ new Map();
|
|
67
67
|
const ids = [];
|
|
68
68
|
const seen = /* @__PURE__ */ new Set();
|
|
69
69
|
if (options.builtin) for (const placeholder of ["renderchest:unknown", "renderchest:empty"]) {
|
|
@@ -164,7 +164,8 @@ async function run(options) {
|
|
|
164
164
|
const stylesheet = generateStylesheet(styles, {
|
|
165
165
|
prefix,
|
|
166
166
|
format,
|
|
167
|
-
fallback
|
|
167
|
+
fallback,
|
|
168
|
+
glint: glint !== null
|
|
168
169
|
});
|
|
169
170
|
const finalStylesheet = options.minify === false ? stylesheet : minifyStylesheet(stylesheet, (message) => options.onProgress?.(0, 0, "stylesheet", message));
|
|
170
171
|
await writeFile(path.join(options.output, `${prefix}${namespaces[0]}-${size}.css`), finalStylesheet);
|
package/dist/run.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { n as ResourceLocator } from "./locator-COMEtEn9.js";
|
|
2
|
+
import { t as readAhead } from "./read-ahead-BlSzTexs.js";
|
|
2
3
|
import { t as packAtlas } from "./atlas-pack-CoOih7By.js";
|
|
3
4
|
//#region src/blocks/sprite-sheet.ts
|
|
4
5
|
/**
|
|
@@ -75,11 +76,12 @@ async function buildSpriteSheet(ids, textures, options = {}) {
|
|
|
75
76
|
const missing = /* @__PURE__ */ new Set();
|
|
76
77
|
const loaded = [];
|
|
77
78
|
let done = 0;
|
|
78
|
-
|
|
79
|
+
const sorted = [...wanted].toSorted((left, right) => left.localeCompare(right));
|
|
80
|
+
for (const [id, pending] of readAhead(sorted, async (name) => textures.loadAnimated(ResourceLocator.parse(name)))) {
|
|
79
81
|
options.onProgress?.(++done, wanted.size);
|
|
80
82
|
let animated;
|
|
81
83
|
try {
|
|
82
|
-
animated = await
|
|
84
|
+
animated = await pending;
|
|
83
85
|
} catch (err) {
|
|
84
86
|
failures.push({
|
|
85
87
|
id,
|
|
@@ -60,10 +60,12 @@ function generateStylesheet(items, options = {}) {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
if (options.glint ?? true) {
|
|
64
|
+
const glintSelectors = [...enchantedSelectors, `.${prefix}enchanted:after`];
|
|
65
|
+
const glint = `${glintSelectors.join(",\n")} {\n position: absolute;\n width: 200%;\n height: 200%;\n top: -50%;\n left: -50%;\n image-rendering: pixelated;\n mix-blend-mode: screen;\n content: '';\n opacity: 0.6;\n background-image: ${url(`${prefix}enchantment.${baseExtension}`, urlPrefix)};\n background-size: 512px 512px;\n filter: blur(2px) contrast(200%);\n transform: rotate(-8deg);\n animation-name: ${prefix}enchanted;\n animation-duration: 32s;\n animation-timing-function: linear;\n animation-iteration-count: infinite;\n}`;
|
|
66
|
+
blocks.push(glint);
|
|
67
|
+
upgrade.push(`${glintSelectors.join(", ")} { background-image: ${url(`${prefix}enchantment.${format}`, urlPrefix)}; }`);
|
|
68
|
+
}
|
|
67
69
|
if (fallback) blocks.push(`@media (min-resolution: 1dpi) {\n${upgrade.map((rule) => ` ${rule}`).join("\n")}\n}`);
|
|
68
70
|
return blocks.join("\n\n");
|
|
69
71
|
}
|
|
@@ -14,6 +14,8 @@ interface StylesheetOptions {
|
|
|
14
14
|
format?: 'webp' | 'avif';
|
|
15
15
|
/** Emit the base rules in png plus a media-query upgrade block. */
|
|
16
16
|
fallback?: boolean;
|
|
17
|
+
/** Emit the enchant glint overlay (default true); off when there is no glint image to point it at. */
|
|
18
|
+
glint?: boolean;
|
|
17
19
|
}
|
|
18
20
|
interface ItemStyle {
|
|
19
21
|
/** Item id, e.g. `minecraft:stone`. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as ItemPipeline } from "../pipeline-
|
|
1
|
+
import { t as ItemPipeline } from "../pipeline-CCfkRth7.js";
|
|
2
2
|
import { n as restoreResources } from "../descriptor-Dz2cR-BH.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.10.
|
|
3
|
+
"version": "1.10.2",
|
|
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",
|