@nodecraft/rendermite 1.0.4 → 1.0.6

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.
Files changed (121) hide show
  1. package/README.md +5 -0
  2. package/assets/README.md +3 -0
  3. package/assets/mod-tints/README.md +38 -0
  4. package/assets/mod-tints/advanced_ae/items/quantum_boots.json +16 -0
  5. package/assets/mod-tints/advanced_ae/items/quantum_chestplate.json +16 -0
  6. package/assets/mod-tints/advanced_ae/items/quantum_helmet.json +16 -0
  7. package/assets/mod-tints/advanced_ae/items/quantum_leggings.json +16 -0
  8. package/dist/atlas/registry.d.ts +3 -3
  9. package/dist/atlas/sources.d.ts +1 -1
  10. package/dist/{blend-Qvrn6YgK.d.ts → blend-CyDIxCne.d.ts} +1 -1
  11. package/dist/{builtin-C8GZEN40.js → builtin-caYjESh0.js} +5 -1
  12. package/dist/builtin.d.ts +3 -1
  13. package/dist/builtin.js +2 -2
  14. package/dist/cache-Cr2ON3RQ.js +66 -0
  15. package/dist/cli.js +40 -7
  16. package/dist/compose-CQCb2LVv.js +104 -0
  17. package/dist/descriptor-DWebtkI1.js +26 -0
  18. package/dist/{discovery-D89pVVJA.d.ts → discovery-wiJBGryo.d.ts} +1 -1
  19. package/dist/dynamic/generators.d.ts +1 -1
  20. package/dist/dynamic/generators.js +1 -1
  21. package/dist/{encode-3u49i-eD.js → encode-D6dQu2dJ.js} +16 -4
  22. package/dist/{encode-C5kdAm45.d.ts → encode-DaNQF28M.d.ts} +1 -1
  23. package/dist/{entity-fallback-CdCVEG6X.js → entity-fallback-BRCeGKBT.js} +1 -1
  24. package/dist/{face-CpVdnf-w.d.ts → face-BIYg14TE.d.ts} +10 -4
  25. package/dist/{face-D-N1amV4.js → face-DmCiHUd5.js} +23 -10
  26. package/dist/{generators-CcVRG30y.js → generators-BlG4KmtP.js} +1 -1
  27. package/dist/{generators-CCB8h0mP.d.ts → generators-DhRov4RB.d.ts} +1 -1
  28. package/dist/{geo-u8rndjLA.js → geo-Diky41Tw.js} +7 -4
  29. package/dist/index.d.ts +14 -14
  30. package/dist/index.js +13 -13
  31. package/dist/{item-styles-DJ3LWZS2.js → item-styles-upgEO1yP.js} +1 -1
  32. package/dist/items/discovery.d.ts +1 -1
  33. package/dist/items/discovery.js +1 -1
  34. package/dist/{jar-6T3xdgaL.d.ts → jar-CFkA-VgT.d.ts} +2 -1
  35. package/dist/{jar-Bt3i0ls4.js → jar-D9z-X7tA.js} +12 -12
  36. package/dist/{legacy-reshape-CewShfF3.js → legacy-reshape-C05SfAPR.js} +1 -1
  37. package/dist/{loader-A-BZa8J4.js → loader-B8NJO7pR.js} +12 -3
  38. package/dist/{loader-CBzn3Koc.js → loader-CfXMxcEV.js} +37 -7
  39. package/dist/{loader-C-6QN3xv.d.ts → loader-D22zZME7.d.ts} +2 -2
  40. package/dist/{loader-TFFNV4Jl.d.ts → loader-Myy22TDL.d.ts} +8 -2
  41. package/dist/{manager-dfI7b9N4.js → manager-CkletR5K.js} +29 -2
  42. package/dist/{manager-CoZaeQTu.d.ts → manager-Cv1NeFyF.d.ts} +28 -1
  43. package/dist/models/loader.d.ts +1 -1
  44. package/dist/models/loader.js +1 -1
  45. package/dist/mods/prepare.d.ts +1 -1
  46. package/dist/mods/prepare.js +1 -1
  47. package/dist/mods/synthesize.d.ts +2 -2
  48. package/dist/mods/synthesize.js +1 -1
  49. package/dist/mods/tints.d.ts +28 -0
  50. package/dist/mods/tints.js +2 -0
  51. package/dist/output/encode.d.ts +1 -1
  52. package/dist/output/encode.js +1 -1
  53. package/dist/output/item-styles.js +1 -1
  54. package/dist/pipeline-BIk1RRIp.js +221 -0
  55. package/dist/pipeline-zq-yU3Te.d.ts +58 -0
  56. package/dist/pool-CKGp1qup.js +131 -0
  57. package/dist/{prepare-Bvc5ve2m.js → prepare-BESRrh6K.js} +33 -5
  58. package/dist/{prepare-DnnGGv9k.d.ts → prepare-CPxO0kKz.d.ts} +8 -1
  59. package/dist/{prepare-DROxBZp1.js → prepare-Cc8QZ3j0.js} +4 -4
  60. package/dist/{prepare-wfWtaz_X.d.ts → prepare-Cs6QDqie.d.ts} +1 -1
  61. package/dist/{rasterizer-BHWDrmGz.js → rasterizer-76qO8TDh.js} +42 -4
  62. package/dist/{rasterizer-Dh35qXbn.d.ts → rasterizer-yqJkicm1.d.ts} +21 -2
  63. package/dist/render/blend.d.ts +1 -1
  64. package/dist/render/compose.d.ts +2 -2
  65. package/dist/render/compose.js +1 -1
  66. package/dist/render/entity-fallback.d.ts +6 -6
  67. package/dist/render/entity-fallback.js +1 -1
  68. package/dist/render/face.d.ts +2 -2
  69. package/dist/render/face.js +1 -1
  70. package/dist/render/fluid-bucket.d.ts +2 -2
  71. package/dist/render/geo.d.ts +4 -4
  72. package/dist/render/geo.js +1 -1
  73. package/dist/render/legacy-tints.d.ts +2 -2
  74. package/dist/render/obj.d.ts +5 -5
  75. package/dist/render/obj.js +1 -1
  76. package/dist/render/pipeline.d.ts +2 -0
  77. package/dist/render/pipeline.js +2 -0
  78. package/dist/render/rasterizer.d.ts +2 -2
  79. package/dist/render/rasterizer.js +2 -2
  80. package/dist/render/renderer.d.ts +2 -2
  81. package/dist/render/renderer.js +1 -1
  82. package/dist/render/tints.d.ts +1 -1
  83. package/dist/{renderer-BeOinVC8.js → renderer-CjT19tHd.js} +131 -54
  84. package/dist/{renderer-nbMCw1Pl.d.ts → renderer-DVsZHAvf.d.ts} +23 -6
  85. package/dist/resources/cache.d.ts +30 -0
  86. package/dist/resources/cache.js +2 -0
  87. package/dist/resources/descriptor.d.ts +2 -0
  88. package/dist/resources/descriptor.js +2 -0
  89. package/dist/resources/jar.d.ts +1 -1
  90. package/dist/resources/jar.js +1 -1
  91. package/dist/resources/manager.d.ts +1 -1
  92. package/dist/resources/manager.js +1 -1
  93. package/dist/resources/synthetic.d.ts +1 -1
  94. package/dist/resources/synthetic.js +1 -1
  95. package/dist/resources/zip-reader.d.ts +5 -0
  96. package/dist/resources/zip-reader.js +2 -0
  97. package/dist/run-BnICOF4I.js +209 -0
  98. package/dist/{run-BlSZw9Qk.d.ts → run-CKUtynTy.d.ts} +12 -2
  99. package/dist/run.d.ts +1 -1
  100. package/dist/run.js +1 -1
  101. package/dist/{sources-DH9dk3KF.d.ts → sources-B9X9w3qP.d.ts} +1 -1
  102. package/dist/{synthesize-CRgSEmEp.js → synthesize-3Q0aaOnK.js} +1 -1
  103. package/dist/{synthetic-CDsj--li.d.ts → synthetic-Qk-BSUXO.d.ts} +5 -1
  104. package/dist/{synthetic-DC2bSnGe.js → synthetic-ZAUjXT7E.js} +0 -0
  105. package/dist/textures/loader.d.ts +1 -1
  106. package/dist/textures/loader.js +1 -1
  107. package/dist/tints-B8UJmZMu.js +83 -0
  108. package/dist/{tints-txt-8xI5.d.ts → tints-DLBExVWN.d.ts} +2 -2
  109. package/dist/versions/legacy-reshape.d.ts +1 -1
  110. package/dist/versions/legacy-reshape.js +1 -1
  111. package/dist/versions/prepare.d.ts +1 -1
  112. package/dist/versions/prepare.js +1 -1
  113. package/dist/workers/pool.d.ts +36 -5
  114. package/dist/workers/pool.js +2 -67
  115. package/dist/workers/render-worker.d.ts +15 -0
  116. package/dist/workers/render-worker.js +40 -0
  117. package/dist/zip-reader-BSbJKUT1.js +156 -0
  118. package/package.json +4 -2
  119. package/dist/compose-qjhyBvnS.js +0 -41
  120. package/dist/run-DI-cB38y.js +0 -316
  121. package/dist/{discovery-iph0P2F2.js → discovery-0SM0cTLw.js} +1 -1
@@ -1,4 +1,4 @@
1
- import { n as MapResourceManager } from "./synthetic-CDsj--li.js";
1
+ import { n as MapResourceManager } from "./synthetic-Qk-BSUXO.js";
2
2
  //#region src/dynamic/generators.d.ts
3
3
  declare const TRIM_MATERIALS: readonly ["quartz", "iron", "gold", "diamond", "netherite", "redstone", "copper", "emerald", "lapis", "amethyst", "resin"];
4
4
  /** Materials with a darker variant used when the trim matches the armor metal. */
@@ -1,8 +1,9 @@
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
- import { t as combineFaceBuffers } from "./compose-qjhyBvnS.js";
5
- import { n as renderFace, t as faceMaxZ } from "./face-D-N1amV4.js";
4
+ import { t as combineFaceBuffers } from "./compose-CQCb2LVv.js";
5
+ import { i as createFaceBuffer } from "./rasterizer-76qO8TDh.js";
6
+ import { n as renderFace, t as faceMaxZ } from "./face-DmCiHUd5.js";
6
7
  import { c as lightsForProfile } from "./lighting--5myudVu.js";
7
8
  //#region src/render/geo.ts
8
9
  /**
@@ -322,8 +323,10 @@ async function renderGeo(geo, texture, textures, options) {
322
323
  });
323
324
  renderable.sort((a, b) => a.maxZ - b.maxZ);
324
325
  const buffers = [];
326
+ const scratch = createFaceBuffer(renderSize, renderSize);
327
+ const shadeCache = /* @__PURE__ */ new WeakMap();
325
328
  for (const face of renderable) {
326
- const buffer = renderFace(face, renderSize, renderSize, transformation);
329
+ const buffer = renderFace(face, renderSize, renderSize, transformation, scratch, shadeCache);
327
330
  if (buffer) buffers.push(buffer);
328
331
  }
329
332
  if (buffers.length === 0) return null;
package/dist/index.d.ts CHANGED
@@ -1,20 +1,20 @@
1
1
  import { n as ResourceLocator, t as InvalidResourceLocatorError } from "./locator-jDbdUeTd.js";
2
- import { a as ResourceManager, i as ResourceKindName, n as LayeredResourceManager, r as ResourceKind, t as FolderResourceManager } from "./manager-CoZaeQTu.js";
3
- import { a as TextureMeta, i as TextureLoader, o as TextureResolutionError, r as Texture, t as AnimatedTexture } from "./loader-TFFNV4Jl.js";
4
- import { d as parseAtlasSources, n as AtlasSource, r as AtlasSourceError, s as ResolvedSprite, t as AtlasResolver, u as createAtlasResolver } from "./sources-DH9dk3KF.js";
5
- import { s as builtinDynamicResources } from "./generators-CCB8h0mP.js";
6
- import { a as resolveTexture, n as ModelResolutionError, o as salvageJson, r as ResolvedModel, t as ModelLoader } from "./loader-C-6QN3xv.js";
7
- import { c as toFloatTexture, s as toByteTexture, t as FloatTexture } from "./blend-Qvrn6YgK.js";
2
+ import { a as ResourceManager, i as ResourceKindName, n as LayeredResourceManager, r as ResourceKind, t as FolderResourceManager } from "./manager-Cv1NeFyF.js";
3
+ import { a as TextureMeta, i as TextureLoader, o as TextureResolutionError, r as Texture, t as AnimatedTexture } from "./loader-Myy22TDL.js";
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
+ import { s as builtinDynamicResources } from "./generators-DhRov4RB.js";
6
+ import { a as resolveTexture, n as ModelResolutionError, o as salvageJson, r as ResolvedModel, t as ModelLoader } from "./loader-D22zZME7.js";
7
+ import { c as toFloatTexture, s as toByteTexture, t as FloatTexture } from "./blend-CyDIxCne.js";
8
8
  import { a as LightingProfileName, i as LightingProfile, r as LightSource, u as lightsForProfile } from "./lighting-3FGRC3Af.js";
9
- import { a as pointResize, i as boxDownscale, n as RenderOptions, o as renderModel, r as RenderedFrames, s as renderModelFrames, t as ItemRenderError } from "./renderer-nbMCw1Pl.js";
9
+ import { a as RenderedFrames, c as renderModel, i as RenderOptions, l as renderModelFrames, o as boxDownscale, r as ItemRenderError, s as pointResize } from "./renderer-DVsZHAvf.js";
10
10
  import { c as defaultProperties, i as ItemRenderInstruction, l as evaluateItemModel, n as InvalidItemDefinitionError, o as TintDefinition, r as ItemProperties, s as UNKNOWN_MODEL } from "./definition-BwX6Xxv0.js";
11
- import { a as resolveItem, i as discoverItems, n as ItemDiscoveryOptions, r as ItemResolutionError, t as DiscoveredItem } from "./discovery-D89pVVJA.js";
12
- import { a as resolveTint, i as parseTintValue, n as InvalidTinterDefinitionError, o as resolveTints, t as DYE_COLORS } from "./tints-txt-8xI5.js";
13
- import { i as EncodedIcon, n as EncodeOptions, o as encodeAnimatedIcon, r as EncodedAnimatedIcon, s as encodeIcon, t as AnimatedEncodeOptions } from "./encode-C5kdAm45.js";
11
+ import { a as resolveItem, i as discoverItems, n as ItemDiscoveryOptions, r as ItemResolutionError, t as DiscoveredItem } from "./discovery-wiJBGryo.js";
12
+ import { a as resolveTint, i as parseTintValue, n as InvalidTinterDefinitionError, o as resolveTints, t as DYE_COLORS } from "./tints-DLBExVWN.js";
13
+ import { i as EncodedIcon, n as EncodeOptions, o as encodeAnimatedIcon, r as EncodedAnimatedIcon, s as encodeIcon, t as AnimatedEncodeOptions } from "./encode-DaNQF28M.js";
14
14
  import { t as minifyStylesheet } from "./minify-CIV6enbr.js";
15
- import { a as compareVersions, o as eraForVersion, s as prepareVersionResources } from "./prepare-wfWtaz_X.js";
16
- import { i as prepareModResources } from "./prepare-DnnGGv9k.js";
15
+ import { a as compareVersions, o as eraForVersion, s as prepareVersionResources } from "./prepare-Cs6QDqie.js";
16
+ import { i as prepareModResources } from "./prepare-CPxO0kKz.js";
17
17
  import { i as itemClass, n as StylesheetOptions, r as generateStylesheet, t as ItemStyle } from "./stylesheet-i-t_7sZ7.js";
18
- import { i as run, n as RunOptions, r as RunResult, t as ItemFailure } from "./run-BlSZw9Qk.js";
19
- import { n as UnsafeJarError, r as isUnsafeEntryPath, t as JarResourceManager } from "./jar-6T3xdgaL.js";
18
+ import { i as run, n as RunOptions, r as RunResult, t as ItemFailure } from "./run-CKUtynTy.js";
19
+ import { n as UnsafeJarError, r as isUnsafeEntryPath, t as JarResourceManager } from "./jar-CFkA-VgT.js";
20
20
  export { type AnimatedEncodeOptions, AnimatedTexture, type AtlasResolver, type AtlasSource, AtlasSourceError, DYE_COLORS, type DiscoveredItem, type EncodeOptions, type EncodedAnimatedIcon, type EncodedIcon, type FloatTexture, FolderResourceManager, InvalidItemDefinitionError, InvalidResourceLocatorError, InvalidTinterDefinitionError, type ItemDiscoveryOptions, type ItemFailure, type ItemProperties, ItemRenderError, type ItemRenderInstruction, ItemResolutionError, type ItemStyle, JarResourceManager, LayeredResourceManager, type LightSource, LightingProfile, type LightingProfileName, ModelLoader, ModelResolutionError, type RenderOptions, type RenderedFrames, type ResolvedModel, type ResolvedSprite, ResourceKind, type ResourceKindName, ResourceLocator, type ResourceManager, type RunOptions, type RunResult, type StylesheetOptions, type Texture, TextureLoader, type TextureMeta, TextureResolutionError, type TintDefinition, UNKNOWN_MODEL, 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/index.js CHANGED
@@ -1,20 +1,20 @@
1
- import { n as ResourceLocator, t as InvalidResourceLocatorError } from "./locator-ycZzh_6z.js";
2
- import { n as LayeredResourceManager, r as ResourceKind, t as FolderResourceManager } from "./manager-dfI7b9N4.js";
3
- import { n as UnsafeJarError, r as isUnsafeEntryPath, t as JarResourceManager } from "./jar-Bt3i0ls4.js";
4
- import { o as createAtlasResolver, s as parseAtlasSources, t as AtlasSourceError } from "./sources-Bxk-WOzH.js";
5
- import { a as builtinDynamicResources } from "./generators-CcVRG30y.js";
6
1
  import { a as defaultProperties, i as UNKNOWN_MODEL, n as InvalidItemDefinitionError, o as evaluateItemModel } from "./definition-3MBm8ar_.js";
7
- import { n as discoverItems, r as resolveItem, t as ItemResolutionError } from "./discovery-iph0P2F2.js";
8
- import { a as salvageJson, i as resolveTexture, n as ModelResolutionError, t as ModelLoader } from "./loader-A-BZa8J4.js";
2
+ import { n as ResourceLocator, t as InvalidResourceLocatorError } from "./locator-ycZzh_6z.js";
3
+ import { n as LayeredResourceManager, r as ResourceKind, t as FolderResourceManager } from "./manager-CkletR5K.js";
4
+ import { n as UnsafeJarError, r as isUnsafeEntryPath, t as JarResourceManager } from "./jar-D9z-X7tA.js";
5
+ import { n as discoverItems, r as resolveItem, t as ItemResolutionError } from "./discovery-0SM0cTLw.js";
9
6
  import { o as toByteTexture, s as toFloatTexture } from "./blend-CHP2-j9U.js";
10
- import { n as encodeIcon, t as encodeAnimatedIcon } from "./encode-3u49i-eD.js";
7
+ import { n as encodeIcon, t as encodeAnimatedIcon } from "./encode-D6dQu2dJ.js";
8
+ import { a as builtinDynamicResources } from "./generators-BlG4KmtP.js";
11
9
  import { t as minifyStylesheet } from "./minify-bjMRmr5J.js";
12
10
  import { n as itemClass, t as generateStylesheet } from "./stylesheet-CovT3B2S.js";
13
11
  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-BeOinVC8.js";
12
+ import { a as salvageJson, i as resolveTexture, n as ModelResolutionError, t as ModelLoader } from "./loader-B8NJO7pR.js";
13
+ import { a as renderModelFrames, i as renderModel, n as boxDownscale, r as pointResize, t as ItemRenderError } from "./renderer-CjT19tHd.js";
15
14
  import { a as resolveTints, i as resolveTint, n as InvalidTinterDefinitionError, r as parseTintValue, t as DYE_COLORS } from "./tints-BtbHegpI.js";
16
- import { n as TextureLoader, r as TextureResolutionError, t as AnimatedTexture } from "./loader-CBzn3Koc.js";
17
- import { t as run } from "./run-DI-cB38y.js";
18
- import { a as prepareVersionResources, i as eraForVersion, r as compareVersions } from "./prepare-DROxBZp1.js";
19
- import { n as prepareModResources } from "./prepare-Bvc5ve2m.js";
15
+ import { o as createAtlasResolver, s as parseAtlasSources, t as AtlasSourceError } from "./sources-Bxk-WOzH.js";
16
+ import { n as TextureLoader, r as TextureResolutionError, t as AnimatedTexture } from "./loader-CfXMxcEV.js";
17
+ import { t as run } from "./run-BnICOF4I.js";
18
+ import { a as prepareVersionResources, i as eraForVersion, r as compareVersions } from "./prepare-Cc8QZ3j0.js";
19
+ import { n as prepareModResources } from "./prepare-BESRrh6K.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 };
@@ -1,4 +1,4 @@
1
- import { i as TRIM_MATERIALS, n as POTTERY_SHERDS, r as TRIM_DARKER_MATERIALS, t as ARMOR_ITEM_TYPES } from "./generators-CcVRG30y.js";
1
+ import { i as TRIM_MATERIALS, n as POTTERY_SHERDS, r as TRIM_DARKER_MATERIALS, t as ARMOR_ITEM_TYPES } from "./generators-BlG4KmtP.js";
2
2
  //#region src/output/item-styles.ts
3
3
  /**
4
4
  * Per-item CSS style classification, ported from upstream's ItemStyleGenerators
@@ -1,2 +1,2 @@
1
- import { a as resolveItem, i as discoverItems, n as ItemDiscoveryOptions, r as ItemResolutionError, t as DiscoveredItem } from "../discovery-D89pVVJA.js";
1
+ import { a as resolveItem, i as discoverItems, n as ItemDiscoveryOptions, r as ItemResolutionError, t as DiscoveredItem } from "../discovery-wiJBGryo.js";
2
2
  export { DiscoveredItem, ItemDiscoveryOptions, ItemResolutionError, discoverItems, resolveItem };
@@ -1,2 +1,2 @@
1
- import { n as discoverItems, r as resolveItem, t as ItemResolutionError } from "../discovery-iph0P2F2.js";
1
+ import { n as discoverItems, r as resolveItem, t as ItemResolutionError } from "../discovery-0SM0cTLw.js";
2
2
  export { ItemResolutionError, discoverItems, resolveItem };
@@ -1,5 +1,5 @@
1
1
  import { n as ResourceLocator } from "./locator-jDbdUeTd.js";
2
- import { a as ResourceManager, i as ResourceKindName } from "./manager-CoZaeQTu.js";
2
+ import { a as ResourceManager, i as ResourceKindName, s as ResourceDescriptor } from "./manager-Cv1NeFyF.js";
3
3
  //#region src/resources/jar.d.ts
4
4
  /** Jar entries that could escape the archive get the whole jar rejected. */
5
5
  declare function isUnsafeEntryPath(entryPath: string): boolean;
@@ -15,6 +15,7 @@ declare class JarResourceManager implements ResourceManager {
15
15
  getAllResources(kind: ResourceKindName, locator: ResourceLocator): Promise<Buffer[]>;
16
16
  listResources(kind: ResourceKindName, namespace: string): Promise<ResourceLocator[]>;
17
17
  listNamespaces(): Promise<string[]>;
18
+ describe(): ResourceDescriptor;
18
19
  close(): Promise<void>;
19
20
  }
20
21
  //#endregion
@@ -1,6 +1,6 @@
1
1
  import { n as ResourceLocator } from "./locator-ycZzh_6z.js";
2
- import { r as ResourceKind } from "./manager-dfI7b9N4.js";
3
- import { open } from "yauzl";
2
+ import { r as ResourceKind } from "./manager-CkletR5K.js";
3
+ import { t as openZip } from "./zip-reader-BSbJKUT1.js";
4
4
  //#region src/resources/jar.ts
5
5
  /**
6
6
  * Reads resources directly out of a jar/zip — no extraction step, unlike the
@@ -19,15 +19,9 @@ var JarResourceManager = class {
19
19
  this.jarPath = jarPath;
20
20
  }
21
21
  getIndex() {
22
- this.index ??= new Promise((resolve, reject) => {
23
- open(this.jarPath, {
24
- lazyEntries: true,
25
- autoClose: false
26
- }, (err, zip) => {
27
- if (err) {
28
- reject(err);
29
- return;
30
- }
22
+ this.index ??= (async () => {
23
+ const zip = await openZip(this.jarPath);
24
+ return new Promise((resolve, reject) => {
31
25
  const entries = /* @__PURE__ */ new Map();
32
26
  const entriesLower = /* @__PURE__ */ new Map();
33
27
  const namespaces = /* @__PURE__ */ new Set();
@@ -55,7 +49,7 @@ var JarResourceManager = class {
55
49
  zip.on("error", reject);
56
50
  zip.readEntry();
57
51
  });
58
- });
52
+ })();
59
53
  return this.index;
60
54
  }
61
55
  entryPath(kind, locator) {
@@ -108,6 +102,12 @@ var JarResourceManager = class {
108
102
  async listNamespaces() {
109
103
  return [...(await this.getIndex()).namespaces].toSorted((left, right) => left.localeCompare(right));
110
104
  }
105
+ describe() {
106
+ return {
107
+ kind: "jar",
108
+ path: this.jarPath
109
+ };
110
+ }
111
111
  async close() {
112
112
  if (this.index) {
113
113
  (await this.index).zip.close();
@@ -1,4 +1,4 @@
1
- import { n as MapResourceManager } from "./synthetic-DC2bSnGe.js";
1
+ import { n as MapResourceManager } from "./synthetic-ZAUjXT7E.js";
2
2
  import { open } from "yauzl";
3
3
  import sharp from "sharp";
4
4
  //#region src/versions/legacy-reshape.ts
@@ -1,4 +1,5 @@
1
1
  import { n as ResourceLocator } from "./locator-ycZzh_6z.js";
2
+ import { t as LruCache } from "./cache-Cr2ON3RQ.js";
2
3
  //#region src/models/loader.ts
3
4
  var ModelResolutionError = class extends Error {};
4
5
  const MAX_PARENT_DEPTH = 64;
@@ -248,12 +249,20 @@ function salvageJson(text) {
248
249
  }
249
250
  return null;
250
251
  }
252
+ /**
253
+ * Resolved models and their source JSON are small but there are a lot of them:
254
+ * a full modded run walks thousands of namespaces in one process, so the caches
255
+ * are bounded rather than kept for the life of the run.
256
+ */
257
+ const MAX_CACHED_MODELS = 4096;
251
258
  var ModelLoader = class {
252
259
  resources;
253
- cache = /* @__PURE__ */ new Map();
254
- jsonCache = /* @__PURE__ */ new Map();
255
- constructor(resources) {
260
+ cache;
261
+ jsonCache;
262
+ constructor(resources, maxCachedModels = MAX_CACHED_MODELS) {
256
263
  this.resources = resources;
264
+ this.cache = new LruCache(maxCachedModels);
265
+ this.jsonCache = new LruCache(maxCachedModels);
257
266
  }
258
267
  readModelJson(locator) {
259
268
  const key = locator.toString();
@@ -1,6 +1,10 @@
1
+ import { t as LruCache } from "./cache-Cr2ON3RQ.js";
1
2
  import sharp from "sharp";
2
3
  //#region src/textures/loader.ts
3
4
  var TextureResolutionError = class extends Error {};
5
+ /** Decoded-pixel budget and hard entry cap for one loader's texture cache. */
6
+ const MAX_TEXTURE_CACHE_BYTES = 134217728;
7
+ const MAX_TEXTURE_CACHE_ENTRIES = 8192;
4
8
  /**
5
9
  * Animation-aware texture access: frame extraction over strips and grids with
6
10
  * mcmeta frame lists, per-frame times, and interpolation (upstream semantics:
@@ -42,6 +46,25 @@ var AnimatedTexture = class {
42
46
  }
43
47
  return this.frameCount * frameTime;
44
48
  }
49
+ /**
50
+ * Ticks within one cycle at which the displayed frame changes. Used to emit
51
+ * exactly the frames an animation actually has instead of walking every tick
52
+ * of a combined timeline that can run to tens of thousands.
53
+ */
54
+ frameStartTicks() {
55
+ const animation = this.meta?.animation;
56
+ if (!animation || this.frameCount <= 1) return [0];
57
+ const frameTime = animation.frametime ?? 1;
58
+ const frames = animation.frames;
59
+ if (!frames?.length) return Array.from({ length: this.frameCount }, (_, index) => index * frameTime);
60
+ const starts = [];
61
+ let tick = 0;
62
+ for (const entry of frames) {
63
+ starts.push(tick);
64
+ tick += typeof entry === "number" ? frameTime : entry.time ?? frameTime;
65
+ }
66
+ return starts;
67
+ }
45
68
  /** Which physical frame index shows at a tick, and the interpolation factor. */
46
69
  resolveFrame(tick) {
47
70
  const animation = this.meta?.animation;
@@ -107,10 +130,14 @@ var AnimatedTexture = class {
107
130
  };
108
131
  var TextureLoader = class {
109
132
  resources;
110
- cache = /* @__PURE__ */ new Map();
133
+ cache;
111
134
  atlas = null;
112
- constructor(resources) {
135
+ constructor(resources, maxCacheBytes = MAX_TEXTURE_CACHE_BYTES) {
113
136
  this.resources = resources;
137
+ this.cache = new LruCache(MAX_TEXTURE_CACHE_ENTRIES, {
138
+ maxWeight: maxCacheBytes,
139
+ weigh: (pending) => pending.bytes ?? 0
140
+ });
114
141
  }
115
142
  async decode(locator) {
116
143
  let raw = await this.resources.getResource("texture", locator);
@@ -183,11 +210,14 @@ var TextureLoader = class {
183
210
  */
184
211
  async load(locator) {
185
212
  const key = locator.toString();
186
- let pending = this.cache.get(key);
187
- if (!pending) {
188
- pending = this.decode(locator);
189
- this.cache.set(key, pending);
190
- }
213
+ const cached = this.cache.get(key);
214
+ if (cached) return cached;
215
+ const pending = this.decode(locator);
216
+ this.cache.set(key, pending);
217
+ pending.then((texture) => {
218
+ Object.assign(pending, { bytes: texture ? texture.data.length : 0 });
219
+ this.cache.settle(key, pending);
220
+ }).catch(() => {});
191
221
  return pending;
192
222
  }
193
223
  };
@@ -1,5 +1,5 @@
1
1
  import { n as ResourceLocator } from "./locator-jDbdUeTd.js";
2
- import { a as ResourceManager } from "./manager-CoZaeQTu.js";
2
+ import { a as ResourceManager } from "./manager-Cv1NeFyF.js";
3
3
  import { c as ModelJson, n as DisplayTransformJson, o as ModelElementJson, t as DisplayPosition } from "./types-COGbtA1t.js";
4
4
  //#region src/models/loader.d.ts
5
5
  /**
@@ -54,7 +54,7 @@ declare class ModelLoader {
54
54
  private readonly resources;
55
55
  private readonly cache;
56
56
  private readonly jsonCache;
57
- constructor(resources: ResourceManager);
57
+ constructor(resources: ResourceManager, maxCachedModels?: number);
58
58
  private readModelJson;
59
59
  private loadModelJson;
60
60
  private resolve;
@@ -1,5 +1,5 @@
1
1
  import { n as ResourceLocator } from "./locator-jDbdUeTd.js";
2
- import { a as ResourceManager } from "./manager-CoZaeQTu.js";
2
+ import { a as ResourceManager } from "./manager-Cv1NeFyF.js";
3
3
  //#region src/textures/loader.d.ts
4
4
  /** Structural interface for atlas resolvers (avoids a circular module edge). */
5
5
  interface AtlasResolverLike {
@@ -48,6 +48,12 @@ declare class AnimatedTexture {
48
48
  get interpolated(): boolean;
49
49
  /** Total animation length in game ticks (1 for unanimated). */
50
50
  get tickLength(): number;
51
+ /**
52
+ * Ticks within one cycle at which the displayed frame changes. Used to emit
53
+ * exactly the frames an animation actually has instead of walking every tick
54
+ * of a combined timeline that can run to tens of thousands.
55
+ */
56
+ frameStartTicks(): number[];
51
57
  /** Which physical frame index shows at a tick, and the interpolation factor. */
52
58
  resolveFrame(tick: number): {
53
59
  frame: number;
@@ -62,7 +68,7 @@ declare class TextureLoader {
62
68
  private readonly resources;
63
69
  private readonly cache;
64
70
  private atlas;
65
- constructor(resources: ResourceManager);
71
+ constructor(resources: ResourceManager, maxCacheBytes?: number);
66
72
  private decode;
67
73
  private readMeta;
68
74
  /**
@@ -1,7 +1,7 @@
1
1
  import { n as ResourceLocator } from "./locator-ycZzh_6z.js";
2
2
  import path from "node:path";
3
3
  import { existsSync } from "node:fs";
4
- import { readFile, readdir } from "node:fs/promises";
4
+ import { readFile, readdir, stat } from "node:fs/promises";
5
5
  //#region src/resources/manager.ts
6
6
  /**
7
7
  * A category of resource inside a pack, mapping to a directory under
@@ -65,7 +65,11 @@ var FolderResourceManager = class {
65
65
  }
66
66
  }
67
67
  async hasResource(kind, locator) {
68
- return await this.getResource(kind, locator) !== null;
68
+ try {
69
+ return (await stat(this.resolve(kind, locator))).isFile();
70
+ } catch {
71
+ return false;
72
+ }
69
73
  }
70
74
  async getAllResources(kind, locator) {
71
75
  const resource = await this.getResource(kind, locator);
@@ -102,6 +106,12 @@ var FolderResourceManager = class {
102
106
  throw err;
103
107
  }
104
108
  }
109
+ describe() {
110
+ return {
111
+ kind: "folder",
112
+ root: this.root
113
+ };
114
+ }
105
115
  };
106
116
  /**
107
117
  * Layers several managers; earlier managers win, matching resource-pack precedence.
@@ -145,6 +155,23 @@ var LayeredResourceManager = class {
145
155
  for (const layer of this.layers) for (const namespace of await layer.listNamespaces()) namespaces.add(namespace);
146
156
  return [...namespaces].toSorted((left, right) => left.localeCompare(right));
147
157
  }
158
+ describe() {
159
+ const layers = [];
160
+ for (const layer of this.layers) {
161
+ const described = describeLayer(layer);
162
+ if (!described) return null;
163
+ layers.push(described);
164
+ }
165
+ return {
166
+ kind: "layered",
167
+ layers
168
+ };
169
+ }
148
170
  };
171
+ /** Local copy of describeResources, avoiding an import cycle with descriptor.ts. */
172
+ function describeLayer(manager) {
173
+ const describable = manager;
174
+ return typeof describable.describe === "function" ? describable.describe() : null;
175
+ }
149
176
  //#endregion
150
177
  export { LayeredResourceManager as n, ResourceKind as r, FolderResourceManager as t };
@@ -1,4 +1,29 @@
1
1
  import { n as ResourceLocator } from "./locator-jDbdUeTd.js";
2
+ //#region src/resources/descriptor.d.ts
3
+ type ResourceDescriptor = {
4
+ kind: 'folder';
5
+ root: string;
6
+ } | {
7
+ kind: 'jar';
8
+ path: string;
9
+ } | {
10
+ kind: 'map';
11
+ entries: Array<[string, Uint8Array]>;
12
+ } | {
13
+ kind: 'layered';
14
+ layers: ResourceDescriptor[];
15
+ } | {
16
+ kind: 'kindFiltered';
17
+ inner: ResourceDescriptor;
18
+ kinds: ResourceKindName[];
19
+ };
20
+ /** Managers that can cross a worker boundary implement this. */
21
+ interface DescribableResourceManager extends ResourceManager {
22
+ describe(): ResourceDescriptor | null;
23
+ }
24
+ declare function describeResources(manager: ResourceManager): ResourceDescriptor | null;
25
+ declare function restoreResources(descriptor: ResourceDescriptor): ResourceManager;
26
+ //#endregion
2
27
  //#region src/resources/manager.d.ts
3
28
  /**
4
29
  * A category of resource inside a pack, mapping to a directory under
@@ -70,6 +95,7 @@ declare class FolderResourceManager implements ResourceManager {
70
95
  getAllResources(kind: ResourceKindName, locator: ResourceLocator): Promise<Buffer[]>;
71
96
  listResources(kind: ResourceKindName, namespace: string): Promise<ResourceLocator[]>;
72
97
  listNamespaces(): Promise<string[]>;
98
+ describe(): ResourceDescriptor;
73
99
  }
74
100
  /**
75
101
  * Layers several managers; earlier managers win, matching resource-pack precedence.
@@ -83,6 +109,7 @@ declare class LayeredResourceManager implements ResourceManager {
83
109
  getAllResources(kind: ResourceKindName, locator: ResourceLocator): Promise<Buffer[]>;
84
110
  listResources(kind: ResourceKindName, namespace: string): Promise<ResourceLocator[]>;
85
111
  listNamespaces(): Promise<string[]>;
112
+ describe(): ResourceDescriptor | null;
86
113
  }
87
114
  //#endregion
88
- export { ResourceManager as a, ResourceKindName as i, LayeredResourceManager as n, ResourceKind as r, FolderResourceManager as t };
115
+ export { ResourceManager as a, describeResources as c, ResourceKindName as i, restoreResources as l, LayeredResourceManager as n, DescribableResourceManager as o, ResourceKind as r, ResourceDescriptor as s, FolderResourceManager as t };
@@ -1,2 +1,2 @@
1
- import { a as resolveTexture, i as flattenLoaderModel, n as ModelResolutionError, o as salvageJson, r as ResolvedModel, t as ModelLoader } from "../loader-C-6QN3xv.js";
1
+ import { a as resolveTexture, i as flattenLoaderModel, n as ModelResolutionError, o as salvageJson, r as ResolvedModel, t as ModelLoader } from "../loader-D22zZME7.js";
2
2
  export { ModelLoader, ModelResolutionError, ResolvedModel, flattenLoaderModel, resolveTexture, salvageJson };
@@ -1,2 +1,2 @@
1
- import { a as salvageJson, i as resolveTexture, n as ModelResolutionError, r as flattenLoaderModel, t as ModelLoader } from "../loader-A-BZa8J4.js";
1
+ import { a as salvageJson, i as resolveTexture, n as ModelResolutionError, r as flattenLoaderModel, t as ModelLoader } from "../loader-B8NJO7pR.js";
2
2
  export { ModelLoader, ModelResolutionError, flattenLoaderModel, resolveTexture, salvageJson };
@@ -1,2 +1,2 @@
1
- import { i as prepareModResources, n as ModPreparation, r as PrepareModsOptions, t as LOADER_NAMESPACES } from "../prepare-DnnGGv9k.js";
1
+ import { i as prepareModResources, n as ModPreparation, r as PrepareModsOptions, t as LOADER_NAMESPACES } from "../prepare-CPxO0kKz.js";
2
2
  export { LOADER_NAMESPACES, ModPreparation, PrepareModsOptions, prepareModResources };
@@ -1,2 +1,2 @@
1
- import { n as prepareModResources, t as LOADER_NAMESPACES } from "../prepare-Bvc5ve2m.js";
1
+ import { n as prepareModResources, t as LOADER_NAMESPACES } from "../prepare-BESRrh6K.js";
2
2
  export { LOADER_NAMESPACES, prepareModResources };
@@ -1,5 +1,5 @@
1
- import { a as ResourceManager } from "../manager-CoZaeQTu.js";
2
- import { n as MapResourceManager } from "../synthetic-CDsj--li.js";
1
+ import { a as ResourceManager } from "../manager-Cv1NeFyF.js";
2
+ import { n as MapResourceManager } from "../synthetic-Qk-BSUXO.js";
3
3
  //#region src/mods/synthesize.d.ts
4
4
  interface SynthesisResult {
5
5
  models: MapResourceManager;
@@ -1,2 +1,2 @@
1
- import { t as synthesizeItemModels } from "../synthesize-CRgSEmEp.js";
1
+ import { t as synthesizeItemModels } from "../synthesize-3Q0aaOnK.js";
2
2
  export { synthesizeItemModels };
@@ -0,0 +1,28 @@
1
+ import { a as ResourceManager } from "../manager-Cv1NeFyF.js";
2
+ import { n as MapResourceManager } from "../synthetic-Qk-BSUXO.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 };
@@ -0,0 +1,2 @@
1
+ import { n as harvestTintOverrides, t as curatedTintOverrides } from "../tints-B8UJmZMu.js";
2
+ export { curatedTintOverrides, harvestTintOverrides };
@@ -1,2 +1,2 @@
1
- import { a as RasterAssetFormat, c as encodeRasterAsset, i as EncodedIcon, n as EncodeOptions, o as encodeAnimatedIcon, r as EncodedAnimatedIcon, s as encodeIcon, t as AnimatedEncodeOptions } from "../encode-C5kdAm45.js";
1
+ import { a as RasterAssetFormat, c as encodeRasterAsset, i as EncodedIcon, n as EncodeOptions, o as encodeAnimatedIcon, r as EncodedAnimatedIcon, s as encodeIcon, t as AnimatedEncodeOptions } from "../encode-DaNQF28M.js";
2
2
  export { AnimatedEncodeOptions, EncodeOptions, EncodedAnimatedIcon, EncodedIcon, RasterAssetFormat, encodeAnimatedIcon, encodeIcon, encodeRasterAsset };
@@ -1,2 +1,2 @@
1
- import { n as encodeIcon, r as encodeRasterAsset, t as encodeAnimatedIcon } from "../encode-3u49i-eD.js";
1
+ import { n as encodeIcon, r as encodeRasterAsset, t as encodeAnimatedIcon } from "../encode-D6dQu2dJ.js";
2
2
  export { encodeAnimatedIcon, encodeIcon, encodeRasterAsset };
@@ -1,2 +1,2 @@
1
- import { t as classifyItemStyle } from "../item-styles-DJ3LWZS2.js";
1
+ import { t as classifyItemStyle } from "../item-styles-upgEO1yP.js";
2
2
  export { classifyItemStyle };