@nodecraft/rendermite 1.6.2 → 1.6.4

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.
@@ -1,2 +1,2 @@
1
- import { t as runBlocksCli } from "../cli-Br0mY0LV.js";
1
+ import { t as runBlocksCli } from "../cli-DUWWH_Rc.js";
2
2
  export { runBlocksCli };
@@ -1,2 +1,2 @@
1
- import { t as exportBlockPack } from "../export-CTKEwro6.js";
1
+ import { t as exportBlockPack } from "../export-CBXWRbBw.js";
2
2
  export { exportBlockPack };
@@ -0,0 +1,7 @@
1
+ import { a as ResourceManager } from "../manager-exOIcdyx.js";
2
+ import { f as BlockPackModel } from "../pack-format-QcVFxG_b.js";
3
+ //#region src/blocks/geo-blocks.d.ts
4
+ /** Converts the already-flattened Gecko quads into the block pack's 0–16 triangle mesh. */
5
+ declare function geoBlockModel(blockId: string, resources: ResourceManager): Promise<BlockPackModel | null>;
6
+ //#endregion
7
+ export { geoBlockModel };
@@ -0,0 +1,2 @@
1
+ import { t as geoBlockModel } from "../geo-blocks-CzkfL4Li.js";
2
+ export { geoBlockModel };
@@ -1,6 +1,6 @@
1
1
  import { n as builtinPackPath } from "./builtin-WkWjATeh.js";
2
2
  import { n as LayeredResourceManager, t as FolderResourceManager } from "./manager-BNibYkmI.js";
3
- import { t as exportBlockPack } from "./export-CTKEwro6.js";
3
+ import { t as exportBlockPack } from "./export-CBXWRbBw.js";
4
4
  import { n as layeredClasses, t as JarClassReader } from "./jar-classes-3GVCJZT7.js";
5
5
  import { n as prepareModResources } from "./prepare-Myd_ec4v.js";
6
6
  import { t as downloadClientJar } from "./download-1wAfrGKx.js";
package/dist/cli.js CHANGED
@@ -6,7 +6,7 @@ import { t as curatedModelOverrides } from "./models-CZjCOjs4.js";
6
6
  import { n as harvestTintOverrides, t as curatedTintOverrides } from "./tints-BspVCz2G.js";
7
7
  import { t as downloadClientJar } from "./download-1wAfrGKx.js";
8
8
  import { a as prepareVersionResources, i as eraForVersion, n as GEOMETRY_DONOR_VERSIONS } from "./prepare-D49Gu4Lv.js";
9
- import { t as runBlocksCli } from "./cli-Br0mY0LV.js";
9
+ import { t as runBlocksCli } from "./cli-DUWWH_Rc.js";
10
10
  import { t as run } from "./run-BXAqZ5qY.js";
11
11
  import path from "node:path";
12
12
  import os from "node:os";
@@ -4,6 +4,7 @@ import { n as blockEntityGeometry, r as synthesizeVariants, t as INVISIBLE_BLOCK
4
4
  import { a as parseBlockState, n as collectModels } from "./blockstate-eval-BRQ3NWY2.js";
5
5
  import { t as collectEntities } from "./entities-DubtdM11.js";
6
6
  import { t as collectEntityGeometry } from "./entity-models-D_QGok9j.js";
7
+ import { t as geoBlockModel } from "./geo-blocks-CzkfL4Li.js";
7
8
  import { n as discoverItems } from "./discovery-CD0QqxSF.js";
8
9
  import { a as salvageJson, i as resolveTexture, t as ModelLoader } from "./loader-C-NuJaEi.js";
9
10
  import { t as collectItemSprites } from "./item-sprites-G-yikdfV.js";
@@ -70,6 +71,29 @@ const FLUID_SUFFIX = /_(?:still|flow|flowing)$/;
70
71
  /** Sampled where water meets a non-opaque neighbour; matches no suffix. */
71
72
  const EXTRA_FLUID_SPRITES = ["minecraft:block/water_overlay"];
72
73
  /**
74
+ * Sprites selected by block-entity NBT rather than by a JSON blockstate/model graph.
75
+ *
76
+ * AE2's cable bus is assembled in Java from a saved cable plus zero or more face parts. Its JSON
77
+ * models are therefore unreachable from `collectModels`, even though a consumer has enough NBT to
78
+ * reconstruct it. Keep the small, stable texture vocabulary in the atlas for that renderer.
79
+ */
80
+ const DYNAMIC_BLOCK_ENTITY_SPRITES = { ae2: [
81
+ "ae2:part/cable/glass/transparent",
82
+ "ae2:part/cable/covered/transparent",
83
+ "ae2:part/cable/smart/transparent",
84
+ "ae2:part/cable/dense_covered/transparent",
85
+ "ae2:part/cable/dense_smart/transparent",
86
+ "ae2:part/storage_bus",
87
+ "ae2:part/storage_bus_back",
88
+ "ae2:part/storage_bus_sides",
89
+ "ae2:part/import_bus",
90
+ "ae2:part/import_bus_sides",
91
+ "ae2:part/export_bus",
92
+ "ae2:part/export_bus_sides",
93
+ "ae2:part/monitor_back",
94
+ "ae2:part/monitor_sides_status"
95
+ ] };
96
+ /**
73
97
  * Vanilla's `BlockElement.uvsByFace`: the UV a face gets when the model states
74
98
  * none. Deliberately not `render/geometry.ts`'s auto-UVs — those are in the
75
99
  * rasterizer's own unflipped convention, and the pack has to speak the same
@@ -392,6 +416,15 @@ async function exportBlockPack(options) {
392
416
  modelTintIndices.set(reference, tintIndices);
393
417
  for (const sprite of sprites) spriteIds.add(sprite);
394
418
  }
419
+ for (const [id, references] of blockModels) {
420
+ const geo = await geoBlockModel(id, resources);
421
+ if (!geo) continue;
422
+ for (const reference of references) {
423
+ emittedModels[reference] = geo;
424
+ modelTintIndices.set(reference, /* @__PURE__ */ new Set());
425
+ }
426
+ for (const group of geo.mesh ?? []) spriteIds.add(group.sprite);
427
+ }
395
428
  for (const [id, references] of blockModels) {
396
429
  if (references.some((reference) => {
397
430
  const model = emittedModels[reference];
@@ -575,6 +608,7 @@ async function exportBlockPack(options) {
575
608
  }
576
609
  for (const namespace of namespaces) for (const locator of await resources.listResources("texture", namespace)) if (FLUID_SUFFIX.test(locator.path)) spriteIds.add(locator.toString());
577
610
  for (const extra of EXTRA_FLUID_SPRITES) if (await resources.hasResource("texture", ResourceLocator.parse(extra))) spriteIds.add(extra);
611
+ for (const namespace of namespaces) for (const extra of DYNAMIC_BLOCK_ENTITY_SPRITES[namespace] ?? []) if (await resources.hasResource("texture", ResourceLocator.parse(extra))) spriteIds.add(extra);
578
612
  const sheet = await buildSpriteSheet(spriteIds, textures, {
579
613
  padding: options.padding,
580
614
  maxPageSize: options.maxPageSize,
@@ -0,0 +1,63 @@
1
+ import { n as ResourceLocator } from "./locator-COMEtEn9.js";
2
+ import { i as parseGeo, n as geoToFaces } from "./geo-Desq-gRC.js";
3
+ //#region src/blocks/geo-blocks.ts
4
+ /** GeckoLib block geometry selected by a Java block-entity renderer rather than its placeholder JSON. */
5
+ /** Blocks whose ordinary cube model exists only for particles/breaking and is replaced in Java. */
6
+ const GEO_BLOCKS = {
7
+ "ars_nouveau:arcane_core": {
8
+ geo: "ars_nouveau:geo/arcane_core.geo.json",
9
+ texture: "ars_nouveau:block/arcane_core"
10
+ },
11
+ "ars_nouveau:enchanting_apparatus": {
12
+ geo: "ars_nouveau:geo/enchanting_apparatus.geo.json",
13
+ texture: "ars_nouveau:block/enchanting_apparatus"
14
+ },
15
+ "ars_nouveau:imbuement_chamber": {
16
+ geo: "ars_nouveau:geo/imbuement_chamber.geo.json",
17
+ texture: "ars_nouveau:block/imbuement_chamber"
18
+ }
19
+ };
20
+ const TRIANGLE_CORNERS = [
21
+ 0,
22
+ 1,
23
+ 2,
24
+ 0,
25
+ 2,
26
+ 3
27
+ ];
28
+ /** Converts the already-flattened Gecko quads into the block pack's 0–16 triangle mesh. */
29
+ async function geoBlockModel(blockId, resources) {
30
+ const resource = GEO_BLOCKS[blockId];
31
+ if (!resource) return null;
32
+ const raw = await resources.getResource("raw", ResourceLocator.parse(resource.geo));
33
+ if (!raw) return null;
34
+ const geo = parseGeo(JSON.parse(raw.toString("utf8")));
35
+ if (!geo) return null;
36
+ const group = {
37
+ sprite: resource.texture,
38
+ positions: [],
39
+ uv: []
40
+ };
41
+ for (const face of geoToFaces(geo)) {
42
+ const uvs = [
43
+ [face.uv1[0], face.uv1[1]],
44
+ [face.uv1[0], face.uv2[1]],
45
+ [face.uv2[0], face.uv2[1]],
46
+ [face.uv2[0], face.uv1[1]]
47
+ ];
48
+ for (const corner of TRIANGLE_CORNERS) {
49
+ group.positions.push(...face.vertices[corner].map((value) => value * 16));
50
+ group.uv.push(uvs[corner][0] * 16, uvs[corner][1] * 16);
51
+ }
52
+ }
53
+ if (group.positions.length === 0) return null;
54
+ return {
55
+ ao: false,
56
+ elements: [],
57
+ mesh: [group],
58
+ particle: resource.texture,
59
+ renderType: "cutout"
60
+ };
61
+ }
62
+ //#endregion
63
+ export { geoBlockModel as t };
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ import { n as buildBlockTints, t as UNREGISTERED_TINTS } from "./tints-Cl0r-Ol3.
14
14
  import { o as createAtlasResolver, s as parseAtlasSources, t as AtlasSourceError } from "./sources-BlUriDCs.js";
15
15
  import { n as LayeredResourceManager, r as ResourceKind, t as FolderResourceManager } from "./manager-BNibYkmI.js";
16
16
  import { n as TextureLoader, r as TextureResolutionError, t as AnimatedTexture } from "./loader-C18GpurU.js";
17
- import { t as exportBlockPack } from "./export-CTKEwro6.js";
17
+ import { t as exportBlockPack } from "./export-CBXWRbBw.js";
18
18
  import { n as UnsafeJarError, r as isUnsafeEntryPath, t as JarResourceManager } from "./jar-W2cV2ZVO.js";
19
19
  import { n as prepareModResources } from "./prepare-Myd_ec4v.js";
20
20
  import { a as prepareVersionResources, i as eraForVersion, r as compareVersions } from "./prepare-D49Gu4Lv.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodecraft/rendermite",
3
- "version": "1.6.2",
3
+ "version": "1.6.4",
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",