@nodecraft/rendermite 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocks/blockstate-eval.d.ts +1 -1
- package/dist/blocks/cli.js +1 -1
- package/dist/blocks/export.js +1 -1
- package/dist/blocks/pack-format.d.ts +2 -2
- package/dist/{blockstate-eval-CObtPWzJ.d.ts → blockstate-eval-BzznRcVY.d.ts} +23 -9
- package/dist/{cli-CWUKXFbx.js → cli-BaoVzDGo.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/{export-DY5sGwt0.js → export-BNvYiw6i.js} +27 -18
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{pack-format-BO2FsorN.d.ts → pack-format-CfCP4kzy.d.ts} +20 -10
- package/dist/pack.d.ts +3 -3
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as BlockStateMultipartCase, c as ParseBlockStateOptions, d as matchesCondition, f as parseBlockState, i as BlockStateError, l as collectModels, n as BlockProperties, o as BlockStateVariantCase, p as weightedVariantIndex, r as BlockStateDefinition, s as MultipartCondition, t as BlockModelVariant, u as evaluateBlockState } from "../blockstate-eval-
|
|
1
|
+
import { a as BlockStateMultipartCase, c as ParseBlockStateOptions, d as matchesCondition, f as parseBlockState, i as BlockStateError, l as collectModels, n as BlockProperties, o as BlockStateVariantCase, p as weightedVariantIndex, r as BlockStateDefinition, s as MultipartCondition, t as BlockModelVariant, u as evaluateBlockState } from "../blockstate-eval-BzznRcVY.js";
|
|
2
2
|
export { BlockModelVariant, BlockProperties, BlockStateDefinition, BlockStateError, BlockStateMultipartCase, BlockStateVariantCase, MultipartCondition, ParseBlockStateOptions, collectModels, evaluateBlockState, matchesCondition, parseBlockState, weightedVariantIndex };
|
package/dist/blocks/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as runBlocksCli } from "../cli-
|
|
1
|
+
import { t as runBlocksCli } from "../cli-BaoVzDGo.js";
|
|
2
2
|
export { runBlocksCli };
|
package/dist/blocks/export.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as exportBlockPack } from "../export-
|
|
1
|
+
import { t as exportBlockPack } from "../export-BNvYiw6i.js";
|
|
2
2
|
export { exportBlockPack };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as BlockPackElement, c as BlockPackModel, d as BlockPackSprite, f as BlockPackSpriteFrame, i as BlockPackBlockStatesFile, l as BlockPackModelsFile, n as BlockPackAtlasPage, o as BlockPackFace, p as BlockPackTintsFile, r as BlockPackBlockState, s as BlockPackMetaFile, t as BlockPackAtlasFile, u as BlockPackRenderLayer } from "../pack-format-
|
|
2
|
-
export { BlockPackAtlasFile, BlockPackAtlasPage, BlockPackBlockState, BlockPackBlockStatesFile, BlockPackElement, BlockPackFace, BlockPackMetaFile, BlockPackModel, BlockPackModelsFile, BlockPackRenderLayer, BlockPackSprite, BlockPackSpriteFrame, BlockPackTintsFile };
|
|
1
|
+
import { a as BlockPackElement, c as BlockPackModel, d as BlockPackSprite, f as BlockPackSpriteFrame, i as BlockPackBlockStatesFile, l as BlockPackModelsFile, m as BlockPackVariant, n as BlockPackAtlasPage, o as BlockPackFace, p as BlockPackTintsFile, r as BlockPackBlockState, s as BlockPackMetaFile, t as BlockPackAtlasFile, u as BlockPackRenderLayer } from "../pack-format-CfCP4kzy.js";
|
|
2
|
+
export { BlockPackAtlasFile, BlockPackAtlasPage, BlockPackBlockState, BlockPackBlockStatesFile, BlockPackElement, BlockPackFace, BlockPackMetaFile, BlockPackModel, BlockPackModelsFile, BlockPackRenderLayer, BlockPackSprite, BlockPackSpriteFrame, BlockPackTintsFile, BlockPackVariant };
|
|
@@ -32,11 +32,19 @@ interface BlockModelVariant {
|
|
|
32
32
|
/** Relative weight within its list; the game picks one per block position. */
|
|
33
33
|
weight: number;
|
|
34
34
|
}
|
|
35
|
-
/**
|
|
36
|
-
|
|
35
|
+
/**
|
|
36
|
+
* One entry of a `variants` map, with its `a=b,c=d` key already parsed.
|
|
37
|
+
*
|
|
38
|
+
* Generic over the variant because the evaluation reads only `model`: a pack
|
|
39
|
+
* consumer holds variants whose rotations are optional (the emit omits them at
|
|
40
|
+
* their defaults) and can evaluate those directly, getting its own shape back.
|
|
41
|
+
*/
|
|
42
|
+
interface BlockStateVariantCase<Variant extends {
|
|
43
|
+
model: string;
|
|
44
|
+
} = BlockModelVariant> {
|
|
37
45
|
/** Properties this case constrains; unstated ones are wildcards. */
|
|
38
46
|
when: Record<string, string>;
|
|
39
|
-
apply:
|
|
47
|
+
apply: Variant[];
|
|
40
48
|
}
|
|
41
49
|
/**
|
|
42
50
|
* A `multipart` predicate. `match` holds one or more accepted values per
|
|
@@ -52,17 +60,21 @@ type MultipartCondition = {
|
|
|
52
60
|
op: 'or';
|
|
53
61
|
terms: MultipartCondition[];
|
|
54
62
|
};
|
|
55
|
-
interface BlockStateMultipartCase {
|
|
63
|
+
interface BlockStateMultipartCase<Variant extends {
|
|
64
|
+
model: string;
|
|
65
|
+
} = BlockModelVariant> {
|
|
56
66
|
/** null for an unconditional part, which always applies. */
|
|
57
67
|
when: MultipartCondition | null;
|
|
58
|
-
apply:
|
|
68
|
+
apply: Variant[];
|
|
59
69
|
}
|
|
60
|
-
type BlockStateDefinition
|
|
70
|
+
type BlockStateDefinition<Variant extends {
|
|
71
|
+
model: string;
|
|
72
|
+
} = BlockModelVariant> = {
|
|
61
73
|
kind: 'variants';
|
|
62
|
-
cases: BlockStateVariantCase
|
|
74
|
+
cases: Array<BlockStateVariantCase<Variant>>;
|
|
63
75
|
} | {
|
|
64
76
|
kind: 'multipart';
|
|
65
|
-
cases: BlockStateMultipartCase
|
|
77
|
+
cases: Array<BlockStateMultipartCase<Variant>>;
|
|
66
78
|
};
|
|
67
79
|
declare class BlockStateError extends Error {}
|
|
68
80
|
interface ParseBlockStateOptions {
|
|
@@ -104,7 +116,9 @@ declare function matchesCondition(condition: MultipartCondition, properties: Blo
|
|
|
104
116
|
* Still empty when even that finds nothing, which is a real answer: a blockstate
|
|
105
117
|
* that covers only some of a block's states draws nothing for the rest.
|
|
106
118
|
*/
|
|
107
|
-
declare function evaluateBlockState
|
|
119
|
+
declare function evaluateBlockState<Variant extends {
|
|
120
|
+
model: string;
|
|
121
|
+
}>(definition: BlockStateDefinition<Variant>, properties: BlockProperties): Variant[][];
|
|
108
122
|
/** Every model a blockstate can name, for deciding what to export. */
|
|
109
123
|
declare function collectModels(definition: BlockStateDefinition): string[];
|
|
110
124
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as builtinPackPath } from "./builtin-WkWjATeh.js";
|
|
2
2
|
import { n as LayeredResourceManager, t as FolderResourceManager } from "./manager-CYbAkWuT.js";
|
|
3
|
-
import { t as exportBlockPack } from "./export-
|
|
3
|
+
import { t as exportBlockPack } from "./export-BNvYiw6i.js";
|
|
4
4
|
import { n as prepareModResources } from "./prepare-B8oPdGYz.js";
|
|
5
5
|
import { t as downloadClientJar } from "./download-1wAfrGKx.js";
|
|
6
6
|
import { a as prepareVersionResources, r as compareVersions } from "./prepare-C95vjt_o.js";
|
package/dist/cli.js
CHANGED
|
@@ -6,7 +6,7 @@ import { n as harvestTintOverrides, t as curatedTintOverrides } from "./tints-nx
|
|
|
6
6
|
import { t as JarResourceManager } from "./jar-5aLDI0nT.js";
|
|
7
7
|
import { t as downloadClientJar } from "./download-1wAfrGKx.js";
|
|
8
8
|
import { a as prepareVersionResources, i as eraForVersion, n as GEOMETRY_DONOR_VERSIONS } from "./prepare-C95vjt_o.js";
|
|
9
|
-
import { t as runBlocksCli } from "./cli-
|
|
9
|
+
import { t as runBlocksCli } from "./cli-BaoVzDGo.js";
|
|
10
10
|
import { t as run } from "./run-Diql5y56.js";
|
|
11
11
|
import path from "node:path";
|
|
12
12
|
import os from "node:os";
|
|
@@ -191,26 +191,35 @@ function translateElements(elements, offset) {
|
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
193
|
function serializeBlockState(definition, exported) {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
194
|
+
/** Every default dropped, since most variants state none of these. */
|
|
195
|
+
const serializeApply = (apply) => apply.filter((variant) => exported(variant.model)).map((variant) => {
|
|
196
|
+
return {
|
|
197
|
+
model: variant.model,
|
|
198
|
+
...variant.x !== 0 && { x: variant.x },
|
|
199
|
+
...variant.y !== 0 && { y: variant.y },
|
|
200
|
+
...variant.z !== 0 && { z: variant.z },
|
|
201
|
+
...variant.uvlock && { uvlock: true },
|
|
202
|
+
...variant.weight !== 1 && { weight: variant.weight }
|
|
203
|
+
};
|
|
204
|
+
});
|
|
205
|
+
if (definition.kind === "variants") {
|
|
206
|
+
const cases = definition.cases.flatMap((entry) => {
|
|
207
|
+
const apply = serializeApply(entry.apply);
|
|
208
|
+
return apply.length === 0 ? [] : [{
|
|
209
|
+
when: entry.when,
|
|
210
|
+
apply
|
|
211
|
+
}];
|
|
210
212
|
});
|
|
213
|
+
return cases.length === 0 ? null : { variants: cases };
|
|
211
214
|
}
|
|
212
|
-
|
|
213
|
-
|
|
215
|
+
const cases = definition.cases.flatMap((entry) => {
|
|
216
|
+
const apply = serializeApply(entry.apply);
|
|
217
|
+
return apply.length === 0 ? [] : [{
|
|
218
|
+
when: entry.when,
|
|
219
|
+
apply
|
|
220
|
+
}];
|
|
221
|
+
});
|
|
222
|
+
return cases.length === 0 ? null : { multipart: cases };
|
|
214
223
|
}
|
|
215
224
|
/**
|
|
216
225
|
* Any texture the model binds, for a model that declares no `particle`. Ordered
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { a as TextureMeta, i as TextureLoader, o as TextureResolutionError, r as
|
|
|
4
4
|
import { d as parseAtlasSources, n as AtlasSource, r as AtlasSourceError, s as ResolvedSprite, t as AtlasResolver, u as createAtlasResolver } from "./sources-B9X9w3qP.js";
|
|
5
5
|
import { a as PackedRect, i as PackedPage, n as PackOptions, o as packAtlas, r as PackedAtlas, t as PackEntry } from "./atlas-pack-DRTrWcSU.js";
|
|
6
6
|
import { a as resolveTexture, n as ModelResolutionError, o as salvageJson, r as ResolvedModel, t as ModelLoader } from "./loader-C_1_amsq.js";
|
|
7
|
-
import { a as BlockStateMultipartCase, d as matchesCondition, f as parseBlockState, i as BlockStateError, l as collectModels, n as BlockProperties, o as BlockStateVariantCase, p as weightedVariantIndex, r as BlockStateDefinition, s as MultipartCondition, t as BlockModelVariant, u as evaluateBlockState } from "./blockstate-eval-
|
|
7
|
+
import { a as BlockStateMultipartCase, d as matchesCondition, f as parseBlockState, i as BlockStateError, l as collectModels, n as BlockProperties, o as BlockStateVariantCase, p as weightedVariantIndex, r as BlockStateDefinition, s as MultipartCondition, t as BlockModelVariant, u as evaluateBlockState } from "./blockstate-eval-BzznRcVY.js";
|
|
8
8
|
import { i as exportBlockPack, n as BlockPackResult, r as ExportBlockPackOptions, t as BlockPackFailure } from "./export-BIpqNU3H.js";
|
|
9
9
|
import { i as buildObjMesh, n as ObjMesh, r as ObjMeshError, t as MeshGroup } from "./obj-mesh-C6Sp4Ysc.js";
|
|
10
10
|
import { i as buildBlockTints, n as BlockTintPack, t as BlockTint } from "./tints-2k3ZhkY3.js";
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { t as buildBlockTints } from "./tints-a9FWZLma.js";
|
|
|
10
10
|
import { o as createAtlasResolver, s as parseAtlasSources, t as AtlasSourceError } from "./sources-BlUriDCs.js";
|
|
11
11
|
import { n as LayeredResourceManager, r as ResourceKind, t as FolderResourceManager } from "./manager-CYbAkWuT.js";
|
|
12
12
|
import { n as TextureLoader, r as TextureResolutionError, t as AnimatedTexture } from "./loader-C18GpurU.js";
|
|
13
|
-
import { t as exportBlockPack } from "./export-
|
|
13
|
+
import { t as exportBlockPack } from "./export-BNvYiw6i.js";
|
|
14
14
|
import { a as defaultProperties, i as UNKNOWN_MODEL, n as InvalidItemDefinitionError, o as evaluateItemModel } from "./definition-ColsvWrH.js";
|
|
15
15
|
import { n as UnsafeJarError, r as isUnsafeEntryPath, t as JarResourceManager } from "./jar-5aLDI0nT.js";
|
|
16
16
|
import { n as prepareModResources } from "./prepare-B8oPdGYz.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as FaceDirectionName, l as Vec3, o as ModelElementJson, u as Vec4 } from "./types-qlp3I8_-.js";
|
|
2
|
-
import {
|
|
2
|
+
import { a as BlockStateMultipartCase, o as BlockStateVariantCase } from "./blockstate-eval-BzznRcVY.js";
|
|
3
3
|
import { t as MeshGroup } from "./obj-mesh-C6Sp4Ysc.js";
|
|
4
4
|
import { n as BlockTintPack } from "./tints-2k3ZhkY3.js";
|
|
5
5
|
//#region src/blocks/pack-format.d.ts
|
|
@@ -86,18 +86,28 @@ type BlockPackModelsFile = Record<string, BlockPackModel>;
|
|
|
86
86
|
/** `blockstates.json`, by block id, with keys and predicates already parsed. */
|
|
87
87
|
type BlockPackBlockStatesFile = Record<string, BlockPackBlockState>;
|
|
88
88
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
89
|
+
* A variant as the pack writes it. Every rotation is optional because the emit
|
|
90
|
+
* drops each one at its default, which is most of them.
|
|
91
|
+
*/
|
|
92
|
+
interface BlockPackVariant {
|
|
93
|
+
model: string;
|
|
94
|
+
x?: number;
|
|
95
|
+
y?: number;
|
|
96
|
+
z?: number;
|
|
97
|
+
uvlock?: true;
|
|
98
|
+
weight?: number;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* One block's cases as the pack writes them: what `evaluateBlockState` takes,
|
|
102
|
+
* flattened to the key the file uses. Pass it as
|
|
103
|
+
* `{ kind: 'variants', cases: state.variants }` and the models come back as
|
|
104
|
+
* `BlockPackVariant`, no cast in either direction.
|
|
91
105
|
*/
|
|
92
106
|
type BlockPackBlockState = {
|
|
93
|
-
variants:
|
|
94
|
-
kind: 'variants';
|
|
95
|
-
}>['cases'];
|
|
107
|
+
variants: Array<BlockStateVariantCase<BlockPackVariant>>;
|
|
96
108
|
multipart?: undefined;
|
|
97
109
|
} | {
|
|
98
|
-
multipart:
|
|
99
|
-
kind: 'multipart';
|
|
100
|
-
}>['cases'];
|
|
110
|
+
multipart: Array<BlockStateMultipartCase<BlockPackVariant>>;
|
|
101
111
|
variants?: undefined;
|
|
102
112
|
};
|
|
103
113
|
/** `tints.json`. */
|
|
@@ -118,4 +128,4 @@ interface BlockPackMetaFile {
|
|
|
118
128
|
hashes: Record<string, string>;
|
|
119
129
|
}
|
|
120
130
|
//#endregion
|
|
121
|
-
export { BlockPackElement as a, BlockPackModel as c, BlockPackSprite as d, BlockPackSpriteFrame as f, BlockPackBlockStatesFile as i, BlockPackModelsFile as l, BlockPackAtlasPage as n, BlockPackFace as o, BlockPackTintsFile as p, BlockPackBlockState as r, BlockPackMetaFile as s, BlockPackAtlasFile as t, BlockPackRenderLayer as u };
|
|
131
|
+
export { BlockPackElement as a, BlockPackModel as c, BlockPackSprite as d, BlockPackSpriteFrame as f, BlockPackBlockStatesFile as i, BlockPackModelsFile as l, BlockPackVariant as m, BlockPackAtlasPage as n, BlockPackFace as o, BlockPackTintsFile as p, BlockPackBlockState as r, BlockPackMetaFile as s, BlockPackAtlasFile as t, BlockPackRenderLayer as u };
|
package/dist/pack.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as BlockStateMultipartCase, d as matchesCondition, n as BlockProperties, o as BlockStateVariantCase, p as weightedVariantIndex, r as BlockStateDefinition, s as MultipartCondition, t as BlockModelVariant, u as evaluateBlockState } from "./blockstate-eval-
|
|
1
|
+
import { a as BlockStateMultipartCase, d as matchesCondition, n as BlockProperties, o as BlockStateVariantCase, p as weightedVariantIndex, r as BlockStateDefinition, s as MultipartCondition, t as BlockModelVariant, u as evaluateBlockState } from "./blockstate-eval-BzznRcVY.js";
|
|
2
2
|
import { n as ObjMesh, t as MeshGroup } from "./obj-mesh-C6Sp4Ysc.js";
|
|
3
3
|
import { n as BlockTintPack, t as BlockTint } from "./tints-2k3ZhkY3.js";
|
|
4
|
-
import { a as BlockPackElement, c as BlockPackModel, d as BlockPackSprite, f as BlockPackSpriteFrame, i as BlockPackBlockStatesFile, l as BlockPackModelsFile, n as BlockPackAtlasPage, o as BlockPackFace, p as BlockPackTintsFile, r as BlockPackBlockState, s as BlockPackMetaFile, t as BlockPackAtlasFile, u as BlockPackRenderLayer } from "./pack-format-
|
|
5
|
-
export { type BlockModelVariant, type BlockPackAtlasFile, type BlockPackAtlasPage, type BlockPackBlockState, type BlockPackBlockStatesFile, type BlockPackElement, type BlockPackFace, type BlockPackMetaFile, type BlockPackModel, type BlockPackModelsFile, type BlockPackRenderLayer, type BlockPackSprite, type BlockPackSpriteFrame, type BlockPackTintsFile, type BlockProperties, type BlockStateDefinition, type BlockStateMultipartCase, type BlockStateVariantCase, type BlockTint, type BlockTintPack, type MeshGroup, type MultipartCondition, type ObjMesh, evaluateBlockState, matchesCondition, weightedVariantIndex };
|
|
4
|
+
import { a as BlockPackElement, c as BlockPackModel, d as BlockPackSprite, f as BlockPackSpriteFrame, i as BlockPackBlockStatesFile, l as BlockPackModelsFile, m as BlockPackVariant, n as BlockPackAtlasPage, o as BlockPackFace, p as BlockPackTintsFile, r as BlockPackBlockState, s as BlockPackMetaFile, t as BlockPackAtlasFile, u as BlockPackRenderLayer } from "./pack-format-CfCP4kzy.js";
|
|
5
|
+
export { type BlockModelVariant, type BlockPackAtlasFile, type BlockPackAtlasPage, type BlockPackBlockState, type BlockPackBlockStatesFile, type BlockPackElement, type BlockPackFace, type BlockPackMetaFile, type BlockPackModel, type BlockPackModelsFile, type BlockPackRenderLayer, type BlockPackSprite, type BlockPackSpriteFrame, type BlockPackTintsFile, type BlockPackVariant, type BlockProperties, type BlockStateDefinition, type BlockStateMultipartCase, type BlockStateVariantCase, type BlockTint, type BlockTintPack, type MeshGroup, type MultipartCondition, type ObjMesh, evaluateBlockState, matchesCondition, weightedVariantIndex };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nodecraft/rendermite",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
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",
|