@nodecraft/rendermite 1.0.7 → 1.1.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.
Files changed (171) hide show
  1. package/assets/README.md +6 -2
  2. package/assets/builtin/renderchest/models/item/trident.json +372 -0
  3. package/assets/builtin-legacy/renderchest/models/item/trident.json +372 -0
  4. package/assets/mod-models/README.md +130 -0
  5. package/assets/mod-models/ad_astra/models/item/tier_1_rocket.json +4559 -0
  6. package/assets/mod-models/ad_astra/models/item/tier_1_rover.json +6021 -0
  7. package/assets/mod-models/ad_astra/models/item/tier_2_rocket.json +6832 -0
  8. package/assets/mod-models/ad_astra/models/item/tier_3_rocket.json +8522 -0
  9. package/assets/mod-models/ad_astra/models/item/tier_4_rocket.json +7498 -0
  10. package/assets/mod-models/botania/models/item/avatar.json +574 -0
  11. package/assets/mod-models/botania/models/item/bellows.json +423 -0
  12. package/assets/mod-models/botania/models/item/brewery.json +894 -0
  13. package/assets/mod-models/botania/models/item/corporea_index.json +349 -0
  14. package/assets/mod-models/botania/models/item/gaia_pylon.json +1057 -0
  15. package/assets/mod-models/botania/models/item/hourglass.json +502 -0
  16. package/assets/mod-models/botania/models/item/mana_pylon.json +741 -0
  17. package/assets/mod-models/botania/models/item/natura_pylon.json +1057 -0
  18. package/assets/mod-models/botania/models/item/teru_teru_bozu.json +347 -0
  19. package/assets/mod-models/mekanism/models/item/atomic_disassembler.json +1391 -0
  20. package/assets/mod-models/mekanism/models/item/flamethrower.json +1926 -0
  21. package/assets/mod-models/mekanism/models/item/free_runners.json +595 -0
  22. package/assets/mod-models/mekanism/models/item/jetpack.json +1767 -0
  23. package/assets/mod-models/mekanism/models/item/scuba_mask.json +2305 -0
  24. package/assets/mod-models/mekanism/models/item/scuba_tank.json +833 -0
  25. package/assets/mod-tints/README.md +19 -0
  26. package/assets/mod-tints/mysticalagriculture/items/absorption_i_augment.json +16 -0
  27. package/assets/mod-tints/mysticalagriculture/items/absorption_ii_augment.json +16 -0
  28. package/assets/mod-tints/mysticalagriculture/items/absorption_iii_augment.json +16 -0
  29. package/assets/mod-tints/mysticalagriculture/items/absorption_iv_augment.json +16 -0
  30. package/assets/mod-tints/mysticalagriculture/items/absorption_v_augment.json +16 -0
  31. package/assets/mod-tints/mysticalagriculture/items/attack_aoe_i_augment.json +16 -0
  32. package/assets/mod-tints/mysticalagriculture/items/attack_aoe_ii_augment.json +16 -0
  33. package/assets/mod-tints/mysticalagriculture/items/attack_aoe_iii_augment.json +16 -0
  34. package/assets/mod-tints/mysticalagriculture/items/blindness_resistance_augment.json +16 -0
  35. package/assets/mod-tints/mysticalagriculture/items/fire_resistance_augment.json +16 -0
  36. package/assets/mod-tints/mysticalagriculture/items/flight_augment.json +16 -0
  37. package/assets/mod-tints/mysticalagriculture/items/haste_i_augment.json +16 -0
  38. package/assets/mod-tints/mysticalagriculture/items/haste_ii_augment.json +16 -0
  39. package/assets/mod-tints/mysticalagriculture/items/haste_iii_augment.json +16 -0
  40. package/assets/mod-tints/mysticalagriculture/items/health_boost_i_augment.json +16 -0
  41. package/assets/mod-tints/mysticalagriculture/items/health_boost_ii_augment.json +16 -0
  42. package/assets/mod-tints/mysticalagriculture/items/health_boost_iii_augment.json +16 -0
  43. package/assets/mod-tints/mysticalagriculture/items/health_boost_iv_augment.json +16 -0
  44. package/assets/mod-tints/mysticalagriculture/items/health_boost_v_augment.json +16 -0
  45. package/assets/mod-tints/mysticalagriculture/items/hunger_resistance_augment.json +16 -0
  46. package/assets/mod-tints/mysticalagriculture/items/jump_boost_i_augment.json +16 -0
  47. package/assets/mod-tints/mysticalagriculture/items/jump_boost_ii_augment.json +16 -0
  48. package/assets/mod-tints/mysticalagriculture/items/jump_boost_iii_augment.json +16 -0
  49. package/assets/mod-tints/mysticalagriculture/items/luck_i_augment.json +16 -0
  50. package/assets/mod-tints/mysticalagriculture/items/luck_ii_augment.json +16 -0
  51. package/assets/mod-tints/mysticalagriculture/items/luck_iii_augment.json +16 -0
  52. package/assets/mod-tints/mysticalagriculture/items/mining_aoe_i_augment.json +16 -0
  53. package/assets/mod-tints/mysticalagriculture/items/mining_aoe_ii_augment.json +16 -0
  54. package/assets/mod-tints/mysticalagriculture/items/mining_aoe_iii_augment.json +16 -0
  55. package/assets/mod-tints/mysticalagriculture/items/mining_aoe_iv_augment.json +16 -0
  56. package/assets/mod-tints/mysticalagriculture/items/mining_fatigue_resistance_augment.json +16 -0
  57. package/assets/mod-tints/mysticalagriculture/items/nausea_resistance_augment.json +16 -0
  58. package/assets/mod-tints/mysticalagriculture/items/night_vision_augment.json +16 -0
  59. package/assets/mod-tints/mysticalagriculture/items/pathing_aoe_i_augment.json +16 -0
  60. package/assets/mod-tints/mysticalagriculture/items/pathing_aoe_ii_augment.json +16 -0
  61. package/assets/mod-tints/mysticalagriculture/items/pathing_aoe_iii_augment.json +16 -0
  62. package/assets/mod-tints/mysticalagriculture/items/pathing_aoe_iv_augment.json +16 -0
  63. package/assets/mod-tints/mysticalagriculture/items/poison_resistance_augment.json +16 -0
  64. package/assets/mod-tints/mysticalagriculture/items/slow_falling_augment.json +16 -0
  65. package/assets/mod-tints/mysticalagriculture/items/slowness_resistance_augment.json +16 -0
  66. package/assets/mod-tints/mysticalagriculture/items/speed_i_augment.json +16 -0
  67. package/assets/mod-tints/mysticalagriculture/items/speed_ii_augment.json +16 -0
  68. package/assets/mod-tints/mysticalagriculture/items/speed_iii_augment.json +16 -0
  69. package/assets/mod-tints/mysticalagriculture/items/step_assist_augment.json +16 -0
  70. package/assets/mod-tints/mysticalagriculture/items/strength_i_augment.json +16 -0
  71. package/assets/mod-tints/mysticalagriculture/items/strength_ii_augment.json +16 -0
  72. package/assets/mod-tints/mysticalagriculture/items/strength_iii_augment.json +16 -0
  73. package/assets/mod-tints/mysticalagriculture/items/tilling_aoe_i_augment.json +16 -0
  74. package/assets/mod-tints/mysticalagriculture/items/tilling_aoe_ii_augment.json +16 -0
  75. package/assets/mod-tints/mysticalagriculture/items/tilling_aoe_iii_augment.json +16 -0
  76. package/assets/mod-tints/mysticalagriculture/items/tilling_aoe_iv_augment.json +16 -0
  77. package/assets/mod-tints/mysticalagriculture/items/water_breathing_augment.json +16 -0
  78. package/assets/mod-tints/mysticalagriculture/items/weakness_resistance_augment.json +16 -0
  79. package/assets/mod-tints/mysticalagriculture/items/wither_resistance_augment.json +16 -0
  80. package/dist/atlas/registry.js +1 -1
  81. package/dist/blend-8lnfxtLe.d.ts +79 -0
  82. package/dist/blend-KXMclcHk.js +199 -0
  83. package/dist/blockstate-CdstnW2-.js +104 -0
  84. package/dist/{builtin-caYjESh0.js → builtin-WkWjATeh.js} +5 -1
  85. package/dist/builtin.d.ts +3 -1
  86. package/dist/builtin.js +2 -2
  87. package/dist/cli.js +5 -3
  88. package/dist/{compose-lWPrB7wh.js → compose-BGsNFR12.js} +1 -1
  89. package/dist/{definition-3MBm8ar_.js → definition-ColsvWrH.js} +20 -1
  90. package/dist/{definition-BwX6Xxv0.d.ts → definition-ricL7Jqf.d.ts} +2 -0
  91. package/dist/{discovery-0SM0cTLw.js → discovery-B9aqV_Rz.js} +13 -3
  92. package/dist/{discovery-wiJBGryo.d.ts → discovery-BPSUtdm4.d.ts} +1 -1
  93. package/dist/{encode-CaSK8-mi.d.ts → encode-DNcXXvYe.d.ts} +1 -1
  94. package/dist/{encode-Df_tWzkl.js → encode-LR9wxigC.js} +1 -1
  95. package/dist/{entity-fallback-D9QTGU9X.js → entity-fallback-BnFMSHS6.js} +180 -10
  96. package/dist/{face-Cl1O4m2i.js → face-CMJ3b3Ae.js} +44 -18
  97. package/dist/face-cQ-pVHoe.d.ts +44 -0
  98. package/dist/{fluid-bucket-D-GpUQjg.js → fluid-bucket-BzoLofB_.js} +7 -2
  99. package/dist/{geo-DHiWBa-C.js → geo-w9HHIrb5.js} +87 -13
  100. package/dist/{geometry-uIDha8S4.js → geometry-Bi-Bf5rb.js} +7 -1
  101. package/dist/{geometry-BSVmKx5b.d.ts → geometry-w0yQbzDZ.d.ts} +5 -1
  102. package/dist/index.d.ts +9 -9
  103. package/dist/index.js +10 -10
  104. package/dist/items/blockstate.d.ts +23 -0
  105. package/dist/items/blockstate.js +2 -0
  106. package/dist/items/definition.d.ts +1 -1
  107. package/dist/items/definition.js +1 -1
  108. package/dist/items/discovery.d.ts +1 -1
  109. package/dist/items/discovery.js +1 -1
  110. package/dist/{loader-D22zZME7.d.ts → loader-DD83d80u.d.ts} +2 -1
  111. package/dist/{loader-B8NJO7pR.js → loader-DwkA9LR5.js} +267 -15
  112. package/dist/{loader-CfXMxcEV.js → loader-Lb0ZeILz.js} +19 -7
  113. package/dist/models/loader.d.ts +1 -1
  114. package/dist/models/loader.js +1 -1
  115. package/dist/models/types.d.ts +1 -1
  116. package/dist/models-BKxGkPS7.js +18 -0
  117. package/dist/mods/models.d.ts +5 -0
  118. package/dist/mods/models.js +2 -0
  119. package/dist/mods/prepare.d.ts +1 -1
  120. package/dist/mods/prepare.js +1 -1
  121. package/dist/mods/tints.js +1 -1
  122. package/dist/output/encode.d.ts +1 -1
  123. package/dist/output/encode.js +1 -1
  124. package/dist/{pipeline-HiA3DC71.d.ts → pipeline-Bp6amYz_.d.ts} +17 -5
  125. package/dist/{pipeline-Da2Kavba.js → pipeline-zu_ZjnNc.js} +85 -21
  126. package/dist/{prepare-BESRrh6K.js → prepare-D56Z-9cg.js} +7 -2
  127. package/dist/{prepare-CPxO0kKz.d.ts → prepare-Dce7-HAe.d.ts} +8 -0
  128. package/dist/{rasterizer-B9ZGJI3-.d.ts → rasterizer-BSQHEhJ-.d.ts} +4 -2
  129. package/dist/{rasterizer-76qO8TDh.js → rasterizer-DcVJzkxz.js} +13 -5
  130. package/dist/{registry-B9TcjVbs.js → registry-DS5PZ57l.js} +8 -1
  131. package/dist/render/blend.d.ts +2 -2
  132. package/dist/render/blend.js +2 -2
  133. package/dist/render/compose.d.ts +2 -2
  134. package/dist/render/compose.js +1 -1
  135. package/dist/render/entity-fallback.d.ts +19 -5
  136. package/dist/render/entity-fallback.js +2 -2
  137. package/dist/render/face.d.ts +2 -2
  138. package/dist/render/face.js +2 -2
  139. package/dist/render/fluid-bucket.js +1 -1
  140. package/dist/render/geo.d.ts +3 -3
  141. package/dist/render/geo.js +1 -1
  142. package/dist/render/geometry.d.ts +1 -1
  143. package/dist/render/geometry.js +1 -1
  144. package/dist/render/legacy-tints.d.ts +1 -1
  145. package/dist/render/obj.d.ts +5 -3
  146. package/dist/render/obj.js +1 -1
  147. package/dist/render/pipeline.d.ts +1 -1
  148. package/dist/render/pipeline.js +1 -1
  149. package/dist/render/rasterizer.d.ts +1 -1
  150. package/dist/render/rasterizer.js +1 -1
  151. package/dist/render/renderer.d.ts +1 -1
  152. package/dist/render/renderer.js +1 -1
  153. package/dist/render/tints.d.ts +1 -1
  154. package/dist/render/tints.js +1 -1
  155. package/dist/{renderer-B20ssjRm.d.ts → renderer-C79EQDSn.d.ts} +3 -3
  156. package/dist/{renderer-gQW_I7YG.js → renderer-oi1MSF3Y.js} +21 -10
  157. package/dist/{run-B0qPw3zf.js → run-D87zIGfr.js} +3 -3
  158. package/dist/{run-CT3VtFqg.d.ts → run-uq8_hUx9.d.ts} +1 -1
  159. package/dist/run.d.ts +2 -2
  160. package/dist/run.js +2 -2
  161. package/dist/textures/loader.js +1 -1
  162. package/dist/{tints-BtbHegpI.js → tints-3VI_2SNy.js} +107 -1
  163. package/dist/{tints-B8UJmZMu.js → tints-CebmvjmP.js} +2 -2
  164. package/dist/{tints-BH9l0ND0.d.ts → tints-Do9Sh3dg.d.ts} +2 -2
  165. package/dist/{types-COGbtA1t.d.ts → types-DpRSF9Vj.d.ts} +8 -0
  166. package/dist/workers/render-worker.d.ts +1 -1
  167. package/dist/workers/render-worker.js +1 -1
  168. package/package.json +1 -1
  169. package/dist/blend-CEHoJ7tM.d.ts +0 -37
  170. package/dist/blend-D0XWgVQr.js +0 -102
  171. package/dist/face-C49L66sQ.d.ts +0 -30
@@ -1,18 +1,19 @@
1
- import { a as defaultProperties } from "./definition-3MBm8ar_.js";
2
1
  import { n as ResourceLocator } from "./locator-ycZzh_6z.js";
3
2
  import { n as LayeredResourceManager, t as FolderResourceManager } from "./manager-CkletR5K.js";
4
- import { r as resolveItem } from "./discovery-0SM0cTLw.js";
5
- import { s as toFloatTexture, t as blendPixel } from "./blend-D0XWgVQr.js";
6
- import { t as encodeAnimatedIcon } from "./encode-Df_tWzkl.js";
3
+ import { a as defaultProperties } from "./definition-ColsvWrH.js";
4
+ import { r as resolveItem } from "./discovery-B9aqV_Rz.js";
5
+ import { l as toFloatTexture, t as blendPixel } from "./blend-KXMclcHk.js";
6
+ import { t as encodeAnimatedIcon } from "./encode-LR9wxigC.js";
7
7
  import { a as builtinDynamicResources } from "./generators-BlG4KmtP.js";
8
- import { t as ModelLoader } from "./loader-B8NJO7pR.js";
9
- import { a as renderModelFrames, i as renderModel, n as boxDownscale, r as pointResize } from "./renderer-gQW_I7YG.js";
10
- import { n as renderEntityFallback, r as spawnEggTints, t as renderDyedVariantFallback } from "./entity-fallback-D9QTGU9X.js";
11
- import { i as renderGeo, t as findGeoForItem } from "./geo-DHiWBa-C.js";
8
+ import { t as ModelLoader } from "./loader-DwkA9LR5.js";
9
+ import { a as renderModelFrames, i as renderModel, n as boxDownscale, r as pointResize } from "./renderer-oi1MSF3Y.js";
10
+ import { a as spawnEggTints, i as renderEntityFallback, n as dyedVariantTint, r as renderDyedVariantFallback, t as dyeVariantName } from "./entity-fallback-BnFMSHS6.js";
11
+ import { i as renderGeo, t as findGeoForItem } from "./geo-w9HHIrb5.js";
12
12
  import { t as legacyTintsForChain } from "./legacy-tints-B09J0Rxh.js";
13
- import { a as resolveTints } from "./tints-BtbHegpI.js";
14
- import { t as loadAtlasResolver } from "./registry-B9TcjVbs.js";
15
- import { n as TextureLoader } from "./loader-CfXMxcEV.js";
13
+ import { a as resolveTints } from "./tints-3VI_2SNy.js";
14
+ import { t as loadAtlasResolver } from "./registry-DS5PZ57l.js";
15
+ import { n as defaultBlockStateModel, t as blockStateTransform } from "./blockstate-CdstnW2-.js";
16
+ import { n as TextureLoader } from "./loader-Lb0ZeILz.js";
16
17
  import path from "node:path";
17
18
  import { mkdir, writeFile } from "node:fs/promises";
18
19
  //#region src/render/pipeline.ts
@@ -55,18 +56,68 @@ var ItemPipeline = class ItemPipeline {
55
56
  * pipeline's black-icon audit checked exactly this). A real sprite beats
56
57
  * no icon; the fallback is recorded so it is never a silent substitution.
57
58
  */
58
- async spriteFallback(id) {
59
+ /** Whether the game draws this item from an entity model rather than a sprite. */
60
+ async isEntityDrawn(id) {
61
+ try {
62
+ const [instruction] = await resolveItem(this.resources, id, defaultProperties());
63
+ if (!instruction) return false;
64
+ return (await this.models.load(instruction.model)).builtinParent === "builtin/entity";
65
+ } catch {
66
+ return false;
67
+ }
68
+ }
69
+ async spriteFallback(id, entityDrawn) {
59
70
  const { size, quality } = this.settings;
60
71
  const locator = ResourceLocator.parse(id);
72
+ const draw = (texture) => {
73
+ const upscaled = pointResize(toFloatTexture(texture), size * quality, size * quality);
74
+ return quality === 1 ? upscaled : boxDownscale(upscaled, quality);
75
+ };
61
76
  for (const directory of ["item", "items"]) {
62
77
  const texture = await this.textures.load(new ResourceLocator(locator.namespace, `${directory}/${locator.path}`));
63
- if (texture) {
64
- const upscaled = pointResize(toFloatTexture(texture), size * quality, size * quality);
65
- return quality === 1 ? upscaled : boxDownscale(upscaled, quality);
78
+ if (texture) return draw(texture);
79
+ }
80
+ if (entityDrawn) return null;
81
+ const leaf = locator.path.split("/").pop();
82
+ const candidates = await this.resources.listResources("texture", locator.namespace);
83
+ for (const prefix of [/^items?\//, /^blocks?\//]) {
84
+ let best = null;
85
+ for (const candidate of candidates) {
86
+ if (!prefix.test(candidate.path) || candidate.path.split("/").pop() !== leaf) continue;
87
+ if (best === null || candidate.path.length < best.path.length) best = candidate;
66
88
  }
89
+ const nested = best ? await this.textures.load(best) : null;
90
+ if (nested) return draw(nested);
67
91
  }
68
92
  return null;
69
93
  }
94
+ /**
95
+ * A blockstate-named block model, drawn the way a block-entity item renderer
96
+ * draws it. The renderer runs inside the *item's* display transform, which the
97
+ * block model does not carry — a block model that never chains to
98
+ * `minecraft:block/block` has no gui transform at all and would otherwise fill
99
+ * the frame flat-on (mekanism:block/fluid_tank).
100
+ */
101
+ async renderStatedBlock(stated, id) {
102
+ const { size, quality, lightingProfile } = this.settings;
103
+ const { resources, models, textures } = this;
104
+ const blockModel = await models.load(stated.model);
105
+ const itemDisplay = await resolveItem(resources, id, defaultProperties()).then(async ([instruction]) => {
106
+ if (!instruction) return null;
107
+ return (await models.load(instruction.model)).display;
108
+ }).catch(() => null);
109
+ const model = itemDisplay?.gui ? {
110
+ ...blockModel,
111
+ display: itemDisplay
112
+ } : blockModel;
113
+ return renderModel(model, textures, {
114
+ size,
115
+ quality,
116
+ lightingProfile,
117
+ resources,
118
+ itemTransform: blockStateTransform(stated)
119
+ });
120
+ }
70
121
  /** Render an item's frames from its own model, without any fallback. */
71
122
  async renderFrames(id) {
72
123
  const { size, quality, lightingProfile, animation } = this.settings;
@@ -75,9 +126,18 @@ var ItemPipeline = class ItemPipeline {
75
126
  let frames;
76
127
  let delaysMs;
77
128
  if (instructions.length === 1) {
78
- const model = await models.load(instructions[0].model);
129
+ const loaded = await models.load(instructions[0].model);
130
+ const model = instructions[0].fluid ? {
131
+ ...loaded,
132
+ fluid: instructions[0].fluid
133
+ } : loaded;
79
134
  let tints = instructions[0].tints.length > 0 ? await resolveTints(instructions[0].tints, { textures }) : await legacyTintsForChain(model.chain, textures);
80
135
  if (!tints && model.chain.some((entry) => entry.endsWith("item/template_spawn_egg"))) tints = await spawnEggTints(id, resources, textures).catch(() => null);
136
+ if (!tints) {
137
+ const dye = dyeVariantName(id);
138
+ const dyed = dye !== null && Object.values(model.textures).some((texture) => texture.includes(dye)) ? null : dyedVariantTint(id);
139
+ tints = dyed === null ? null : [dyed];
140
+ }
81
141
  tints ??= [];
82
142
  const result = await renderModelFrames(model, textures, {
83
143
  size,
@@ -118,9 +178,11 @@ var ItemPipeline = class ItemPipeline {
118
178
  };
119
179
  }
120
180
  /**
121
- * Frames for an item, falling back through the same-name block model,
122
- * GeckoLib geometry, builtin entity geometry, dyed variants, and finally the
123
- * flat sprite. Rethrows the item's own error when nothing draws it.
181
+ * Frames for an item that its own model cannot draw. The first step is not a
182
+ * guess: a BlockItem's blockstate names the model the game's own block-entity
183
+ * item renderers draw, so that is consulted before the same-name heuristic.
184
+ * After it come GeckoLib geometry, builtin entity geometry, dyed variants and
185
+ * finally the flat sprite. Rethrows the item's own error when nothing draws it.
124
186
  */
125
187
  async renderFramesWithFallback(id) {
126
188
  try {
@@ -131,8 +193,10 @@ var ItemPipeline = class ItemPipeline {
131
193
  } catch (err) {
132
194
  const { size, quality, lightingProfile, builtin } = this.settings;
133
195
  const { resources, models, textures } = this;
196
+ const stated = await defaultBlockStateModel(resources, id).catch(() => null);
197
+ const statedRender = stated ? await this.renderStatedBlock(stated, id).catch(() => null) : null;
134
198
  const blockLocator = ResourceLocator.parse(id);
135
- const blockRender = await models.load(new ResourceLocator(blockLocator.namespace, `block/${blockLocator.path}`)).then((model) => renderModel(model, textures, {
199
+ const blockRender = statedRender ?? await models.load(new ResourceLocator(blockLocator.namespace, `block/${blockLocator.path}`)).then((model) => renderModel(model, textures, {
136
200
  size,
137
201
  quality,
138
202
  lightingProfile,
@@ -162,7 +226,7 @@ var ItemPipeline = class ItemPipeline {
162
226
  delaysMs: [50],
163
227
  usedFallback: false
164
228
  };
165
- const sprite = await this.spriteFallback(id).catch(() => null);
229
+ const sprite = await this.spriteFallback(id, await this.isEntityDrawn(id)).catch(() => null);
166
230
  if (!sprite) throw err;
167
231
  return {
168
232
  frames: [sprite],
@@ -1,5 +1,6 @@
1
1
  import { n as LayeredResourceManager } from "./manager-CkletR5K.js";
2
- import { n as harvestTintOverrides, t as curatedTintOverrides } from "./tints-B8UJmZMu.js";
2
+ import { t as curatedModelOverrides } from "./models-BKxGkPS7.js";
3
+ import { n as harvestTintOverrides, t as curatedTintOverrides } from "./tints-CebmvjmP.js";
3
4
  import { n as UnsafeJarError, t as JarResourceManager } from "./jar-D9z-X7tA.js";
4
5
  import { t as synthesizeItemModels } from "./synthesize-3Q0aaOnK.js";
5
6
  //#region src/mods/prepare.ts
@@ -47,6 +48,7 @@ async function prepareModResources(options) {
47
48
  const base = new LayeredResourceManager([
48
49
  options.vanilla,
49
50
  curatedTintOverrides(),
51
+ curatedModelOverrides(),
50
52
  ...jarLayers
51
53
  ]);
52
54
  const namespaces = [];
@@ -89,7 +91,10 @@ async function prepareModResources(options) {
89
91
  namespaces,
90
92
  synthesized,
91
93
  tintOverrides,
92
- rejected
94
+ rejected,
95
+ close: async () => {
96
+ await Promise.all(jarLayers.map(async (jar) => jar.close().catch(() => {})));
97
+ }
93
98
  };
94
99
  }
95
100
  //#endregion
@@ -15,6 +15,14 @@ interface ModPreparation {
15
15
  jar: string;
16
16
  reason: string;
17
17
  }>;
18
+ /**
19
+ * Releases the jars this opened. Jars are opened with `autoClose: false` and
20
+ * keep both a file descriptor and an entry index per archive, so anything
21
+ * preparing many trees in one process (a corpus survey) must call this —
22
+ * without it the descriptors and indexes accumulate until the process dies.
23
+ * A single-tree caller can skip it and let exit clean up.
24
+ */
25
+ close(): Promise<void>;
18
26
  }
19
27
  interface PrepareModsOptions {
20
28
  jars: string[];
@@ -1,4 +1,4 @@
1
- import { t as FloatTexture } from "./blend-CEHoJ7tM.js";
1
+ import { n as FloatTexture, t as FaceShading } from "./blend-8lnfxtLe.js";
2
2
  //#region src/render/rasterizer.d.ts
3
3
  /** The rectangle of a buffer written since it was last cleared. */
4
4
  interface DirtyRect {
@@ -64,6 +64,8 @@ declare class RowCursor {
64
64
  }
65
65
  /** PHP round(): half away from zero, unlike Math.round's half toward +Infinity. */
66
66
  declare function phpRound(value: number): number;
67
- declare function drawTexturedTriangle(p1in: RasterPoint, p2in: RasterPoint, p3in: RasterPoint, buffer: FaceBuffer, texture: FloatTexture, cursor?: RowCursor): void;
67
+ declare function drawTexturedTriangle(p1in: RasterPoint, p2in: RasterPoint, p3in: RasterPoint, buffer: FaceBuffer, texture: FloatTexture, cursor?: RowCursor,
68
+ /** Applied per sample; null leaves the texel as-is. */
69
+ shading?: FaceShading | null): void;
68
70
  //#endregion
69
71
  export { clearFaceBuffer as a, drawTexturedTriangle as c, RowCursor as i, phpRound as l, FaceBuffer as n, compactFaceBuffer as o, RasterPoint as r, createFaceBuffer as s, DirtyRect as t };
@@ -1,4 +1,10 @@
1
+ import { o as shadeTexel } from "./blend-KXMclcHk.js";
1
2
  //#region src/render/rasterizer.ts
3
+ /**
4
+ * Faithful port of renderchest's TriangleRasterizer (scanline, nearest-neighbour
5
+ * sampling by truncation, 0.3 sub-texel start bias, 1px color overdraw with
6
+ * depth written only inside the span). See docs/research/renderchest-spec.md §4.4.
7
+ */
2
8
  function createFaceBuffer(width, height) {
3
9
  return {
4
10
  x: 0,
@@ -111,7 +117,7 @@ var RowCursor = class {
111
117
  function phpRound(value) {
112
118
  return value < 0 ? -Math.round(-value) : Math.round(value);
113
119
  }
114
- function drawTexturedTriangle(p1in, p2in, p3in, buffer, texture, cursor = new RowCursor()) {
120
+ function drawTexturedTriangle(p1in, p2in, p3in, buffer, texture, cursor = new RowCursor(), shading = null) {
115
121
  const { width, height } = buffer;
116
122
  const [p1, p2, p3] = [
117
123
  p1in,
@@ -185,10 +191,12 @@ function drawTexturedTriangle(p1in, p2in, p3in, buffer, texture, cursor = new Ro
185
191
  texY = texY < 0 ? 0 : texY >= texture.height ? texture.height - 1 : texY;
186
192
  const src = (texY * texture.width + texX) * 4;
187
193
  const dst = (rowOffset + x) * 4;
188
- buffer.colors[dst] = texture.data[src];
189
- buffer.colors[dst + 1] = texture.data[src + 1];
190
- buffer.colors[dst + 2] = texture.data[src + 2];
191
- buffer.colors[dst + 3] = texture.data[src + 3];
194
+ if (shading === null) {
195
+ buffer.colors[dst] = texture.data[src];
196
+ buffer.colors[dst + 1] = texture.data[src + 1];
197
+ buffer.colors[dst + 2] = texture.data[src + 2];
198
+ buffer.colors[dst + 3] = texture.data[src + 3];
199
+ } else shadeTexel(buffer.colors, dst, texture.data, src, shading, texX, texY);
192
200
  }
193
201
  if (x >= startX && x < endX && x >= 0 && x < width) {
194
202
  const clamped = currentDepth < 0 ? 0 : Math.min(currentDepth, 1);
@@ -33,7 +33,14 @@ var InferredItemTrimSource = class {
33
33
  const base = new ResourceLocator(locator.namespace, basePath);
34
34
  if (!await this.resources.hasResource("texture", base)) return null;
35
35
  const key = await this.firstTexture([new ResourceLocator(locator.namespace, "trims/color_palettes/trim_palette"), ResourceLocator.parse("minecraft:trims/color_palettes/trim_palette")]);
36
- const palette = await this.firstTexture([new ResourceLocator(locator.namespace, `trims/color_palettes/${variant}`), ResourceLocator.parse(`minecraft:trims/color_palettes/${variant}`)]);
36
+ const separator = variant.indexOf("-");
37
+ const namespaced = (await this.resources.listNamespaces()).filter((namespace) => variant.startsWith(`${namespace}_`)).map((namespace) => new ResourceLocator(namespace, `trims/color_palettes/${variant.slice(namespace.length + 1)}`));
38
+ const palette = await this.firstTexture([
39
+ new ResourceLocator(locator.namespace, `trims/color_palettes/${variant}`),
40
+ ResourceLocator.parse(`minecraft:trims/color_palettes/${variant}`),
41
+ ...separator > 0 ? [new ResourceLocator(variant.slice(0, separator), `trims/color_palettes/${variant.slice(separator + 1)}`)] : [],
42
+ ...namespaced
43
+ ]);
37
44
  if (!key || !palette) return null;
38
45
  return new PalettedPermutationsSource({
39
46
  textures: [base.toString()],
@@ -1,2 +1,2 @@
1
- import { a as q16, c as toFloatTexture, i as darkenTexture, n as blendPixel, o as tintTexture, r as cloneFloatTexture, s as toByteTexture, t as FloatTexture } from "../blend-CEHoJ7tM.js";
2
- export { FloatTexture, blendPixel, cloneFloatTexture, darkenTexture, q16, tintTexture, toByteTexture, toFloatTexture };
1
+ import { a as darkenTexture, c as shadeTexel, d as toFloatTexture, f as uvWindow, i as cloneFloatTexture, l as tintTexture, n as FloatTexture, o as q16, r as blendPixel, s as scaleTextureAlpha, t as FaceShading, u as toByteTexture } from "../blend-8lnfxtLe.js";
2
+ export { FaceShading, FloatTexture, blendPixel, cloneFloatTexture, darkenTexture, q16, scaleTextureAlpha, shadeTexel, tintTexture, toByteTexture, toFloatTexture, uvWindow };
@@ -1,2 +1,2 @@
1
- import { a as tintTexture, i as q16, n as cloneFloatTexture, o as toByteTexture, r as darkenTexture, s as toFloatTexture, t as blendPixel } from "../blend-D0XWgVQr.js";
2
- export { blendPixel, cloneFloatTexture, darkenTexture, q16, tintTexture, toByteTexture, toFloatTexture };
1
+ import { a as scaleTextureAlpha, c as toByteTexture, i as q16, l as toFloatTexture, n as cloneFloatTexture, o as shadeTexel, r as darkenTexture, s as tintTexture, t as blendPixel, u as uvWindow } from "../blend-KXMclcHk.js";
2
+ export { blendPixel, cloneFloatTexture, darkenTexture, q16, scaleTextureAlpha, shadeTexel, tintTexture, toByteTexture, toFloatTexture, uvWindow };
@@ -1,5 +1,5 @@
1
- import { t as FloatTexture } from "../blend-CEHoJ7tM.js";
2
- import { n as FaceBuffer } from "../rasterizer-B9ZGJI3-.js";
1
+ import { n as FloatTexture } from "../blend-8lnfxtLe.js";
2
+ import { n as FaceBuffer } from "../rasterizer-BSQHEhJ-.js";
3
3
  //#region src/render/compose.d.ts
4
4
  declare function combineFaceBuffers(width: number, height: number, faces: FaceBuffer[]): FloatTexture;
5
5
  //#endregion
@@ -1,2 +1,2 @@
1
- import { t as combineFaceBuffers } from "../compose-lWPrB7wh.js";
1
+ import { t as combineFaceBuffers } from "../compose-BGsNFR12.js";
2
2
  export { combineFaceBuffers };
@@ -1,10 +1,24 @@
1
1
  import { a as ResourceManager } from "../manager-Cv1NeFyF.js";
2
2
  import { i as TextureLoader } from "../loader-Myy22TDL.js";
3
- import { t as ModelLoader } from "../loader-D22zZME7.js";
4
- import { t as FloatTexture } from "../blend-CEHoJ7tM.js";
5
- import { r as TintColor } from "../face-C49L66sQ.js";
6
- import { i as RenderOptions } from "../renderer-B20ssjRm.js";
3
+ import { t as ModelLoader } from "../loader-DD83d80u.js";
4
+ import { n as FloatTexture } from "../blend-8lnfxtLe.js";
5
+ import { r as TintColor } from "../face-cQ-pVHoe.js";
6
+ import { i as RenderOptions } from "../renderer-C79EQDSn.js";
7
7
  //#region src/render/entity-fallback.d.ts
8
+ /** The dye name a `<dye>_<thing>` mod item is prefixed with, or null. */
9
+ declare function dyeVariantName(id: string): string | null;
10
+ /**
11
+ * The dye color a `<dye>_<thing>` item name implies, or null. Mods that name
12
+ * variants after dyes sometimes register the matching DyeColor as the tint in
13
+ * client code, where no asset states it (waystones' sharestones call
14
+ * `DyeColor.getTextColor()`), so the name is the only record of it left.
15
+ *
16
+ * Only ever right for variants that SHARE one uncoloured sprite. A mod that
17
+ * draws each colour its own texture is already the right colour, and tinting it
18
+ * again multiplies the dye in — chipped's blue_paper_lantern came out near
19
+ * black. Callers must check the model's textures; see `dyeVariantName`.
20
+ */
21
+ declare function dyedVariantTint(id: string): TintColor | null;
8
22
  /**
9
23
  * Dyed variants of vanilla items whose models mods generate at runtime (quark's
10
24
  * `black_frame_empty` parents a block model that exists nowhere on disk): render
@@ -27,4 +41,4 @@ declare function spawnEggTints(id: string, resources: ResourceManager, textures:
27
41
  */
28
42
  declare function renderEntityFallback(id: string, models: ModelLoader, textures: TextureLoader, resources: ResourceManager, options: RenderOptions): Promise<FloatTexture | null>;
29
43
  //#endregion
30
- export { renderDyedVariantFallback, renderEntityFallback, spawnEggTints };
44
+ export { dyeVariantName, dyedVariantTint, renderDyedVariantFallback, renderEntityFallback, spawnEggTints };
@@ -1,2 +1,2 @@
1
- import { n as renderEntityFallback, r as spawnEggTints, t as renderDyedVariantFallback } from "../entity-fallback-D9QTGU9X.js";
2
- export { renderDyedVariantFallback, renderEntityFallback, spawnEggTints };
1
+ import { a as spawnEggTints, i as renderEntityFallback, n as dyedVariantTint, r as renderDyedVariantFallback, t as dyeVariantName } from "../entity-fallback-BnFMSHS6.js";
2
+ export { dyeVariantName, dyedVariantTint, renderDyedVariantFallback, renderEntityFallback, spawnEggTints };
@@ -1,2 +1,2 @@
1
- import { a as renderFace, i as faceMaxZ, n as RenderableFace, r as TintColor, t as FaceShadeCache } from "../face-C49L66sQ.js";
2
- export { FaceShadeCache, RenderableFace, TintColor, faceMaxZ, renderFace };
1
+ import { a as faceMaxZ, i as createShadeCache, n as RenderableFace, o as renderFace, r as TintColor, t as FaceShadeCache } from "../face-cQ-pVHoe.js";
2
+ export { FaceShadeCache, RenderableFace, TintColor, createShadeCache, faceMaxZ, renderFace };
@@ -1,2 +1,2 @@
1
- import { n as renderFace, t as faceMaxZ } from "../face-Cl1O4m2i.js";
2
- export { faceMaxZ, renderFace };
1
+ import { n as faceMaxZ, r as renderFace, t as createShadeCache } from "../face-CMJ3b3Ae.js";
2
+ export { createShadeCache, faceMaxZ, renderFace };
@@ -1,2 +1,2 @@
1
- import { t as paintBucketFluid } from "../fluid-bucket-D-GpUQjg.js";
1
+ import { t as paintBucketFluid } from "../fluid-bucket-BzoLofB_.js";
2
2
  export { paintBucketFluid };
@@ -1,9 +1,9 @@
1
1
  import { n as ResourceLocator } from "../locator-jDbdUeTd.js";
2
2
  import { a as ResourceManager } from "../manager-Cv1NeFyF.js";
3
3
  import { i as TextureLoader } from "../loader-Myy22TDL.js";
4
- import { t as FloatTexture } from "../blend-CEHoJ7tM.js";
5
- import { n as FaceGeometry } from "../geometry-BSVmKx5b.js";
6
- import { i as RenderOptions } from "../renderer-B20ssjRm.js";
4
+ import { n as FloatTexture } from "../blend-8lnfxtLe.js";
5
+ import { n as FaceGeometry } from "../geometry-w0yQbzDZ.js";
6
+ import { i as RenderOptions } from "../renderer-C79EQDSn.js";
7
7
  //#region src/render/geo.d.ts
8
8
  interface GeoCube {
9
9
  origin?: number[];
@@ -1,2 +1,2 @@
1
- import { i as renderGeo, n as geoToFaces, r as parseGeo, t as findGeoForItem } from "../geo-DHiWBa-C.js";
1
+ import { i as renderGeo, n as geoToFaces, r as parseGeo, t as findGeoForItem } from "../geo-w9HHIrb5.js";
2
2
  export { findGeoForItem, geoToFaces, parseGeo, renderGeo };
@@ -1,2 +1,2 @@
1
- import { i as buildElementFaces, n as FaceGeometry, r as applyElementRotation, t as FACE_NORMALS } from "../geometry-BSVmKx5b.js";
1
+ import { i as buildElementFaces, n as FaceGeometry, r as applyElementRotation, t as FACE_NORMALS } from "../geometry-w0yQbzDZ.js";
2
2
  export { FACE_NORMALS, FaceGeometry, applyElementRotation, buildElementFaces };
@@ -1,2 +1,2 @@
1
- import { n as applyElementRotation, r as buildElementFaces, t as FACE_NORMALS } from "../geometry-uIDha8S4.js";
1
+ import { n as applyElementRotation, r as buildElementFaces, t as FACE_NORMALS } from "../geometry-Bi-Bf5rb.js";
2
2
  export { FACE_NORMALS, applyElementRotation, buildElementFaces };
@@ -1,5 +1,5 @@
1
1
  import { i as TextureLoader } from "../loader-Myy22TDL.js";
2
- import { r as TintColor } from "../face-C49L66sQ.js";
2
+ import { r as TintColor } from "../face-cQ-pVHoe.js";
3
3
  //#region src/render/legacy-tints.d.ts
4
4
  /**
5
5
  * Tints for a model rendered without an item definition (pre-1.21.4 eras and
@@ -1,14 +1,16 @@
1
1
  import { a as ResourceManager } from "../manager-Cv1NeFyF.js";
2
2
  import { i as TextureLoader } from "../loader-Myy22TDL.js";
3
- import { r as ResolvedModel } from "../loader-D22zZME7.js";
4
- import { t as FloatTexture } from "../blend-CEHoJ7tM.js";
3
+ import { r as ResolvedModel } from "../loader-DD83d80u.js";
4
+ import { n as FloatTexture } from "../blend-8lnfxtLe.js";
5
5
  import { n as Vec3 } from "../vector-DRKRi4--.js";
6
- import { i as RenderOptions } from "../renderer-B20ssjRm.js";
6
+ import { i as RenderOptions } from "../renderer-C79EQDSn.js";
7
7
  //#region src/render/obj.d.ts
8
8
  interface ObjTriangle {
9
9
  positions: [Vec3, Vec3, Vec3];
10
10
  uvs: [[number, number], [number, number], [number, number]];
11
11
  material: string;
12
+ /** The `o`/`g` name in effect, so a loader can draw one state of many. */
13
+ object: string;
12
14
  }
13
15
  interface ParsedObj {
14
16
  triangles: ObjTriangle[];
@@ -1,2 +1,2 @@
1
- import { c as renderObjModel, o as parseMtl, s as parseObj } from "../renderer-gQW_I7YG.js";
1
+ import { c as renderObjModel, o as parseMtl, s as parseObj } from "../renderer-oi1MSF3Y.js";
2
2
  export { parseMtl, parseObj, renderObjModel };
@@ -1,2 +1,2 @@
1
- import { i as RenderedFrames, n as ItemRenderOutcome, r as PipelineSettings, t as ItemPipeline } from "../pipeline-HiA3DC71.js";
1
+ import { i as RenderedFrames, n as ItemRenderOutcome, r as PipelineSettings, t as ItemPipeline } from "../pipeline-Bp6amYz_.js";
2
2
  export { ItemPipeline, ItemRenderOutcome, PipelineSettings, RenderedFrames };
@@ -1,2 +1,2 @@
1
- import { t as ItemPipeline } from "../pipeline-Da2Kavba.js";
1
+ import { t as ItemPipeline } from "../pipeline-zu_ZjnNc.js";
2
2
  export { ItemPipeline };
@@ -1,2 +1,2 @@
1
- import { a as clearFaceBuffer, c as drawTexturedTriangle, i as RowCursor, l as phpRound, n as FaceBuffer, o as compactFaceBuffer, r as RasterPoint, s as createFaceBuffer, t as DirtyRect } from "../rasterizer-B9ZGJI3-.js";
1
+ import { a as clearFaceBuffer, c as drawTexturedTriangle, i as RowCursor, l as phpRound, n as FaceBuffer, o as compactFaceBuffer, r as RasterPoint, s as createFaceBuffer, t as DirtyRect } from "../rasterizer-BSQHEhJ-.js";
2
2
  export { DirtyRect, FaceBuffer, RasterPoint, RowCursor, clearFaceBuffer, compactFaceBuffer, createFaceBuffer, drawTexturedTriangle, phpRound };
@@ -1,2 +1,2 @@
1
- import { a as drawTexturedTriangle, i as createFaceBuffer, n as clearFaceBuffer, o as phpRound, r as compactFaceBuffer, t as RowCursor } from "../rasterizer-76qO8TDh.js";
1
+ import { a as drawTexturedTriangle, i as createFaceBuffer, n as clearFaceBuffer, o as phpRound, r as compactFaceBuffer, t as RowCursor } from "../rasterizer-DcVJzkxz.js";
2
2
  export { RowCursor, clearFaceBuffer, compactFaceBuffer, createFaceBuffer, drawTexturedTriangle, phpRound };
@@ -1,2 +1,2 @@
1
- import { a as RenderedFrames, c as renderModel, i as RenderOptions, l as renderModelFrames, n as AnimationLimits, o as boxDownscale, r as ItemRenderError, s as pointResize, t as AnimationDiagnostics } from "../renderer-B20ssjRm.js";
1
+ import { a as RenderedFrames, c as renderModel, i as RenderOptions, l as renderModelFrames, n as AnimationLimits, o as boxDownscale, r as ItemRenderError, s as pointResize, t as AnimationDiagnostics } from "../renderer-C79EQDSn.js";
2
2
  export { AnimationDiagnostics, AnimationLimits, ItemRenderError, RenderOptions, RenderedFrames, boxDownscale, pointResize, renderModel, renderModelFrames };
@@ -1,2 +1,2 @@
1
- import { a as renderModelFrames, i as renderModel, n as boxDownscale, r as pointResize, t as ItemRenderError } from "../renderer-gQW_I7YG.js";
1
+ import { a as renderModelFrames, i as renderModel, n as boxDownscale, r as pointResize, t as ItemRenderError } from "../renderer-oi1MSF3Y.js";
2
2
  export { ItemRenderError, boxDownscale, pointResize, renderModel, renderModelFrames };
@@ -1,2 +1,2 @@
1
- import { a as resolveTint, i as parseTintValue, n as InvalidTinterDefinitionError, o as resolveTints, r as TintContext, t as DYE_COLORS } from "../tints-BH9l0ND0.js";
1
+ import { a as resolveTint, i as parseTintValue, n as InvalidTinterDefinitionError, o as resolveTints, r as TintContext, t as DYE_COLORS } from "../tints-Do9Sh3dg.js";
2
2
  export { DYE_COLORS, InvalidTinterDefinitionError, TintContext, parseTintValue, resolveTint, resolveTints };
@@ -1,2 +1,2 @@
1
- import { a as resolveTints, i as resolveTint, n as InvalidTinterDefinitionError, r as parseTintValue, t as DYE_COLORS } from "../tints-BtbHegpI.js";
1
+ import { a as resolveTints, i as resolveTint, n as InvalidTinterDefinitionError, r as parseTintValue, t as DYE_COLORS } from "../tints-3VI_2SNy.js";
2
2
  export { DYE_COLORS, InvalidTinterDefinitionError, parseTintValue, resolveTint, resolveTints };
@@ -1,10 +1,10 @@
1
1
  import { a as ResourceManager } from "./manager-Cv1NeFyF.js";
2
2
  import { i as TextureLoader } from "./loader-Myy22TDL.js";
3
- import { r as ResolvedModel } from "./loader-D22zZME7.js";
4
- import { t as FloatTexture } from "./blend-CEHoJ7tM.js";
3
+ import { r as ResolvedModel } from "./loader-DD83d80u.js";
4
+ import { n as FloatTexture } from "./blend-8lnfxtLe.js";
5
5
  import { t as Mat4 } from "./vector-DRKRi4--.js";
6
6
  import { a as LightingProfileName } from "./lighting-3FGRC3Af.js";
7
- import { r as TintColor } from "./face-C49L66sQ.js";
7
+ import { r as TintColor } from "./face-cQ-pVHoe.js";
8
8
  //#region src/render/renderer.d.ts
9
9
  interface AnimationLimits {
10
10
  /** Emitted frames per icon (default 128). */
@@ -1,13 +1,13 @@
1
- import { c as normalize, g as transformVector, m as sub, n as displayMatrix, o as identity, r as dot, s as multiply, t as cross } from "./vector-CCxLae_T.js";
2
1
  import { n as ResourceLocator } from "./locator-ycZzh_6z.js";
3
- import { a as tintTexture, n as cloneFloatTexture, r as darkenTexture, s as toFloatTexture, t as blendPixel } from "./blend-D0XWgVQr.js";
4
- import { t as combineFaceBuffers } from "./compose-lWPrB7wh.js";
5
- import { a as drawTexturedTriangle, i as createFaceBuffer, n as clearFaceBuffer, o as phpRound, t as RowCursor } from "./rasterizer-76qO8TDh.js";
6
- import { n as renderFace, t as faceMaxZ } from "./face-Cl1O4m2i.js";
7
- import { t as paintBucketFluid } from "./fluid-bucket-D-GpUQjg.js";
8
- import { r as buildElementFaces } from "./geometry-uIDha8S4.js";
2
+ import { c as normalize, g as transformVector, m as sub, n as displayMatrix, o as identity, r as dot, s as multiply, t as cross } from "./vector-CCxLae_T.js";
3
+ import { l as toFloatTexture, n as cloneFloatTexture, r as darkenTexture, s as tintTexture, t as blendPixel } from "./blend-KXMclcHk.js";
4
+ import { t as combineFaceBuffers } from "./compose-BGsNFR12.js";
5
+ import { a as drawTexturedTriangle, i as createFaceBuffer, n as clearFaceBuffer, o as phpRound, t as RowCursor } from "./rasterizer-DcVJzkxz.js";
6
+ import { n as faceMaxZ, r as renderFace, t as createShadeCache } from "./face-CMJ3b3Ae.js";
7
+ import { t as paintBucketFluid } from "./fluid-bucket-BzoLofB_.js";
8
+ import { r as buildElementFaces } from "./geometry-Bi-Bf5rb.js";
9
9
  import { c as lightsForProfile } from "./lighting--5myudVu.js";
10
- import { i as resolveTexture } from "./loader-B8NJO7pR.js";
10
+ import { i as resolveTexture } from "./loader-DwkA9LR5.js";
11
11
  //#region src/render/obj.ts
12
12
  /**
13
13
  * Forge/NeoForge OBJ model rendering — the class the old pipeline left
@@ -23,6 +23,7 @@ function parseObj(text, flipV) {
23
23
  const triangles = [];
24
24
  const materialLibs = [];
25
25
  let material = "";
26
+ let object = "";
26
27
  for (const rawLine of text.split("\n")) {
27
28
  const line = rawLine.trim();
28
29
  if (line === "" || line.startsWith("#")) continue;
@@ -44,6 +45,10 @@ function parseObj(text, flipV) {
44
45
  case "usemtl":
45
46
  material = parts.slice(1).join(" ");
46
47
  break;
48
+ case "o":
49
+ case "g":
50
+ object = parts.slice(1).join(" ");
51
+ break;
47
52
  case "mtllib":
48
53
  materialLibs.push(parts.slice(1).join(" "));
49
54
  break;
@@ -71,7 +76,8 @@ function parseObj(text, flipV) {
71
76
  corners[i - 1].uv,
72
77
  corners[i].uv
73
78
  ],
74
- material
79
+ material,
80
+ object
75
81
  });
76
82
  }
77
83
  break;
@@ -112,6 +118,11 @@ async function renderObjModel(model, resources, textures, options) {
112
118
  const objSource = await resources.getResource("raw", objLocator);
113
119
  if (!objSource) throw new ItemRenderError(`OBJ file not found: ${model.obj.model} for ${model.locator}`);
114
120
  const parsed = parseObj(objSource.toString("utf8"), model.obj.flipV);
121
+ const wanted = model.obj.objects;
122
+ if (wanted) {
123
+ const allowed = new Set(wanted);
124
+ parsed.triangles = parsed.triangles.filter((triangle) => allowed.has(triangle.object));
125
+ }
115
126
  if (parsed.triangles.length === 0) throw new ItemRenderError(`OBJ has no faces: ${model.obj.model}`);
116
127
  const materials = /* @__PURE__ */ new Map();
117
128
  const objDirectory = objLocator.path.split("/").slice(0, -1).join("/");
@@ -441,7 +452,7 @@ function createSession() {
441
452
  order: null,
442
453
  transformation: null,
443
454
  scratch: null,
444
- shadeCache: /* @__PURE__ */ new WeakMap(),
455
+ shadeCache: createShadeCache(),
445
456
  floatTextures: /* @__PURE__ */ new Map(),
446
457
  faceBuffers: []
447
458
  };
@@ -1,10 +1,10 @@
1
1
  import { n as ResourceLocator } from "./locator-ycZzh_6z.js";
2
- import { n as discoverItems } from "./discovery-0SM0cTLw.js";
3
- import { r as encodeRasterAsset } from "./encode-Df_tWzkl.js";
2
+ import { n as discoverItems } from "./discovery-B9aqV_Rz.js";
3
+ import { r as encodeRasterAsset } from "./encode-LR9wxigC.js";
4
4
  import { t as classifyItemStyle } from "./item-styles-upgEO1yP.js";
5
5
  import { t as minifyStylesheet } from "./minify-bjMRmr5J.js";
6
6
  import { t as generateStylesheet } from "./stylesheet-CovT3B2S.js";
7
- import { t as ItemPipeline } from "./pipeline-Da2Kavba.js";
7
+ import { t as ItemPipeline } from "./pipeline-zu_ZjnNc.js";
8
8
  import { t as describeResources } from "./descriptor-DWebtkI1.js";
9
9
  import { t as WorkerRenderPool } from "./pool-CKGp1qup.js";
10
10
  import path from "node:path";
@@ -1,6 +1,6 @@
1
1
  import { a as ResourceManager } from "./manager-Cv1NeFyF.js";
2
2
  import { a as LightingProfileName } from "./lighting-3FGRC3Af.js";
3
- import { n as AnimationLimits } from "./renderer-B20ssjRm.js";
3
+ import { n as AnimationLimits } from "./renderer-C79EQDSn.js";
4
4
  //#region src/run.d.ts
5
5
  interface RunOptions {
6
6
  resources: ResourceManager;
package/dist/run.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { l as evaluateItemModel } from "./definition-BwX6Xxv0.js";
2
- import { i as run, n as RunOptions, r as RunResult, t as ItemFailure } from "./run-CT3VtFqg.js";
1
+ import { l as evaluateItemModel } from "./definition-ricL7Jqf.js";
2
+ import { i as run, n as RunOptions, r as RunResult, t as ItemFailure } from "./run-uq8_hUx9.js";
3
3
  export { ItemFailure, RunOptions, RunResult, evaluateItemModel, run };
package/dist/run.js CHANGED
@@ -1,3 +1,3 @@
1
- import { o as evaluateItemModel } from "./definition-3MBm8ar_.js";
2
- import { t as run } from "./run-B0qPw3zf.js";
1
+ import { o as evaluateItemModel } from "./definition-ColsvWrH.js";
2
+ import { t as run } from "./run-D87zIGfr.js";
3
3
  export { evaluateItemModel, run };
@@ -1,2 +1,2 @@
1
- import { n as TextureLoader, r as TextureResolutionError, t as AnimatedTexture } from "../loader-CfXMxcEV.js";
1
+ import { n as TextureLoader, r as TextureResolutionError, t as AnimatedTexture } from "../loader-Lb0ZeILz.js";
2
2
  export { AnimatedTexture, TextureLoader, TextureResolutionError };