@nodecraft/rendermite 1.2.0 → 1.2.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/{block-entities-BbS1kv0m.js → block-entities-xv3bQpEX.js} +10 -1
- package/dist/blocks/block-entities.js +1 -1
- package/dist/blocks/blockstate-eval.d.ts +1 -1
- package/dist/blocks/blockstate-eval.js +1 -1
- package/dist/blocks/cli.js +1 -1
- package/dist/blocks/export.js +1 -1
- package/dist/blocks/obj-mesh.js +1 -1
- package/dist/{blockstate-eval-Ckjlyxn4.js → blockstate-eval-BRQ3NWY2.js} +46 -13
- package/dist/{blockstate-eval-DDArZs1P.d.ts → blockstate-eval-CObtPWzJ.d.ts} +19 -4
- package/dist/{cli-D7_oUuPT.js → cli-CWUKXFbx.js} +1 -1
- package/dist/cli.js +2 -2
- package/dist/{entity-fallback-DNO0Ta9C.js → entity-fallback-BTkM8j0V.js} +1 -1
- package/dist/{export-DxREy3qA.js → export-DY5sGwt0.js} +94 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/{loader-BvLcevlN.js → loader-C-NuJaEi.js} +19 -0
- package/dist/models/loader.js +1 -1
- package/dist/{obj-BEjq3_Ao.js → obj-bvs3gwex.js} +1 -1
- package/dist/{obj-mesh-CiHiqrlm.js → obj-mesh-rnYbSbpv.js} +1 -1
- package/dist/{pipeline-DRMsBiod.js → pipeline-DeGRR0CP.js} +3 -3
- package/dist/render/entity-fallback.js +1 -1
- package/dist/render/obj.js +1 -1
- package/dist/render/pipeline.js +1 -1
- package/dist/render/renderer.js +1 -1
- package/dist/{run-D2S_W5As.js → run-Diql5y56.js} +1 -1
- package/dist/run.js +1 -1
- package/dist/workers/render-worker.js +1 -1
- package/package.json +1 -1
|
@@ -436,12 +436,21 @@ async function bedGeometry(blockId, context) {
|
|
|
436
436
|
}
|
|
437
437
|
};
|
|
438
438
|
}
|
|
439
|
-
/**
|
|
439
|
+
/**
|
|
440
|
+
* Blocks with one shape and nothing to orient by. Vanilla ids draw vendored
|
|
441
|
+
* geometry; a mod id is here only where the mod ships a model of its own that
|
|
442
|
+
* describes the block and nothing points at it, the same bar `MOD_LOADER_HANDLERS`
|
|
443
|
+
* uses for loaders.
|
|
444
|
+
*/
|
|
440
445
|
const FIXED = {
|
|
441
446
|
"minecraft:conduit": {
|
|
442
447
|
shapes: [{ model: "renderchest:item/conduit" }],
|
|
443
448
|
orient: { kind: "fixed" }
|
|
444
449
|
},
|
|
450
|
+
"ae2:cable_bus": {
|
|
451
|
+
shapes: [{ model: "ae2:part/cable/glass/center" }],
|
|
452
|
+
orient: { kind: "fixed" }
|
|
453
|
+
},
|
|
445
454
|
"minecraft:decorated_pot": {
|
|
446
455
|
shapes: [{ model: "renderchest:item/decorated_pot" }],
|
|
447
456
|
textures: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as blockEntityGeometry, r as synthesizeVariants, t as INVISIBLE_BLOCKS } from "../block-entities-
|
|
1
|
+
import { n as blockEntityGeometry, r as synthesizeVariants, t as INVISIBLE_BLOCKS } from "../block-entities-xv3bQpEX.js";
|
|
2
2
|
export { INVISIBLE_BLOCKS, blockEntityGeometry, synthesizeVariants };
|
|
@@ -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-CObtPWzJ.js";
|
|
2
2
|
export { BlockModelVariant, BlockProperties, BlockStateDefinition, BlockStateError, BlockStateMultipartCase, BlockStateVariantCase, MultipartCondition, ParseBlockStateOptions, collectModels, evaluateBlockState, matchesCondition, parseBlockState, weightedVariantIndex };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as parseBlockState, i as matchesCondition, n as collectModels, o as weightedVariantIndex, r as evaluateBlockState, t as BlockStateError } from "../blockstate-eval-
|
|
1
|
+
import { a as parseBlockState, i as matchesCondition, n as collectModels, o as weightedVariantIndex, r as evaluateBlockState, t as BlockStateError } from "../blockstate-eval-BRQ3NWY2.js";
|
|
2
2
|
export { BlockStateError, 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-CWUKXFbx.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-DY5sGwt0.js";
|
|
2
2
|
export { exportBlockPack };
|
package/dist/blocks/obj-mesh.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as buildObjMesh, t as ObjMeshError } from "../obj-mesh-
|
|
1
|
+
import { n as buildObjMesh, t as ObjMeshError } from "../obj-mesh-rnYbSbpv.js";
|
|
2
2
|
export { ObjMeshError, buildObjMesh };
|
|
@@ -165,28 +165,61 @@ function parseBlockState(namespace, json, context = namespace, options = {}) {
|
|
|
165
165
|
}
|
|
166
166
|
throw new BlockStateError(`${context}: states neither variants nor multipart`);
|
|
167
167
|
}
|
|
168
|
-
|
|
168
|
+
/**
|
|
169
|
+
* `absentIsWildcard` is the second pass `evaluateBlockState` makes when the
|
|
170
|
+
* first found nothing: a property the given map does not carry at all counts as
|
|
171
|
+
* satisfied rather than failed. A *wrong* value still fails either way.
|
|
172
|
+
*/
|
|
173
|
+
function matchesCondition(condition, properties, absentIsWildcard = false) {
|
|
169
174
|
switch (condition.op) {
|
|
170
|
-
case "match": return Object.entries(condition.properties).every(([name, accepted]) => accepted.includes(properties[name]));
|
|
171
|
-
case "and": return condition.terms.every((term) => matchesCondition(term, properties));
|
|
172
|
-
case "or": return condition.terms.some((term) => matchesCondition(term, properties));
|
|
175
|
+
case "match": return Object.entries(condition.properties).every(([name, accepted]) => absentIsWildcard && properties[name] === void 0 || accepted.includes(properties[name]));
|
|
176
|
+
case "and": return condition.terms.every((term) => matchesCondition(term, properties, absentIsWildcard));
|
|
177
|
+
case "or": return condition.terms.some((term) => matchesCondition(term, properties, absentIsWildcard));
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
/** The variant case closest to an exact-key lookup, or null when none matches. */
|
|
181
|
+
function bestVariant(cases, properties, absentIsWildcard) {
|
|
182
|
+
let best = null;
|
|
183
|
+
for (const variant of cases) {
|
|
184
|
+
const entries = Object.entries(variant.when);
|
|
185
|
+
if (!entries.every(([name, value]) => properties[name] === value || absentIsWildcard && properties[name] === void 0)) continue;
|
|
186
|
+
if (best === null || entries.length > Object.keys(best.when).length) best = variant;
|
|
173
187
|
}
|
|
188
|
+
return best;
|
|
174
189
|
}
|
|
175
190
|
/**
|
|
176
191
|
* The models the game draws for a block in this state, as one weighted list per
|
|
177
192
|
* contributing part — a fence is several models at once, and each of them may
|
|
178
|
-
* itself be a random pick.
|
|
179
|
-
*
|
|
180
|
-
*
|
|
193
|
+
* itself be a random pick.
|
|
194
|
+
*
|
|
195
|
+
* When nothing matches, the cases are tried again with any property the given
|
|
196
|
+
* map does not carry treated as a wildcard. That is not tolerance for sloppy
|
|
197
|
+
* data: a world saved before a mod added a property stores the state without it,
|
|
198
|
+
* and Functional Storage's drawers key every case on a `facing` the saves in
|
|
199
|
+
* hand do not have, so a strict read draws a wall of holes. The retry only ever
|
|
200
|
+
* fires where the strict read found nothing, so it cannot change a state that
|
|
201
|
+
* already resolved, and it takes at most one part per model so a block missing
|
|
202
|
+
* its `facing` draws one drawer rather than six rotations of itself.
|
|
203
|
+
*
|
|
204
|
+
* Still empty when even that finds nothing, which is a real answer: a blockstate
|
|
205
|
+
* that covers only some of a block's states draws nothing for the rest.
|
|
181
206
|
*/
|
|
182
207
|
function evaluateBlockState(definition, properties) {
|
|
183
|
-
if (definition.kind === "multipart")
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
|
|
208
|
+
if (definition.kind === "multipart") {
|
|
209
|
+
const matched = definition.cases.filter((part) => part.when === null || matchesCondition(part.when, properties));
|
|
210
|
+
if (matched.length > 0) return matched.map((part) => part.apply);
|
|
211
|
+
const drawn = /* @__PURE__ */ new Set();
|
|
212
|
+
const loose = [];
|
|
213
|
+
for (const part of definition.cases) {
|
|
214
|
+
if (part.when !== null && !matchesCondition(part.when, properties, true)) continue;
|
|
215
|
+
const shape = part.apply.map((variant) => variant.model).join("|");
|
|
216
|
+
if (drawn.has(shape)) continue;
|
|
217
|
+
drawn.add(shape);
|
|
218
|
+
loose.push(part.apply);
|
|
219
|
+
}
|
|
220
|
+
return loose;
|
|
189
221
|
}
|
|
222
|
+
const best = bestVariant(definition.cases, properties, false) ?? bestVariant(definition.cases, properties, true);
|
|
190
223
|
return best === null ? [] : [best.apply];
|
|
191
224
|
}
|
|
192
225
|
/** Every model a blockstate can name, for deciding what to export. */
|
|
@@ -81,13 +81,28 @@ interface ParseBlockStateOptions {
|
|
|
81
81
|
* unqualified model reference resolves against.
|
|
82
82
|
*/
|
|
83
83
|
declare function parseBlockState(namespace: string, json: unknown, context?: string, options?: ParseBlockStateOptions): BlockStateDefinition;
|
|
84
|
-
|
|
84
|
+
/**
|
|
85
|
+
* `absentIsWildcard` is the second pass `evaluateBlockState` makes when the
|
|
86
|
+
* first found nothing: a property the given map does not carry at all counts as
|
|
87
|
+
* satisfied rather than failed. A *wrong* value still fails either way.
|
|
88
|
+
*/
|
|
89
|
+
declare function matchesCondition(condition: MultipartCondition, properties: BlockProperties, absentIsWildcard?: boolean): boolean;
|
|
85
90
|
/**
|
|
86
91
|
* The models the game draws for a block in this state, as one weighted list per
|
|
87
92
|
* contributing part — a fence is several models at once, and each of them may
|
|
88
|
-
* itself be a random pick.
|
|
89
|
-
*
|
|
90
|
-
*
|
|
93
|
+
* itself be a random pick.
|
|
94
|
+
*
|
|
95
|
+
* When nothing matches, the cases are tried again with any property the given
|
|
96
|
+
* map does not carry treated as a wildcard. That is not tolerance for sloppy
|
|
97
|
+
* data: a world saved before a mod added a property stores the state without it,
|
|
98
|
+
* and Functional Storage's drawers key every case on a `facing` the saves in
|
|
99
|
+
* hand do not have, so a strict read draws a wall of holes. The retry only ever
|
|
100
|
+
* fires where the strict read found nothing, so it cannot change a state that
|
|
101
|
+
* already resolved, and it takes at most one part per model so a block missing
|
|
102
|
+
* its `facing` draws one drawer rather than six rotations of itself.
|
|
103
|
+
*
|
|
104
|
+
* Still empty when even that finds nothing, which is a real answer: a blockstate
|
|
105
|
+
* that covers only some of a block's states draws nothing for the rest.
|
|
91
106
|
*/
|
|
92
107
|
declare function evaluateBlockState(definition: BlockStateDefinition, properties: BlockProperties): BlockModelVariant[][];
|
|
93
108
|
/** Every model a blockstate can name, for deciding what to export. */
|
|
@@ -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-DY5sGwt0.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,8 +6,8 @@ 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-
|
|
10
|
-
import { t as run } from "./run-
|
|
9
|
+
import { t as runBlocksCli } from "./cli-CWUKXFbx.js";
|
|
10
|
+
import { t as run } from "./run-Diql5y56.js";
|
|
11
11
|
import path from "node:path";
|
|
12
12
|
import os from "node:os";
|
|
13
13
|
import { parseArgs } from "node:util";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as ResourceLocator } from "./locator-COMEtEn9.js";
|
|
2
2
|
import { a as findChestTexture, i as findBedTexture, l as findMobTexture, n as HEAD_LAYOUTS, o as findEntityTexture, r as coversSheet, t as DYE_COLORS, u as tokens } from "./entity-textures-DFRIVdF1.js";
|
|
3
|
-
import { c as renderModel } from "./obj-
|
|
3
|
+
import { c as renderModel } from "./obj-bvs3gwex.js";
|
|
4
4
|
//#region src/render/entity-fallback.ts
|
|
5
5
|
/**
|
|
6
6
|
* Heuristic rendering for mod items that parent `builtin/entity` — chests,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as packAtlas } from "./atlas-pack-CoOih7By.js";
|
|
2
2
|
import { n as ResourceLocator } from "./locator-COMEtEn9.js";
|
|
3
|
-
import { n as blockEntityGeometry, r as synthesizeVariants, t as INVISIBLE_BLOCKS } from "./block-entities-
|
|
4
|
-
import { a as parseBlockState, n as collectModels } from "./blockstate-eval-
|
|
5
|
-
import { a as salvageJson, i as resolveTexture, t as ModelLoader } from "./loader-
|
|
6
|
-
import { n as buildObjMesh } from "./obj-mesh-
|
|
3
|
+
import { n as blockEntityGeometry, r as synthesizeVariants, t as INVISIBLE_BLOCKS } from "./block-entities-xv3bQpEX.js";
|
|
4
|
+
import { a as parseBlockState, n as collectModels } from "./blockstate-eval-BRQ3NWY2.js";
|
|
5
|
+
import { a as salvageJson, i as resolveTexture, t as ModelLoader } from "./loader-C-NuJaEi.js";
|
|
6
|
+
import { n as buildObjMesh } from "./obj-mesh-rnYbSbpv.js";
|
|
7
7
|
import { t as buildBlockTints } from "./tints-a9FWZLma.js";
|
|
8
8
|
import { t as loadAtlasResolver } from "./registry-DlduyjtM.js";
|
|
9
9
|
import { n as LayeredResourceManager, t as FolderResourceManager } from "./manager-CYbAkWuT.js";
|
|
@@ -212,6 +212,53 @@ function serializeBlockState(definition, exported) {
|
|
|
212
212
|
if (cases.length === 0) return null;
|
|
213
213
|
return definition.kind === "variants" ? { variants: cases } : { multipart: cases };
|
|
214
214
|
}
|
|
215
|
+
/**
|
|
216
|
+
* Any texture the model binds, for a model that declares no `particle`. Ordered
|
|
217
|
+
* by the chain's own key order so a run is reproducible, and `particle` itself
|
|
218
|
+
* is not a candidate: it was already tried.
|
|
219
|
+
*/
|
|
220
|
+
function firstBoundTexture(model) {
|
|
221
|
+
for (const name of Object.keys(model.textures)) {
|
|
222
|
+
if (name === "particle") continue;
|
|
223
|
+
const resolved = resolveTexture(model, `#${name}`);
|
|
224
|
+
if (resolved !== null) return resolved;
|
|
225
|
+
}
|
|
226
|
+
return null;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* The block's own item model, baked, for a block model that draws nothing.
|
|
230
|
+
*
|
|
231
|
+
* A mod that builds a block's shape in Java still has to put something in the
|
|
232
|
+
* inventory, so it ships an item model with real geometry, and that is the
|
|
233
|
+
* closest the assets come to describing the block: Ender IO's conduit is a cube
|
|
234
|
+
* of its own texture, AE2's formed quantum ring is the ring, MoreRed's wire is
|
|
235
|
+
* the cross it draws with nothing connected. Flat icons fall out on their own,
|
|
236
|
+
* since `item/generated` states no elements.
|
|
237
|
+
*
|
|
238
|
+
* Null unless the substitute is whole: a part-magenta stand-in reads as a broken
|
|
239
|
+
* texture, which is worse than the recorded gap it replaces.
|
|
240
|
+
*/
|
|
241
|
+
async function itemModelSubstitute(blockId, resources, models) {
|
|
242
|
+
const block = ResourceLocator.tryParse(blockId);
|
|
243
|
+
if (block === null) return null;
|
|
244
|
+
const item = new ResourceLocator(block.namespace, `item/${block.path}`);
|
|
245
|
+
if (!await resources.hasResource("model", item)) return null;
|
|
246
|
+
let resolved;
|
|
247
|
+
try {
|
|
248
|
+
resolved = await models.load(item.toString());
|
|
249
|
+
} catch {
|
|
250
|
+
return null;
|
|
251
|
+
}
|
|
252
|
+
const { emitted, sprites, tintIndices } = bakeModel(item.toString(), resolved, []);
|
|
253
|
+
if (emitted.elements.length === 0) return null;
|
|
254
|
+
if ((await Promise.all([...sprites].map(async (sprite) => sprite !== MISSING_SPRITE && await resources.hasResource("texture", ResourceLocator.parse(sprite))))).includes(false)) return null;
|
|
255
|
+
return {
|
|
256
|
+
id: item.toString(),
|
|
257
|
+
emitted,
|
|
258
|
+
sprites,
|
|
259
|
+
tintIndices
|
|
260
|
+
};
|
|
261
|
+
}
|
|
215
262
|
/** Bake one flattened model into pack form, reporting every face it loses. */
|
|
216
263
|
function bakeModel(id, model, failures) {
|
|
217
264
|
const sprites = /* @__PURE__ */ new Set();
|
|
@@ -251,7 +298,7 @@ function bakeModel(id, model, failures) {
|
|
|
251
298
|
});
|
|
252
299
|
}
|
|
253
300
|
const renderType = model.renderType === null ? void 0 : RENDER_TYPES[model.renderType];
|
|
254
|
-
const particle = resolveTexture(model, "#particle");
|
|
301
|
+
const particle = resolveTexture(model, "#particle") ?? (elements.length === 0 ? firstBoundTexture(model) : null);
|
|
255
302
|
if (particle !== null) sprites.add(particle.toString());
|
|
256
303
|
return {
|
|
257
304
|
emitted: {
|
|
@@ -489,6 +536,31 @@ async function exportBlockPack(options) {
|
|
|
489
536
|
reason: `the game draws this block in code; the pack substitutes vendored geometry from ${geometry.shapes.map((shape) => shape.model).join(", ")} and synthesises the orientation variants the blockstate does not carry`
|
|
490
537
|
});
|
|
491
538
|
}
|
|
539
|
+
const adoptSubstitute = (substitute) => {
|
|
540
|
+
emittedModels[substitute.id] = substitute.emitted;
|
|
541
|
+
modelTintIndices.set(substitute.id, substitute.tintIndices);
|
|
542
|
+
for (const sprite of substitute.sprites) spriteIds.add(sprite);
|
|
543
|
+
return substitute.id;
|
|
544
|
+
};
|
|
545
|
+
for (const [id, references] of blockModels) {
|
|
546
|
+
if (INVISIBLE_BLOCKS[id] !== void 0) continue;
|
|
547
|
+
const empty = references.filter((reference) => {
|
|
548
|
+
const model = emittedModels[reference];
|
|
549
|
+
return model === void 0 || model.elements.length === 0 && !model.mesh?.length;
|
|
550
|
+
});
|
|
551
|
+
if (empty.length === 0) continue;
|
|
552
|
+
const substitute = await itemModelSubstitute(id, resources, models);
|
|
553
|
+
if (substitute === null) continue;
|
|
554
|
+
const stood = adoptSubstitute(substitute);
|
|
555
|
+
for (const part of definitions.get(id)?.cases ?? []) for (const variant of part.apply) if (empty.includes(variant.model)) variant.model = stood;
|
|
556
|
+
blockModels.set(id, [...references.filter((reference) => !empty.includes(reference)), stood]);
|
|
557
|
+
const drawnInCode = empty.length === references.length ? "this block" : empty.join(", ");
|
|
558
|
+
failures.push({
|
|
559
|
+
id,
|
|
560
|
+
kind: "geometry",
|
|
561
|
+
reason: `the game draws ${drawnInCode} in code; the pack substitutes the block's own item model ${stood}, which carries the shape but not the orientation or connections`
|
|
562
|
+
});
|
|
563
|
+
}
|
|
492
564
|
const blockStates = {};
|
|
493
565
|
for (const [id, definition] of definitions) {
|
|
494
566
|
const serialized = serializeBlockState(definition, (model) => emittedModels[model] !== void 0);
|
|
@@ -503,6 +575,23 @@ async function exportBlockPack(options) {
|
|
|
503
575
|
}
|
|
504
576
|
blockStates[id] = serialized;
|
|
505
577
|
}
|
|
578
|
+
for (const locator of blockLocators) {
|
|
579
|
+
const id = locator.toString();
|
|
580
|
+
if (blockStates[id] !== void 0 || INVISIBLE_BLOCKS[id] !== void 0) continue;
|
|
581
|
+
const substitute = await itemModelSubstitute(id, resources, models);
|
|
582
|
+
if (substitute === null) continue;
|
|
583
|
+
const stood = adoptSubstitute(substitute);
|
|
584
|
+
blockStates[id] = { variants: [{
|
|
585
|
+
when: {},
|
|
586
|
+
apply: [{ model: stood }]
|
|
587
|
+
}] };
|
|
588
|
+
blockModels.set(id, [stood]);
|
|
589
|
+
failures.push({
|
|
590
|
+
id,
|
|
591
|
+
kind: "geometry",
|
|
592
|
+
reason: `no case of this blockstate could be read; the pack substitutes the block's own item model ${stood}, which carries the shape but not the orientation`
|
|
593
|
+
});
|
|
594
|
+
}
|
|
506
595
|
for (const namespace of namespaces) for (const locator of await resources.listResources("texture", namespace)) if (FLUID_SUFFIX.test(locator.path)) spriteIds.add(locator.toString());
|
|
507
596
|
for (const extra of EXTRA_FLUID_SPRITES) if (await resources.hasResource("texture", ResourceLocator.parse(extra))) spriteIds.add(extra);
|
|
508
597
|
const loaded = [];
|
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-CObtPWzJ.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
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { t as packAtlas } from "./atlas-pack-CoOih7By.js";
|
|
2
2
|
import { n as ResourceLocator, t as InvalidResourceLocatorError } from "./locator-COMEtEn9.js";
|
|
3
|
-
import { a as parseBlockState, i as matchesCondition, n as collectModels, o as weightedVariantIndex, r as evaluateBlockState, t as BlockStateError } from "./blockstate-eval-
|
|
3
|
+
import { a as parseBlockState, i as matchesCondition, n as collectModels, o as weightedVariantIndex, r as evaluateBlockState, t as BlockStateError } from "./blockstate-eval-BRQ3NWY2.js";
|
|
4
4
|
import { c as toByteTexture, l as toFloatTexture } from "./blend-KXMclcHk.js";
|
|
5
5
|
import { c as lightsForProfile, r as LightingProfile } from "./lighting--5myudVu.js";
|
|
6
|
-
import { a as salvageJson, i as resolveTexture, n as ModelResolutionError, t as ModelLoader } from "./loader-
|
|
7
|
-
import { a as ItemRenderError, c as renderModel, l as renderModelFrames, o as boxDownscale, s as pointResize } from "./obj-
|
|
8
|
-
import { n as buildObjMesh, t as ObjMeshError } from "./obj-mesh-
|
|
6
|
+
import { a as salvageJson, i as resolveTexture, n as ModelResolutionError, t as ModelLoader } from "./loader-C-NuJaEi.js";
|
|
7
|
+
import { a as ItemRenderError, c as renderModel, l as renderModelFrames, o as boxDownscale, s as pointResize } from "./obj-bvs3gwex.js";
|
|
8
|
+
import { n as buildObjMesh, t as ObjMeshError } from "./obj-mesh-rnYbSbpv.js";
|
|
9
9
|
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-DY5sGwt0.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";
|
|
@@ -21,5 +21,5 @@ import { a as builtinDynamicResources } from "./generators-BCZVlWig.js";
|
|
|
21
21
|
import { t as minifyStylesheet } from "./minify-bjMRmr5J.js";
|
|
22
22
|
import { n as itemClass, t as generateStylesheet } from "./stylesheet-CovT3B2S.js";
|
|
23
23
|
import { a as resolveTints, i as resolveTint, n as InvalidTinterDefinitionError, r as parseTintValue, t as DYE_COLORS } from "./tints-B3WQcPtx.js";
|
|
24
|
-
import { t as run } from "./run-
|
|
24
|
+
import { t as run } from "./run-Diql5y56.js";
|
|
25
25
|
export { AnimatedTexture, AtlasSourceError, BlockStateError, DYE_COLORS, FolderResourceManager, InvalidItemDefinitionError, InvalidResourceLocatorError, InvalidTinterDefinitionError, ItemRenderError, ItemResolutionError, JarResourceManager, LayeredResourceManager, LightingProfile, ModelLoader, ModelResolutionError, ObjMeshError, ResourceKind, ResourceLocator, TextureLoader, TextureResolutionError, UNKNOWN_MODEL, UnsafeJarError, boxDownscale, buildBlockTints, buildObjMesh, builtinDynamicResources, collectModels, compareVersions, createAtlasResolver, defaultProperties, discoverItems, encodeAnimatedIcon, encodeIcon, eraForVersion, evaluateBlockState, evaluateItemModel, exportBlockPack, generateStylesheet, isUnsafeEntryPath, itemClass, lightsForProfile, matchesCondition, minifyStylesheet, packAtlas, parseAtlasSources, parseBlockState, parseTintValue, pointResize, prepareModResources, prepareVersionResources, renderModel, renderModelFrames, resolveItem, resolveTexture, resolveTint, resolveTints, run, salvageJson, toByteTexture, toFloatTexture, weightedVariantIndex };
|
|
@@ -36,6 +36,7 @@ const MOD_LOADER_HANDLERS = {
|
|
|
36
36
|
"sophisticatedstorage:barrel": flattenStorageBarrel,
|
|
37
37
|
"sophisticatedstorage:limited_barrel": flattenStorageBarrel,
|
|
38
38
|
"sophisticatedstorage:simple_composite": mergeCompositeParts,
|
|
39
|
+
"morered:wire_parts": restrictWireToCentre,
|
|
39
40
|
"immersiveengineering:models/conveyor": flattenConveyor
|
|
40
41
|
};
|
|
41
42
|
/**
|
|
@@ -314,6 +315,24 @@ function restrictTransmitterToUnconnected(json) {
|
|
|
314
315
|
return marked;
|
|
315
316
|
}
|
|
316
317
|
/**
|
|
318
|
+
* MoreRed's wire loader holds the two shapes a wire draws *between* blocks
|
|
319
|
+
* (`line` across a face, `edge` around its corner) and picks per connection from
|
|
320
|
+
* the block entity. Neither is the wire itself: the blockstate places the centre
|
|
321
|
+
* separately, and an unconnected wire is only that centre. Taking one of the two,
|
|
322
|
+
* whichever the file happens to name first, put a stub in a corner of every wire
|
|
323
|
+
* in the world, so the loader draws nothing here and the block pack falls back to
|
|
324
|
+
* the mod's own item model, which is the wire's full cross.
|
|
325
|
+
*/
|
|
326
|
+
function restrictWireToCentre(json) {
|
|
327
|
+
const stripped = withoutLoader(json);
|
|
328
|
+
delete stripped.line;
|
|
329
|
+
delete stripped.edge;
|
|
330
|
+
return {
|
|
331
|
+
...stripped,
|
|
332
|
+
elements: []
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
317
336
|
* Botania's floating flowers are a mystical island with a flower planted on it:
|
|
318
337
|
* the loader draws `botania:block/islands/island_<type>` under the model named
|
|
319
338
|
* by the `flower` key. The island type is stored per block and defaults to
|
package/dist/models/loader.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as salvageJson, i as resolveTexture, n as ModelResolutionError, r as flattenLoaderModel, t as ModelLoader } from "../loader-
|
|
1
|
+
import { a as salvageJson, i as resolveTexture, n as ModelResolutionError, r as flattenLoaderModel, t as ModelLoader } from "../loader-C-NuJaEi.js";
|
|
2
2
|
export { ModelLoader, ModelResolutionError, flattenLoaderModel, resolveTexture, salvageJson };
|
|
@@ -7,7 +7,7 @@ import { t as combineFaceBuffers } from "./compose-BGsNFR12.js";
|
|
|
7
7
|
import { n as faceMaxZ, r as renderFace, t as createShadeCache } from "./face-CKHboPfh.js";
|
|
8
8
|
import { t as paintBucketFluid } from "./fluid-bucket-B-I4ZYHl.js";
|
|
9
9
|
import { r as buildElementFaces } from "./geometry-Bi-Bf5rb.js";
|
|
10
|
-
import { i as resolveTexture } from "./loader-
|
|
10
|
+
import { i as resolveTexture } from "./loader-C-NuJaEi.js";
|
|
11
11
|
//#region src/render/renderer.ts
|
|
12
12
|
/**
|
|
13
13
|
* Item rendering entry: flat generated items (2D layer compositing) and 3D
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as ResourceLocator } from "./locator-COMEtEn9.js";
|
|
2
|
-
import { n as parseMtl, r as parseObj, t as materialTexture } from "./obj-
|
|
2
|
+
import { n as parseMtl, r as parseObj, t as materialTexture } from "./obj-bvs3gwex.js";
|
|
3
3
|
//#region src/blocks/obj-mesh.ts
|
|
4
4
|
/**
|
|
5
5
|
* OBJ geometry as pack data.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as ResourceLocator } from "./locator-COMEtEn9.js";
|
|
2
2
|
import { l as toFloatTexture, t as blendPixel } from "./blend-KXMclcHk.js";
|
|
3
|
-
import { t as ModelLoader } from "./loader-
|
|
4
|
-
import { c as renderModel, l as renderModelFrames, o as boxDownscale, s as pointResize } from "./obj-
|
|
3
|
+
import { t as ModelLoader } from "./loader-C-NuJaEi.js";
|
|
4
|
+
import { c as renderModel, l as renderModelFrames, o as boxDownscale, s as pointResize } from "./obj-bvs3gwex.js";
|
|
5
5
|
import { t as loadAtlasResolver } from "./registry-DlduyjtM.js";
|
|
6
6
|
import { n as LayeredResourceManager, t as FolderResourceManager } from "./manager-CYbAkWuT.js";
|
|
7
7
|
import { n as TextureLoader } from "./loader-C18GpurU.js";
|
|
@@ -9,7 +9,7 @@ import { a as defaultProperties } from "./definition-ColsvWrH.js";
|
|
|
9
9
|
import { r as resolveItem } from "./discovery-CsZu08re.js";
|
|
10
10
|
import { t as encodeAnimatedIcon } from "./encode-LR9wxigC.js";
|
|
11
11
|
import { a as builtinDynamicResources } from "./generators-BCZVlWig.js";
|
|
12
|
-
import { a as spawnEggTints, i as renderEntityFallback, n as dyedVariantTint, r as renderDyedVariantFallback, t as dyeVariantName } from "./entity-fallback-
|
|
12
|
+
import { a as spawnEggTints, i as renderEntityFallback, n as dyedVariantTint, r as renderDyedVariantFallback, t as dyeVariantName } from "./entity-fallback-BTkM8j0V.js";
|
|
13
13
|
import { i as renderGeo, t as findGeoForItem } from "./geo-BguldlU-.js";
|
|
14
14
|
import { t as legacyTintsForChain } from "./legacy-tints-l-541wgI.js";
|
|
15
15
|
import { a as resolveTints } from "./tints-B3WQcPtx.js";
|
|
@@ -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-BTkM8j0V.js";
|
|
2
2
|
export { dyeVariantName, dyedVariantTint, renderDyedVariantFallback, renderEntityFallback, spawnEggTints };
|
package/dist/render/obj.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as renderObjModel, n as parseMtl, r as parseObj, t as materialTexture } from "../obj-
|
|
1
|
+
import { i as renderObjModel, n as parseMtl, r as parseObj, t as materialTexture } from "../obj-bvs3gwex.js";
|
|
2
2
|
export { materialTexture, parseMtl, parseObj, renderObjModel };
|
package/dist/render/pipeline.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as ItemPipeline } from "../pipeline-
|
|
1
|
+
import { t as ItemPipeline } from "../pipeline-DeGRR0CP.js";
|
|
2
2
|
export { ItemPipeline };
|
package/dist/render/renderer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ItemRenderError, c as renderModel, l as renderModelFrames, o as boxDownscale, s as pointResize } from "../obj-
|
|
1
|
+
import { a as ItemRenderError, c as renderModel, l as renderModelFrames, o as boxDownscale, s as pointResize } from "../obj-bvs3gwex.js";
|
|
2
2
|
export { ItemRenderError, boxDownscale, pointResize, renderModel, renderModelFrames };
|
|
@@ -6,7 +6,7 @@ import { r as encodeRasterAsset } from "./encode-LR9wxigC.js";
|
|
|
6
6
|
import { t as classifyItemStyle } from "./item-styles-DjYRdyHi.js";
|
|
7
7
|
import { t as minifyStylesheet } from "./minify-bjMRmr5J.js";
|
|
8
8
|
import { t as generateStylesheet } from "./stylesheet-CovT3B2S.js";
|
|
9
|
-
import { t as ItemPipeline } from "./pipeline-
|
|
9
|
+
import { t as ItemPipeline } from "./pipeline-DeGRR0CP.js";
|
|
10
10
|
import { t as describeResources } from "./descriptor-BVIoEpPO.js";
|
|
11
11
|
import { t as WorkerRenderPool } from "./pool-CKGp1qup.js";
|
|
12
12
|
import path from "node:path";
|
package/dist/run.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as ItemPipeline } from "../pipeline-
|
|
1
|
+
import { t as ItemPipeline } from "../pipeline-DeGRR0CP.js";
|
|
2
2
|
import { n as restoreResources } from "../descriptor-BVIoEpPO.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.2.
|
|
3
|
+
"version": "1.2.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",
|