@nodecraft/rendermite 1.0.4 → 1.0.5
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/assets/README.md +3 -0
- package/assets/mod-tints/README.md +38 -0
- package/assets/mod-tints/advanced_ae/items/quantum_boots.json +16 -0
- package/assets/mod-tints/advanced_ae/items/quantum_chestplate.json +16 -0
- package/assets/mod-tints/advanced_ae/items/quantum_helmet.json +16 -0
- package/assets/mod-tints/advanced_ae/items/quantum_leggings.json +16 -0
- package/dist/{builtin-C8GZEN40.js → builtin-caYjESh0.js} +5 -1
- package/dist/builtin.d.ts +3 -1
- package/dist/builtin.js +2 -2
- package/dist/cli.js +31 -4
- package/dist/{entity-fallback-CdCVEG6X.js → entity-fallback-DfL0_eyf.js} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/items/discovery.js +1 -1
- package/dist/mods/prepare.d.ts +1 -1
- package/dist/mods/prepare.js +1 -1
- package/dist/mods/tints.d.ts +28 -0
- package/dist/mods/tints.js +2 -0
- package/dist/{prepare-Bvc5ve2m.js → prepare-BeUpXwaP.js} +30 -2
- package/dist/{prepare-DnnGGv9k.d.ts → prepare-gfR1aIjt.d.ts} +7 -0
- package/dist/render/entity-fallback.js +1 -1
- package/dist/render/geo.js +1 -1
- package/dist/render/obj.js +1 -1
- package/dist/render/renderer.js +1 -1
- package/dist/{run-DI-cB38y.js → run-CfnWIRY4.js} +5 -5
- package/dist/run.js +1 -1
- package/dist/tints-CuG6GwQJ.js +83 -0
- package/dist/versions/prepare.js +1 -1
- package/package.json +1 -1
- package/dist/{discovery-iph0P2F2.js → discovery-0SM0cTLw.js} +1 -1
- package/dist/{geo-u8rndjLA.js → geo-Dq2zve09.js} +1 -1
- package/dist/{prepare-DROxBZp1.js → prepare-C8wRjAXP.js} +1 -1
- package/dist/{renderer-BeOinVC8.js → renderer-LDhBNHcl.js} +1 -1
package/assets/README.md
CHANGED
|
@@ -15,3 +15,6 @@ generators).
|
|
|
15
15
|
|
|
16
16
|
Layout is `<namespace>/<models|textures|items|atlases>/…` (no `assets/` nesting) — mount with
|
|
17
17
|
`FolderResourceManager` above the version's own assets.
|
|
18
|
+
|
|
19
|
+
`mod-tints/` is ours rather than vendored: curated item definitions for mod items that
|
|
20
|
+
register their tint colors in client code. See `mod-tints/README.md`.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Curated mod tint overrides
|
|
2
|
+
|
|
3
|
+
Item definitions for mod items whose tint colors are registered in client Java code and
|
|
4
|
+
therefore appear in no release's asset JSON. Layout is `<namespace>/items/<id>.json`, the
|
|
5
|
+
vanilla 1.21.4+ item-definition format, mounted with `FolderResourceManager` (see
|
|
6
|
+
`src/mods/tints.ts`). Nothing in the renderer special-cases these files.
|
|
7
|
+
|
|
8
|
+
## Precedence
|
|
9
|
+
|
|
10
|
+
This pack layers **above** the mod jars, unlike harvested overrides (which layer below so a
|
|
11
|
+
mod's own data always wins). Curated entries exist because the mod ships no usable data in
|
|
12
|
+
any release, and in the modern era the mod's own definition is typically an unrenderable
|
|
13
|
+
code-driven model type that would shadow the override. Delete an entry once the mod ships a
|
|
14
|
+
release that states the tint as data: the harvester will then source it authoritatively.
|
|
15
|
+
|
|
16
|
+
## Adding an entry
|
|
17
|
+
|
|
18
|
+
Every entry needs its provenance recorded below, because these values are the only ones in
|
|
19
|
+
the project that cannot be traced to a jar. Hold a slot open with
|
|
20
|
+
`{"type": "minecraft:constant", "value": -1}` when a layer takes no tint. Values are signed
|
|
21
|
+
ARGB ints, matching vanilla's own definition files.
|
|
22
|
+
|
|
23
|
+
## Entries
|
|
24
|
+
|
|
25
|
+
### `advanced_ae` quantum armor (helmet, chestplate, leggings, boots)
|
|
26
|
+
|
|
27
|
+
`#7110a5` on layer 1, sourced by eye and **not** verifiable against any jar. Checked:
|
|
28
|
+
|
|
29
|
+
- 1.21.1 models are `layer0: <piece>_base` + `layer1: <piece>_tint`, and both textures are
|
|
30
|
+
fully grayscale, so nothing renders colored without an external value.
|
|
31
|
+
- The 26.1.x definitions use `"type": "advanced_ae:quantum_armor"` with no `tints` at all.
|
|
32
|
+
- `0x7110A5` appears in no class constant pool in AdvancedAE 1.21.1, AdvancedAE 26.1.7, or
|
|
33
|
+
AE2 1.21.1.
|
|
34
|
+
|
|
35
|
+
The mod's own `quantum_crafter_terminal_part` tints with `ae2:color` (`color: fluix`), so
|
|
36
|
+
these pieces are very likely AE2's fluix purple. Teaching `resolveTint` the `ae2:color`
|
|
37
|
+
palette would replace these four files with a sourced value and cover ~116 other AE2-family
|
|
38
|
+
items that currently resolve no tint at all.
|
|
@@ -12,5 +12,9 @@ function builtinPackPath(era) {
|
|
|
12
12
|
function bedCompatPath() {
|
|
13
13
|
return path.join(assetsRoot, "builtin-bed-compat");
|
|
14
14
|
}
|
|
15
|
+
/** Curated tint overrides for mod items that register their colors in code. */
|
|
16
|
+
function modTintPackPath() {
|
|
17
|
+
return path.join(assetsRoot, "mod-tints");
|
|
18
|
+
}
|
|
15
19
|
//#endregion
|
|
16
|
-
export { builtinPackPath as n, bedCompatPath as t };
|
|
20
|
+
export { builtinPackPath as n, modTintPackPath as r, bedCompatPath as t };
|
package/dist/builtin.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
//#region src/builtin.d.ts
|
|
2
2
|
declare function builtinPackPath(era: 'modern' | 'legacy'): string;
|
|
3
3
|
declare function bedCompatPath(): string;
|
|
4
|
+
/** Curated tint overrides for mod items that register their colors in code. */
|
|
5
|
+
declare function modTintPackPath(): string;
|
|
4
6
|
//#endregion
|
|
5
|
-
export { bedCompatPath, builtinPackPath };
|
|
7
|
+
export { bedCompatPath, builtinPackPath, modTintPackPath };
|
package/dist/builtin.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as builtinPackPath, t as bedCompatPath } from "./builtin-
|
|
2
|
-
export { bedCompatPath, builtinPackPath };
|
|
1
|
+
import { n as builtinPackPath, r as modTintPackPath, t as bedCompatPath } from "./builtin-caYjESh0.js";
|
|
2
|
+
export { bedCompatPath, builtinPackPath, modTintPackPath };
|
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { n as builtinPackPath, t as bedCompatPath } from "./builtin-
|
|
2
|
+
import { n as builtinPackPath, t as bedCompatPath } from "./builtin-caYjESh0.js";
|
|
3
3
|
import { n as LayeredResourceManager, t as FolderResourceManager } from "./manager-dfI7b9N4.js";
|
|
4
|
+
import { n as harvestTintOverrides, t as curatedTintOverrides } from "./tints-CuG6GwQJ.js";
|
|
4
5
|
import { t as JarResourceManager } from "./jar-Bt3i0ls4.js";
|
|
5
|
-
import { t as run } from "./run-
|
|
6
|
+
import { t as run } from "./run-CfnWIRY4.js";
|
|
6
7
|
import { t as downloadClientJar } from "./download-D9aARBFp.js";
|
|
7
|
-
import { a as prepareVersionResources, i as eraForVersion, n as GEOMETRY_DONOR_VERSIONS } from "./prepare-
|
|
8
|
+
import { a as prepareVersionResources, i as eraForVersion, n as GEOMETRY_DONOR_VERSIONS } from "./prepare-C8wRjAXP.js";
|
|
8
9
|
import path from "node:path";
|
|
9
10
|
import os from "node:os";
|
|
10
11
|
import { parseArgs } from "node:util";
|
|
@@ -30,6 +31,10 @@ const { values } = parseArgs({ options: {
|
|
|
30
31
|
short: "m",
|
|
31
32
|
multiple: true
|
|
32
33
|
},
|
|
34
|
+
"tint-donor": {
|
|
35
|
+
type: "string",
|
|
36
|
+
multiple: true
|
|
37
|
+
},
|
|
33
38
|
"namespace": {
|
|
34
39
|
type: "string",
|
|
35
40
|
short: "n",
|
|
@@ -101,6 +106,7 @@ Input:
|
|
|
101
106
|
-v, --version <ver> download + prepare a vanilla version (1.2.5 … latest)
|
|
102
107
|
-a, --assets <dir> asset root (repeatable, first wins), <namespace>/ children
|
|
103
108
|
-m, --mod <jar> mod jar layered under vanilla (repeatable)
|
|
109
|
+
--tint-donor <jar> 1.21.4+ jar of a loaded mod, read for its tints (repeatable)
|
|
104
110
|
|
|
105
111
|
Options:
|
|
106
112
|
-n, --namespace <ns> namespace to render (repeatable, default: minecraft)
|
|
@@ -147,7 +153,28 @@ if (values.version) {
|
|
|
147
153
|
resources = managers.length === 1 ? managers[0] : new LayeredResourceManager(managers);
|
|
148
154
|
builtin ??= builtinPackPath("modern");
|
|
149
155
|
}
|
|
150
|
-
if (values
|
|
156
|
+
if (values["tint-donor"]?.length && !values.mod?.length) {
|
|
157
|
+
console.error("--tint-donor needs --mod: donors are read for the tints of loaded mods.");
|
|
158
|
+
process.exit(1);
|
|
159
|
+
}
|
|
160
|
+
if (values.mod?.length) {
|
|
161
|
+
const base = new LayeredResourceManager([
|
|
162
|
+
resources,
|
|
163
|
+
curatedTintOverrides(),
|
|
164
|
+
...values.mod.map((jar) => new JarResourceManager(jar))
|
|
165
|
+
]);
|
|
166
|
+
resources = base;
|
|
167
|
+
if (values["tint-donor"]?.length) {
|
|
168
|
+
const donorJars = values["tint-donor"].map((jar) => new JarResourceManager(jar));
|
|
169
|
+
const harvest = await harvestTintOverrides({
|
|
170
|
+
donors: new LayeredResourceManager(donorJars),
|
|
171
|
+
target: base
|
|
172
|
+
});
|
|
173
|
+
await Promise.all(donorJars.map((jar) => jar.close().catch(() => {})));
|
|
174
|
+
console.log(`Harvested tints for ${harvest.harvested} items from ${donorJars.length} donor jars`);
|
|
175
|
+
if (harvest.harvested > 0) resources = new LayeredResourceManager([base, harvest.overrides]);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
151
178
|
const result = await run({
|
|
152
179
|
resources,
|
|
153
180
|
builtin,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as ResourceLocator } from "./locator-ycZzh_6z.js";
|
|
2
|
-
import { i as renderModel } from "./renderer-
|
|
2
|
+
import { i as renderModel } from "./renderer-LDhBNHcl.js";
|
|
3
3
|
//#region src/render/entity-fallback.ts
|
|
4
4
|
/**
|
|
5
5
|
* Heuristic rendering for mod items that parent `builtin/entity` — chests,
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { a as resolveTint, i as parseTintValue, n as InvalidTinterDefinitionErro
|
|
|
13
13
|
import { i as EncodedIcon, n as EncodeOptions, o as encodeAnimatedIcon, r as EncodedAnimatedIcon, s as encodeIcon, t as AnimatedEncodeOptions } from "./encode-C5kdAm45.js";
|
|
14
14
|
import { t as minifyStylesheet } from "./minify-CIV6enbr.js";
|
|
15
15
|
import { a as compareVersions, o as eraForVersion, s as prepareVersionResources } from "./prepare-wfWtaz_X.js";
|
|
16
|
-
import { i as prepareModResources } from "./prepare-
|
|
16
|
+
import { i as prepareModResources } from "./prepare-gfR1aIjt.js";
|
|
17
17
|
import { i as itemClass, n as StylesheetOptions, r as generateStylesheet, t as ItemStyle } from "./stylesheet-i-t_7sZ7.js";
|
|
18
18
|
import { i as run, n as RunOptions, r as RunResult, t as ItemFailure } from "./run-BlSZw9Qk.js";
|
|
19
19
|
import { n as UnsafeJarError, r as isUnsafeEntryPath, t as JarResourceManager } from "./jar-6T3xdgaL.js";
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
+
import { a as defaultProperties, i as UNKNOWN_MODEL, n as InvalidItemDefinitionError, o as evaluateItemModel } from "./definition-3MBm8ar_.js";
|
|
1
2
|
import { n as ResourceLocator, t as InvalidResourceLocatorError } from "./locator-ycZzh_6z.js";
|
|
2
3
|
import { n as LayeredResourceManager, r as ResourceKind, t as FolderResourceManager } from "./manager-dfI7b9N4.js";
|
|
3
4
|
import { n as UnsafeJarError, r as isUnsafeEntryPath, t as JarResourceManager } from "./jar-Bt3i0ls4.js";
|
|
4
5
|
import { o as createAtlasResolver, s as parseAtlasSources, t as AtlasSourceError } from "./sources-Bxk-WOzH.js";
|
|
5
6
|
import { a as builtinDynamicResources } from "./generators-CcVRG30y.js";
|
|
6
|
-
import {
|
|
7
|
-
import { n as discoverItems, r as resolveItem, t as ItemResolutionError } from "./discovery-iph0P2F2.js";
|
|
7
|
+
import { n as discoverItems, r as resolveItem, t as ItemResolutionError } from "./discovery-0SM0cTLw.js";
|
|
8
8
|
import { a as salvageJson, i as resolveTexture, n as ModelResolutionError, t as ModelLoader } from "./loader-A-BZa8J4.js";
|
|
9
9
|
import { o as toByteTexture, s as toFloatTexture } from "./blend-CHP2-j9U.js";
|
|
10
10
|
import { n as encodeIcon, t as encodeAnimatedIcon } from "./encode-3u49i-eD.js";
|
|
11
11
|
import { t as minifyStylesheet } from "./minify-bjMRmr5J.js";
|
|
12
12
|
import { n as itemClass, t as generateStylesheet } from "./stylesheet-CovT3B2S.js";
|
|
13
13
|
import { c as lightsForProfile, r as LightingProfile } from "./lighting--5myudVu.js";
|
|
14
|
-
import { a as renderModelFrames, i as renderModel, n as boxDownscale, r as pointResize, t as ItemRenderError } from "./renderer-
|
|
14
|
+
import { a as renderModelFrames, i as renderModel, n as boxDownscale, r as pointResize, t as ItemRenderError } from "./renderer-LDhBNHcl.js";
|
|
15
15
|
import { a as resolveTints, i as resolveTint, n as InvalidTinterDefinitionError, r as parseTintValue, t as DYE_COLORS } from "./tints-BtbHegpI.js";
|
|
16
16
|
import { n as TextureLoader, r as TextureResolutionError, t as AnimatedTexture } from "./loader-CBzn3Koc.js";
|
|
17
|
-
import { t as run } from "./run-
|
|
18
|
-
import { a as prepareVersionResources, i as eraForVersion, r as compareVersions } from "./prepare-
|
|
19
|
-
import { n as prepareModResources } from "./prepare-
|
|
17
|
+
import { t as run } from "./run-CfnWIRY4.js";
|
|
18
|
+
import { a as prepareVersionResources, i as eraForVersion, r as compareVersions } from "./prepare-C8wRjAXP.js";
|
|
19
|
+
import { n as prepareModResources } from "./prepare-BeUpXwaP.js";
|
|
20
20
|
export { AnimatedTexture, AtlasSourceError, DYE_COLORS, FolderResourceManager, InvalidItemDefinitionError, InvalidResourceLocatorError, InvalidTinterDefinitionError, ItemRenderError, ItemResolutionError, JarResourceManager, LayeredResourceManager, LightingProfile, ModelLoader, ModelResolutionError, ResourceKind, ResourceLocator, TextureLoader, TextureResolutionError, UNKNOWN_MODEL, UnsafeJarError, boxDownscale, builtinDynamicResources, compareVersions, createAtlasResolver, defaultProperties, discoverItems, encodeAnimatedIcon, encodeIcon, eraForVersion, evaluateItemModel, generateStylesheet, isUnsafeEntryPath, itemClass, lightsForProfile, minifyStylesheet, parseAtlasSources, parseTintValue, pointResize, prepareModResources, prepareVersionResources, renderModel, renderModelFrames, resolveItem, resolveTexture, resolveTint, resolveTints, run, salvageJson, toByteTexture, toFloatTexture };
|
package/dist/items/discovery.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as discoverItems, r as resolveItem, t as ItemResolutionError } from "../discovery-
|
|
1
|
+
import { n as discoverItems, r as resolveItem, t as ItemResolutionError } from "../discovery-0SM0cTLw.js";
|
|
2
2
|
export { ItemResolutionError, discoverItems, resolveItem };
|
package/dist/mods/prepare.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as prepareModResources, n as ModPreparation, r as PrepareModsOptions, t as LOADER_NAMESPACES } from "../prepare-
|
|
1
|
+
import { i as prepareModResources, n as ModPreparation, r as PrepareModsOptions, t as LOADER_NAMESPACES } from "../prepare-gfR1aIjt.js";
|
|
2
2
|
export { LOADER_NAMESPACES, ModPreparation, PrepareModsOptions, prepareModResources };
|
package/dist/mods/prepare.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as prepareModResources, t as LOADER_NAMESPACES } from "../prepare-
|
|
1
|
+
import { n as prepareModResources, t as LOADER_NAMESPACES } from "../prepare-BeUpXwaP.js";
|
|
2
2
|
export { LOADER_NAMESPACES, prepareModResources };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { a as ResourceManager } from "../manager-CoZaeQTu.js";
|
|
2
|
+
import { n as MapResourceManager } from "../synthetic-CDsj--li.js";
|
|
3
|
+
//#region src/mods/tints.d.ts
|
|
4
|
+
interface HarvestTintsOptions {
|
|
5
|
+
/** Assets from 1.21.4+ releases of the same mods, read only for their tints. */
|
|
6
|
+
donors: ResourceManager;
|
|
7
|
+
/** The tree being rendered; only items it already models are given overrides. */
|
|
8
|
+
target: ResourceManager;
|
|
9
|
+
/** Namespaces to harvest; defaults to every mod namespace the donors declare. */
|
|
10
|
+
namespaces?: string[];
|
|
11
|
+
}
|
|
12
|
+
interface HarvestedTints {
|
|
13
|
+
overrides: MapResourceManager;
|
|
14
|
+
/** Items given a tint override — reported so a harvest is never silent. */
|
|
15
|
+
harvested: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Copy resolvable tints from a donor's item definitions onto the target's own
|
|
19
|
+
* item models. Only the static GUI branch of a donor definition is read, and
|
|
20
|
+
* only when it resolves to a single model: a composite has no one old model to
|
|
21
|
+
* bind to. Slots the donor leaves to runtime state are held open rather than
|
|
22
|
+
* dropped, keeping every later tint on the layer it belongs to.
|
|
23
|
+
*/
|
|
24
|
+
declare function harvestTintOverrides(options: HarvestTintsOptions): Promise<HarvestedTints>;
|
|
25
|
+
/** The vendored curated overrides (see assets/mod-tints/README.md). */
|
|
26
|
+
declare function curatedTintOverrides(): ResourceManager;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { HarvestTintsOptions, HarvestedTints, curatedTintOverrides, harvestTintOverrides };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { n as LayeredResourceManager } from "./manager-dfI7b9N4.js";
|
|
2
|
+
import { n as harvestTintOverrides, t as curatedTintOverrides } from "./tints-CuG6GwQJ.js";
|
|
2
3
|
import { n as UnsafeJarError, t as JarResourceManager } from "./jar-Bt3i0ls4.js";
|
|
3
4
|
import { t as synthesizeItemModels } from "./synthesize-CRgSEmEp.js";
|
|
4
5
|
//#region src/mods/prepare.ts
|
|
@@ -43,7 +44,11 @@ async function prepareModResources(options) {
|
|
|
43
44
|
await manager.close().catch(() => {});
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
|
-
const base = new LayeredResourceManager([
|
|
47
|
+
const base = new LayeredResourceManager([
|
|
48
|
+
options.vanilla,
|
|
49
|
+
curatedTintOverrides(),
|
|
50
|
+
...jarLayers
|
|
51
|
+
]);
|
|
47
52
|
const namespaces = [];
|
|
48
53
|
let synthesized = 0;
|
|
49
54
|
const synthLayers = [];
|
|
@@ -57,10 +62,33 @@ async function prepareModResources(options) {
|
|
|
57
62
|
options.onProgress?.(`Synthesized ${result.synthesized} item models for ${namespace}`);
|
|
58
63
|
}
|
|
59
64
|
}
|
|
65
|
+
let tintOverrides = 0;
|
|
66
|
+
const tintLayers = [];
|
|
67
|
+
if (options.tintDonors?.length) {
|
|
68
|
+
const donorJars = options.tintDonors.map((jar) => new JarResourceManager(jar));
|
|
69
|
+
try {
|
|
70
|
+
const harvest = await harvestTintOverrides({
|
|
71
|
+
donors: new LayeredResourceManager(donorJars),
|
|
72
|
+
target: base
|
|
73
|
+
});
|
|
74
|
+
if (harvest.harvested > 0) {
|
|
75
|
+
tintLayers.push(harvest.overrides);
|
|
76
|
+
tintOverrides = harvest.harvested;
|
|
77
|
+
options.onProgress?.(`Harvested tints for ${harvest.harvested} items from ${donorJars.length} donor jars`);
|
|
78
|
+
}
|
|
79
|
+
} finally {
|
|
80
|
+
await Promise.all(donorJars.map((jar) => jar.close().catch(() => {})));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
60
83
|
return {
|
|
61
|
-
resources: new LayeredResourceManager([
|
|
84
|
+
resources: new LayeredResourceManager([
|
|
85
|
+
base,
|
|
86
|
+
...synthLayers,
|
|
87
|
+
...tintLayers
|
|
88
|
+
]),
|
|
62
89
|
namespaces,
|
|
63
90
|
synthesized,
|
|
91
|
+
tintOverrides,
|
|
64
92
|
rejected
|
|
65
93
|
};
|
|
66
94
|
}
|
|
@@ -8,6 +8,8 @@ interface ModPreparation {
|
|
|
8
8
|
namespaces: string[];
|
|
9
9
|
/** Models synthesized for texture-only namespaces. */
|
|
10
10
|
synthesized: number;
|
|
11
|
+
/** Items given a tint harvested from a donor jar. */
|
|
12
|
+
tintOverrides: number;
|
|
11
13
|
/** Jars rejected (unsafe entries) or unreadable, with reasons. */
|
|
12
14
|
rejected: Array<{
|
|
13
15
|
jar: string;
|
|
@@ -18,6 +20,11 @@ interface PrepareModsOptions {
|
|
|
18
20
|
jars: string[];
|
|
19
21
|
/** Vanilla assets for the target version (wins the minecraft namespace). */
|
|
20
22
|
vanilla: ResourceManager;
|
|
23
|
+
/**
|
|
24
|
+
* Jars from 1.21.4+ releases of the same mods, read only for the tints their
|
|
25
|
+
* item definitions state as data (see src/mods/tints.ts).
|
|
26
|
+
*/
|
|
27
|
+
tintDonors?: string[];
|
|
21
28
|
onProgress?: (message: string) => void;
|
|
22
29
|
}
|
|
23
30
|
declare function prepareModResources(options: PrepareModsOptions): Promise<ModPreparation>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as renderEntityFallback, r as spawnEggTints, t as renderDyedVariantFallback } from "../entity-fallback-
|
|
1
|
+
import { n as renderEntityFallback, r as spawnEggTints, t as renderDyedVariantFallback } from "../entity-fallback-DfL0_eyf.js";
|
|
2
2
|
export { renderDyedVariantFallback, renderEntityFallback, spawnEggTints };
|
package/dist/render/geo.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as renderGeo, n as geoToFaces, r as parseGeo, t as findGeoForItem } from "../geo-
|
|
1
|
+
import { i as renderGeo, n as geoToFaces, r as parseGeo, t as findGeoForItem } from "../geo-Dq2zve09.js";
|
|
2
2
|
export { findGeoForItem, geoToFaces, parseGeo, renderGeo };
|
package/dist/render/obj.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { c as renderObjModel, o as parseMtl, s as parseObj } from "../renderer-
|
|
1
|
+
import { c as renderObjModel, o as parseMtl, s as parseObj } from "../renderer-LDhBNHcl.js";
|
|
2
2
|
export { parseMtl, parseObj, renderObjModel };
|
package/dist/render/renderer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as renderModelFrames, i as renderModel, n as boxDownscale, r as pointResize, t as ItemRenderError } from "../renderer-
|
|
1
|
+
import { a as renderModelFrames, i as renderModel, n as boxDownscale, r as pointResize, t as ItemRenderError } from "../renderer-LDhBNHcl.js";
|
|
2
2
|
export { ItemRenderError, boxDownscale, pointResize, renderModel, renderModelFrames };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
+
import { a as defaultProperties } from "./definition-3MBm8ar_.js";
|
|
1
2
|
import { n as ResourceLocator } from "./locator-ycZzh_6z.js";
|
|
2
3
|
import { n as LayeredResourceManager, t as FolderResourceManager } from "./manager-dfI7b9N4.js";
|
|
3
4
|
import { t as loadAtlasResolver } from "./registry-B9TcjVbs.js";
|
|
4
5
|
import { a as builtinDynamicResources } from "./generators-CcVRG30y.js";
|
|
5
|
-
import {
|
|
6
|
-
import { n as discoverItems, r as resolveItem } from "./discovery-iph0P2F2.js";
|
|
6
|
+
import { n as discoverItems, r as resolveItem } from "./discovery-0SM0cTLw.js";
|
|
7
7
|
import { t as ModelLoader } from "./loader-A-BZa8J4.js";
|
|
8
8
|
import { s as toFloatTexture, t as blendPixel } from "./blend-CHP2-j9U.js";
|
|
9
9
|
import { r as encodeRasterAsset, t as encodeAnimatedIcon } from "./encode-3u49i-eD.js";
|
|
10
10
|
import { t as classifyItemStyle } from "./item-styles-DJ3LWZS2.js";
|
|
11
11
|
import { t as minifyStylesheet } from "./minify-bjMRmr5J.js";
|
|
12
12
|
import { t as generateStylesheet } from "./stylesheet-CovT3B2S.js";
|
|
13
|
-
import { a as renderModelFrames, i as renderModel, n as boxDownscale, r as pointResize } from "./renderer-
|
|
14
|
-
import { n as renderEntityFallback, r as spawnEggTints, t as renderDyedVariantFallback } from "./entity-fallback-
|
|
15
|
-
import { i as renderGeo, t as findGeoForItem } from "./geo-
|
|
13
|
+
import { a as renderModelFrames, i as renderModel, n as boxDownscale, r as pointResize } from "./renderer-LDhBNHcl.js";
|
|
14
|
+
import { n as renderEntityFallback, r as spawnEggTints, t as renderDyedVariantFallback } from "./entity-fallback-DfL0_eyf.js";
|
|
15
|
+
import { i as renderGeo, t as findGeoForItem } from "./geo-Dq2zve09.js";
|
|
16
16
|
import { t as legacyTintsForChain } from "./legacy-tints-B09J0Rxh.js";
|
|
17
17
|
import { a as resolveTints } from "./tints-BtbHegpI.js";
|
|
18
18
|
import { n as TextureLoader } from "./loader-CBzn3Koc.js";
|
package/dist/run.js
CHANGED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { r as modTintPackPath } from "./builtin-caYjESh0.js";
|
|
2
|
+
import { a as defaultProperties, o as evaluateItemModel } from "./definition-3MBm8ar_.js";
|
|
3
|
+
import { n as ResourceLocator } from "./locator-ycZzh_6z.js";
|
|
4
|
+
import { t as FolderResourceManager } from "./manager-dfI7b9N4.js";
|
|
5
|
+
import { n as MapResourceManager } from "./synthetic-DC2bSnGe.js";
|
|
6
|
+
//#region src/mods/tints.ts
|
|
7
|
+
/**
|
|
8
|
+
* Tints for mod items whose colors live in client code rather than asset JSON.
|
|
9
|
+
* Both sources here emit ordinary 1.21.4+ item definitions, so nothing new
|
|
10
|
+
* renders them: `resolveItem` reads definitions in every era and `resolveTint`
|
|
11
|
+
* already accepts a `default` from any tint type.
|
|
12
|
+
*
|
|
13
|
+
* - Harvested: a mod's own 1.21.4+ release states its tints as data, making a
|
|
14
|
+
* newer jar of the same mod an authoritative donor for its older jars — the
|
|
15
|
+
* trick GEOMETRY_DONOR_VERSIONS plays for pre-1.8 geometry. Derived, so it
|
|
16
|
+
* layers BELOW the real tree and the mod's own data always wins.
|
|
17
|
+
* - Curated (`assets/mod-tints/`): the residue no release ever turned into data
|
|
18
|
+
* (AdvancedAE's quantum armor ships a code-driven model type in both eras).
|
|
19
|
+
* Hand-authored per item, so it layers ABOVE the mod jars: below them, an
|
|
20
|
+
* unrenderable code-model definition would shadow it in the modern era.
|
|
21
|
+
*/
|
|
22
|
+
/** Holds a tint slot's position without painting it (parseTintValue reads -1 as no tint). */
|
|
23
|
+
const NO_TINT = {
|
|
24
|
+
type: "minecraft:constant",
|
|
25
|
+
value: -1
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* The color a tint resolves to with no game running: a constant's value, or any
|
|
29
|
+
* type's `default`. `undefined` means the tint needs runtime state (`ae2:color`,
|
|
30
|
+
* `ae2:storage_cell_state`), so only the game itself could resolve it.
|
|
31
|
+
*/
|
|
32
|
+
function staticValue(tint) {
|
|
33
|
+
if ((typeof tint.type === "string" && tint.type.includes(":") ? tint.type : `minecraft:${String(tint.type)}`) === "minecraft:constant") return tint.value;
|
|
34
|
+
return Object.hasOwn(tint, "default") ? tint.default : void 0;
|
|
35
|
+
}
|
|
36
|
+
/** Whether a static value actually paints (null/-1 are vanilla's "leave this layer alone"). */
|
|
37
|
+
function paints(value) {
|
|
38
|
+
return value !== void 0 && value !== null && value !== -1;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Copy resolvable tints from a donor's item definitions onto the target's own
|
|
42
|
+
* item models. Only the static GUI branch of a donor definition is read, and
|
|
43
|
+
* only when it resolves to a single model: a composite has no one old model to
|
|
44
|
+
* bind to. Slots the donor leaves to runtime state are held open rather than
|
|
45
|
+
* dropped, keeping every later tint on the layer it belongs to.
|
|
46
|
+
*/
|
|
47
|
+
async function harvestTintOverrides(options) {
|
|
48
|
+
const overrides = new MapResourceManager();
|
|
49
|
+
let harvested = 0;
|
|
50
|
+
const namespaces = (options.namespaces ?? await options.donors.listNamespaces()).filter((namespace) => namespace !== "minecraft");
|
|
51
|
+
for (const namespace of namespaces) for (const locator of await options.donors.listResources("itemDefinition", namespace)) {
|
|
52
|
+
const raw = await options.donors.getResource("itemDefinition", locator);
|
|
53
|
+
if (!raw) continue;
|
|
54
|
+
let tints;
|
|
55
|
+
try {
|
|
56
|
+
const parsed = JSON.parse(raw.toString("utf8"));
|
|
57
|
+
const instructions = evaluateItemModel(parsed.model, defaultProperties());
|
|
58
|
+
if (instructions.length !== 1) continue;
|
|
59
|
+
tints = instructions[0].tints;
|
|
60
|
+
} catch {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (!tints.some((tint) => paints(staticValue(tint)))) continue;
|
|
64
|
+
const model = new ResourceLocator(locator.namespace, `item/${locator.path}`);
|
|
65
|
+
if (await options.target.hasResource("itemDefinition", locator) || !await options.target.hasResource("model", model)) continue;
|
|
66
|
+
overrides.set("itemDefinition", locator, JSON.stringify({ model: {
|
|
67
|
+
type: "minecraft:model",
|
|
68
|
+
model: model.toString(),
|
|
69
|
+
tints: tints.map((tint) => staticValue(tint) === void 0 ? NO_TINT : tint)
|
|
70
|
+
} }));
|
|
71
|
+
harvested++;
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
overrides,
|
|
75
|
+
harvested
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/** The vendored curated overrides (see assets/mod-tints/README.md). */
|
|
79
|
+
function curatedTintOverrides() {
|
|
80
|
+
return new FolderResourceManager(modTintPackPath());
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
export { harvestTintOverrides as n, curatedTintOverrides as t };
|
package/dist/versions/prepare.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as prepareVersionResources, i as eraForVersion, n as GEOMETRY_DONOR_VERSIONS, r as compareVersions, t as Era } from "../prepare-
|
|
1
|
+
import { a as prepareVersionResources, i as eraForVersion, n as GEOMETRY_DONOR_VERSIONS, r as compareVersions, t as Era } from "../prepare-C8wRjAXP.js";
|
|
2
2
|
export { Era, GEOMETRY_DONOR_VERSIONS, compareVersions, eraForVersion, prepareVersionResources };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nodecraft/rendermite",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
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
|
-
import { n as ResourceLocator } from "./locator-ycZzh_6z.js";
|
|
2
1
|
import { o as identity } from "./vector-CCxLae_T.js";
|
|
3
2
|
import { o as evaluateItemModel } from "./definition-3MBm8ar_.js";
|
|
3
|
+
import { n as ResourceLocator } from "./locator-ycZzh_6z.js";
|
|
4
4
|
//#region src/items/discovery.ts
|
|
5
5
|
/**
|
|
6
6
|
* Era-adaptive item discovery — the piece no single renderchest tag has:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as ResourceLocator } from "./locator-ycZzh_6z.js";
|
|
2
1
|
import { n as displayMatrix } from "./vector-CCxLae_T.js";
|
|
2
|
+
import { n as ResourceLocator } from "./locator-ycZzh_6z.js";
|
|
3
3
|
import { s as toFloatTexture } from "./blend-CHP2-j9U.js";
|
|
4
4
|
import { t as combineFaceBuffers } from "./compose-qjhyBvnS.js";
|
|
5
5
|
import { n as renderFace, t as faceMaxZ } from "./face-D-N1amV4.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as ResourceLocator } from "./locator-ycZzh_6z.js";
|
|
2
2
|
import { n as LayeredResourceManager, t as FolderResourceManager } from "./manager-dfI7b9N4.js";
|
|
3
|
-
import { t as JarResourceManager } from "./jar-Bt3i0ls4.js";
|
|
4
3
|
import { n as MapResourceManager, t as KindFilteredResourceManager } from "./synthetic-DC2bSnGe.js";
|
|
4
|
+
import { t as JarResourceManager } from "./jar-Bt3i0ls4.js";
|
|
5
5
|
import { t as reshapeLegacyAssets } from "./legacy-reshape-CewShfF3.js";
|
|
6
6
|
//#region src/versions/prepare.ts
|
|
7
7
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as ResourceLocator } from "./locator-ycZzh_6z.js";
|
|
2
1
|
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";
|
|
2
|
+
import { n as ResourceLocator } from "./locator-ycZzh_6z.js";
|
|
3
3
|
import { i as resolveTexture } from "./loader-A-BZa8J4.js";
|
|
4
4
|
import { a as tintTexture, n as cloneFloatTexture, r as darkenTexture, s as toFloatTexture, t as blendPixel } from "./blend-CHP2-j9U.js";
|
|
5
5
|
import { t as combineFaceBuffers } from "./compose-qjhyBvnS.js";
|