@nodecraft/rendermite 1.8.0 → 1.10.0

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 (168) hide show
  1. package/README.md +9 -1
  2. package/dist/atlas/registry.d.ts +3 -3
  3. package/dist/atlas/sources.d.ts +1 -1
  4. package/dist/{atlas-pack-C56gzqAg.d.ts → atlas-pack-BUadroKy.d.ts} +1 -1
  5. package/dist/biomes-BGOF6gRM.js +1100 -0
  6. package/dist/biomes-CnnhDCnk.d.ts +59 -0
  7. package/dist/{blend-C5UYzink.d.ts → blend-mJAeQB3C.d.ts} +1 -1
  8. package/dist/block-behaviour-BBslelpW.d.ts +673 -0
  9. package/dist/block-behaviour-DVjqeSkv.js +180 -0
  10. package/dist/block-overrides-XtxICunI.js +77 -0
  11. package/dist/blocks/atlas-pack.d.ts +1 -1
  12. package/dist/blocks/biomes.d.ts +2 -2
  13. package/dist/blocks/biomes.js +2 -2
  14. package/dist/blocks/block-behaviour.d.ts +2 -0
  15. package/dist/blocks/block-behaviour.js +2 -0
  16. package/dist/blocks/block-entities.d.ts +3 -3
  17. package/dist/blocks/block-overrides.d.ts +26 -0
  18. package/dist/blocks/block-overrides.js +2 -0
  19. package/dist/blocks/cli.js +1 -1
  20. package/dist/blocks/datapack.d.ts +2 -0
  21. package/dist/blocks/datapack.js +2 -0
  22. package/dist/blocks/ender-storage.d.ts +2 -2
  23. package/dist/blocks/entities.d.ts +3 -3
  24. package/dist/blocks/entity-geo.d.ts +1 -1
  25. package/dist/blocks/entity-models.d.ts +4 -13
  26. package/dist/blocks/entity-models.js +1 -1
  27. package/dist/blocks/entity-sizes.d.ts +25 -0
  28. package/dist/blocks/entity-sizes.js +2 -0
  29. package/dist/blocks/export.d.ts +1 -1
  30. package/dist/blocks/export.js +1 -1
  31. package/dist/blocks/game-rules.d.ts +2 -0
  32. package/dist/blocks/game-rules.js +2 -0
  33. package/dist/blocks/geo-blocks.d.ts +2 -2
  34. package/dist/blocks/item-sprites.d.ts +4 -4
  35. package/dist/blocks/light-bytecode.d.ts +2 -174
  36. package/dist/blocks/light-bytecode.js +1 -1
  37. package/dist/blocks/light-eval.d.ts +1 -1
  38. package/dist/blocks/light.d.ts +11 -1
  39. package/dist/blocks/light.js +1 -1
  40. package/dist/blocks/names.d.ts +2 -0
  41. package/dist/blocks/names.js +2 -0
  42. package/dist/blocks/obj-mesh.d.ts +1 -1
  43. package/dist/blocks/pack-format.d.ts +2 -2
  44. package/dist/blocks/sprite-sheet.d.ts +3 -3
  45. package/dist/blocks/states.d.ts +2 -0
  46. package/dist/blocks/states.js +2 -0
  47. package/dist/blocks/tints.d.ts +1 -1
  48. package/dist/{classfile-CiIDF3vc.js → classfile-BJSs3JH0.js} +23 -3
  49. package/dist/{classfile-CsLXlh5z.d.ts → classfile-Dzn0gW9M.d.ts} +6 -0
  50. package/dist/{cli-Dw1Q5CPR.js → cli-DwMPoX0I.js} +10 -5
  51. package/dist/cli.js +7 -7
  52. package/dist/datapack-CmEg0Vko.d.ts +15 -0
  53. package/dist/datapack-D6eH46ay.js +71 -0
  54. package/dist/{descriptor-CmkIkDKL.js → descriptor-Dz2cR-BH.js} +2 -2
  55. package/dist/{discovery-Cmir3QfC.d.ts → discovery-DWe_kX8W.d.ts} +1 -1
  56. package/dist/dynamic/generators.d.ts +1 -1
  57. package/dist/{encode-Br_vPrd8.d.ts → encode-BNEYHHR0.d.ts} +1 -1
  58. package/dist/entities/classfile.d.ts +1 -1
  59. package/dist/entities/classfile.js +1 -1
  60. package/dist/entities/geo-model.d.ts +1 -1
  61. package/dist/entities/inherit.d.ts +2 -2
  62. package/dist/entities/inherit.js +1 -1
  63. package/dist/entities/jar-classes.js +1 -1
  64. package/dist/entities/link.d.ts +2 -2
  65. package/dist/entities/link.js +1 -1
  66. package/dist/entities/mappings.d.ts +1 -1
  67. package/dist/entities/mappings.js +1 -1
  68. package/dist/entities/model-bytecode.d.ts +1 -1
  69. package/dist/entities/model-bytecode.js +1 -1
  70. package/dist/entities/model-code.d.ts +1 -1
  71. package/dist/entities/model-code.js +1 -1
  72. package/dist/{entity-models-BGiy3pey.js → entity-models-vFl_EwfA.js} +24 -5
  73. package/dist/entity-sizes-DspxgSUA.js +194 -0
  74. package/dist/{export-t8X_oRws.js → export-ArMmWuCC.js} +62 -5
  75. package/dist/{export-J13L9Lqu.d.ts → export-CqeTinYL.d.ts} +19 -2
  76. package/dist/{face-DqEd9G_U.d.ts → face-uWXECGNr.d.ts} +2 -2
  77. package/dist/game-rules-BDPTopVW.js +104 -0
  78. package/dist/game-rules-ThvdDG3B.d.ts +16 -0
  79. package/dist/{generators-BnIzAftW.d.ts → generators-hu_vk10m.d.ts} +1 -1
  80. package/dist/{geo-C9QYeLVN.d.ts → geo-DsWwuC5o.d.ts} +4 -4
  81. package/dist/index.d.ts +20 -20
  82. package/dist/index.js +8 -8
  83. package/dist/{inherit-BUn0Cve9.js → inherit-DJ45bOB_.js} +2 -2
  84. package/dist/items/blockstate.d.ts +1 -1
  85. package/dist/items/discovery.d.ts +1 -1
  86. package/dist/{jar-B5iRZQeL.d.ts → jar-4Jg7ufWK.d.ts} +1 -1
  87. package/dist/{jar-CBYPMbw7.js → jar-DvofBm71.js} +2 -2
  88. package/dist/{jar-classes-CSm7qq1R.js → jar-classes-0wqWbTax.js} +2 -2
  89. package/dist/{light-CyRhYulM.js → light-CZRA1pOj.js} +48 -6
  90. package/dist/{light-bytecode-Cpyuxo9b.js → light-bytecode-BqpQWqP7.js} +144 -46
  91. package/dist/{light-eval-D9x0ufZx.d.ts → light-eval-C0-kt0bp.d.ts} +1 -1
  92. package/dist/{link-Cuhyrz07.js → link-IDjVJ2Ij.js} +1 -1
  93. package/dist/{loader-DSir1-P0.d.ts → loader-BYyPIs9f.d.ts} +1 -1
  94. package/dist/{loader-59_eMa8e.d.ts → loader-C4gsX_wO.d.ts} +1 -1
  95. package/dist/{manager-exOIcdyx.d.ts → manager-Ct0dEOMg.d.ts} +6 -0
  96. package/dist/{manager-BNibYkmI.js → manager-D6zXmFrO.js} +6 -0
  97. package/dist/{mappings-Ep6ko0rg.js → mappings-DEl_7xxQ.js} +18 -1
  98. package/dist/{mappings-USwcjtcH.d.ts → mappings-DhOPQTgV.d.ts} +5 -0
  99. package/dist/{model-bytecode-VaLUQfGO.js → model-bytecode-CXYAZ5dX.js} +1 -1
  100. package/dist/{model-code-Csc3bs3h.d.ts → model-code-BclYt1do.d.ts} +1 -1
  101. package/dist/{model-code-DbN2uVhp.js → model-code-BmA5ilgt.js} +1 -1
  102. package/dist/models/loader.d.ts +1 -1
  103. package/dist/{models-CZjCOjs4.js → models-BsYA-NZg.js} +1 -1
  104. package/dist/mods/models.d.ts +1 -1
  105. package/dist/mods/models.js +1 -1
  106. package/dist/mods/prepare.d.ts +1 -1
  107. package/dist/mods/prepare.js +1 -1
  108. package/dist/mods/synthesize.d.ts +2 -2
  109. package/dist/mods/tints.d.ts +2 -2
  110. package/dist/mods/tints.js +1 -1
  111. package/dist/names-D1abAVIB.d.ts +10 -0
  112. package/dist/names-GLa5TyL7.js +36 -0
  113. package/dist/{obj-mesh-ydhVfLKs.d.ts → obj-mesh-CzL0lOlJ.d.ts} +2 -2
  114. package/dist/output/encode.d.ts +1 -1
  115. package/dist/pack.d.ts +7 -6
  116. package/dist/{pipeline-DFuQa8ZT.d.ts → pipeline-DuPF3sap.d.ts} +3 -3
  117. package/dist/{pipeline-CRTQGba7.js → pipeline-Q_185kY6.js} +1 -1
  118. package/dist/{prepare-OS7wL3jv.d.ts → prepare-BPzsZI_S.d.ts} +1 -1
  119. package/dist/{prepare-6pH3CNpg.d.ts → prepare-Ce5SpR7Y.d.ts} +1 -1
  120. package/dist/{prepare-C61BcwFA.js → prepare-DkJkZXuQ.js} +2 -2
  121. package/dist/{prepare-DxPEu9mo.js → prepare-sj36BP90.js} +4 -4
  122. package/dist/{rasterizer-C2wgJZ6J.d.ts → rasterizer-DjnurUgD.d.ts} +1 -1
  123. package/dist/render/blend.d.ts +1 -1
  124. package/dist/render/compose.d.ts +2 -2
  125. package/dist/render/entity-fallback.d.ts +6 -6
  126. package/dist/render/face.d.ts +1 -1
  127. package/dist/render/fluid-bucket.d.ts +2 -2
  128. package/dist/render/geo.d.ts +1 -1
  129. package/dist/render/legacy-tints.d.ts +2 -2
  130. package/dist/render/obj.d.ts +5 -5
  131. package/dist/render/pipeline.d.ts +1 -1
  132. package/dist/render/pipeline.js +1 -1
  133. package/dist/render/rasterizer.d.ts +1 -1
  134. package/dist/render/renderer.d.ts +1 -1
  135. package/dist/render/tints.d.ts +1 -1
  136. package/dist/{renderer-DbUmTFDb.d.ts → renderer-QgROYvPv.d.ts} +5 -5
  137. package/dist/resources/descriptor.d.ts +1 -1
  138. package/dist/resources/descriptor.js +1 -1
  139. package/dist/resources/entity-textures.d.ts +2 -2
  140. package/dist/resources/jar.d.ts +1 -1
  141. package/dist/resources/jar.js +1 -1
  142. package/dist/resources/manager.d.ts +1 -1
  143. package/dist/resources/manager.js +1 -1
  144. package/dist/resources/synthetic.d.ts +1 -1
  145. package/dist/resources/zip-reader.js +1 -1
  146. package/dist/{run-DYcem_Vv.js → run-5yX5KRiI.js} +4 -4
  147. package/dist/{run-CLjF0N2d.d.ts → run-CxB1qabg.d.ts} +2 -2
  148. package/dist/run.d.ts +1 -1
  149. package/dist/run.js +1 -1
  150. package/dist/{sources-e5D09Jz_.d.ts → sources-sFtealLJ.d.ts} +1 -1
  151. package/dist/states-BvoZA-ql.js +40 -0
  152. package/dist/states-OzneeCTU.d.ts +25 -0
  153. package/dist/{synthetic-B3R7mW9k.d.ts → synthetic-CWtFtAkR.d.ts} +1 -1
  154. package/dist/textures/loader.d.ts +1 -1
  155. package/dist/textures/overlay.d.ts +1 -1
  156. package/dist/{tints-uLl1CIkC.d.ts → tints-B0a1K11c.d.ts} +2 -2
  157. package/dist/{tints-CWQz6UkM.js → tints-CZeyKzMv.js} +2 -2
  158. package/dist/{tints-CQX8a1F0.d.ts → tints-DwFmEkf3.d.ts} +2 -2
  159. package/dist/versions/legacy-reshape.d.ts +1 -1
  160. package/dist/versions/prepare.d.ts +1 -1
  161. package/dist/versions/prepare.js +1 -1
  162. package/dist/workers/render-worker.d.ts +2 -2
  163. package/dist/workers/render-worker.js +2 -2
  164. package/dist/{zip-reader-zx3kdSq4.js → zip-reader-onwEVMea.js} +4 -4
  165. package/package.json +1 -1
  166. package/dist/biomes-5ZwYxMYe.js +0 -384
  167. package/dist/biomes-CJDJQqJb.d.ts +0 -38
  168. package/dist/pack-format-BqWf-DNc.d.ts +0 -350
@@ -1,6 +1,6 @@
1
1
  import { n as ResourceLocator } from "./locator-COMEtEn9.js";
2
- import { r as ResourceKind } from "./manager-BNibYkmI.js";
3
- import { t as openZip } from "./zip-reader-zx3kdSq4.js";
2
+ import { r as ResourceKind } from "./manager-D6zXmFrO.js";
3
+ import { t as openZip } from "./zip-reader-onwEVMea.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
@@ -1,5 +1,5 @@
1
- import { t as openZip } from "./zip-reader-zx3kdSq4.js";
2
- import { n as UnsafeJarError, r as isUnsafeEntryPath } from "./jar-CBYPMbw7.js";
1
+ import { t as openZip } from "./zip-reader-onwEVMea.js";
2
+ import { n as UnsafeJarError, r as isUnsafeEntryPath } from "./jar-DvofBm71.js";
3
3
  //#region src/entities/jar-classes.ts
4
4
  /**
5
5
  * Reading `.class` entries out of a jar.
@@ -1,7 +1,9 @@
1
- import { t as parseClassFile } from "./classfile-CiIDF3vc.js";
2
- import { c as resolveMappings, s as remapDescriptor, t as MappingsUnavailableError } from "./mappings-Ep6ko0rg.js";
3
- import { t as extractBlockLight } from "./light-bytecode-Cpyuxo9b.js";
4
- import { r as compareVersions } from "./prepare-C61BcwFA.js";
1
+ import { r as compareVersions } from "./prepare-DkJkZXuQ.js";
2
+ import { t as parseClassFile } from "./classfile-BJSs3JH0.js";
3
+ import { c as resolveMappings, s as remapDescriptor, t as MappingsUnavailableError } from "./mappings-DEl_7xxQ.js";
4
+ import { t as blockBehaviour } from "./block-behaviour-DVjqeSkv.js";
5
+ import { i as overrideOf, n as constantFluidOf, t as alwaysInvisible } from "./block-overrides-XtxICunI.js";
6
+ import { t as extractBlockLight } from "./light-bytecode-BqpQWqP7.js";
5
7
  //#region src/blocks/light.ts
6
8
  /**
7
9
  * Block light emission for the exported pack: `light.json`.
@@ -188,7 +190,7 @@ function findLightGetters(roots, propsClasses, resolve, notes) {
188
190
  return getters;
189
191
  }
190
192
  /** Reference renaming through the mappings: a mod's original names onto an obfuscated client's. */
191
- function remapper(mappings) {
193
+ function remapper(mappings, superOf = () => null) {
192
194
  const remapClass = (internalName) => {
193
195
  const mapped = mappings.obfuscatedOf.get(internalName.replaceAll("/", "."));
194
196
  return mapped ? mapped.replaceAll(".", "/") : internalName;
@@ -204,9 +206,20 @@ function remapper(mappings) {
204
206
  descriptor: remapDescriptor(reference.descriptor, mappings.obfuscatedOf)
205
207
  };
206
208
  };
209
+ const nameOf = (reference, field) => {
210
+ let owner = reference.owner;
211
+ for (let hops = 0; owner && hops < 8; hops++) {
212
+ const dotted = owner.replaceAll("/", ".");
213
+ const found = mappings.nameOf?.get(field ? `${dotted}.${reference.name}` : `${dotted}.${reference.name}${reference.descriptor}`);
214
+ if (found) return found;
215
+ owner = superOf(owner);
216
+ }
217
+ return reference.name;
218
+ };
207
219
  return {
208
220
  remap,
209
- remapClass
221
+ remapClass,
222
+ nameOf
210
223
  };
211
224
  }
212
225
  async function collectBlockLight(options) {
@@ -228,6 +241,7 @@ async function collectBlockLight(options) {
228
241
  notes.push(err.message);
229
242
  }
230
243
  const { remap, remapClass } = remapper(mappings);
244
+ const isClearJar = names.some((name) => name.replaceAll(".", "/") === "net/minecraft/world/level/block/Blocks");
231
245
  const bytes = /* @__PURE__ */ new Map();
232
246
  for (const name of names) {
233
247
  const read = await classes.read(name);
@@ -248,6 +262,7 @@ async function collectBlockLight(options) {
248
262
  }
249
263
  return parsed.get(internal) ?? null;
250
264
  };
265
+ const { nameOf } = remapper(mappings, (name) => resolve(name)?.superClass ?? null);
251
266
  const wanted = /* @__PURE__ */ new Set();
252
267
  for (const id of blockIds) {
253
268
  wanted.add(id);
@@ -275,7 +290,9 @@ async function collectBlockLight(options) {
275
290
  });
276
291
  return {
277
292
  light: {},
293
+ behaviour: {},
278
294
  failures,
295
+ behaviourFailures: [],
279
296
  notes
280
297
  };
281
298
  }
@@ -284,6 +301,7 @@ async function collectBlockLight(options) {
284
301
  resolve,
285
302
  remap,
286
303
  remapClass,
304
+ nameOf,
287
305
  propsClasses,
288
306
  lightGetters: findLightGetters(roots, propsClasses, resolve, notes),
289
307
  isVanillaClass: (name) => mappings.originalOf.size === 0 || mappings.originalOf.has(name.replaceAll("/", ".")) || name.startsWith("net/minecraft/") || name.startsWith("com/mojang/")
@@ -315,9 +333,33 @@ async function collectBlockLight(options) {
315
333
  }
316
334
  }
317
335
  }
336
+ const behaviour = {};
337
+ const behaviourFailures = [];
338
+ if (mappings.originalOf.size > 0 || isClearJar) for (const id of blockIds) {
339
+ const registration = NOT_BLOCKS.has(id) ? null : extraction.registrationOf(id);
340
+ const blockType = registration?.blockType ?? registration?.block?.type ?? null;
341
+ const overrides = {
342
+ resolve,
343
+ nameOf
344
+ };
345
+ const read = registration ? blockBehaviour(registration, extraction, {
346
+ of: (names) => blockType ? overrideOf(overrides, blockType, names) : null,
347
+ fluid: (method) => constantFluidOf(overrides, method),
348
+ invisible: (method) => alwaysInvisible(overrides, method)
349
+ }) : null;
350
+ if (read) {
351
+ behaviour[id] = read.behaviour;
352
+ for (const reason of read.failures) behaviourFailures.push({
353
+ id,
354
+ reason
355
+ });
356
+ }
357
+ }
318
358
  return {
319
359
  light,
360
+ behaviour,
320
361
  failures,
362
+ behaviourFailures,
321
363
  notes
322
364
  };
323
365
  }
@@ -1,4 +1,6 @@
1
- import { r as parseDescriptor } from "./model-bytecode-VaLUQfGO.js";
1
+ import { r as parseDescriptor } from "./model-bytecode-CXYAZ5dX.js";
2
+ import { n as instructions } from "./entity-sizes-DspxgSUA.js";
3
+ import { n as statedMapColor } from "./block-behaviour-DVjqeSkv.js";
2
4
  //#region src/blocks/light-bytecode.ts
3
5
  /**
4
6
  * Block light emission, read out of the code that registers blocks.
@@ -294,6 +296,7 @@ var Interpreter = class Interpreter {
294
296
  if (sources.length > 0) {
295
297
  const from = sources[0].handle;
296
298
  created.light = from.isProps ? from.light : from.props?.light ?? null;
299
+ created.copyOf = from.isProps ? from : from.props;
297
300
  } else if (inputs.some((value) => value.kind === "unknown" || value.kind === "null")) created.light = {
298
301
  kind: "opaque",
299
302
  reason: "properties copied from a block the interpreter could not identify"
@@ -424,6 +427,25 @@ var Interpreter = class Interpreter {
424
427
  const parent = this.shared.source.resolve(handle.type)?.superClass ?? null;
425
428
  return parent === "java/lang/Enum" || parent !== null && this.shared.source.resolve(parent)?.superClass === "java/lang/Enum";
426
429
  }
430
+ /**
431
+ * The class a factory lambda constructs, read off its body rather than run: `props -> new
432
+ * StairBlock(base, props)` builds a `StairBlock`. What a stair overrides lives on that class.
433
+ */
434
+ constructedIn(lambda) {
435
+ const reference = this.shared.source.remap({
436
+ owner: lambda.owner,
437
+ name: lambda.name,
438
+ descriptor: lambda.descriptor
439
+ }, false);
440
+ const target = findMethod(this.shared.source, reference.owner, reference.name, reference.descriptor);
441
+ if (!target) return null;
442
+ for (const { op, index } of instructions(target.code)) {
443
+ if (op !== 187) continue;
444
+ const name = target.classFile.utf8(index);
445
+ if (!name.startsWith("java/") && !this.isPropsType(name)) return this.shared.source.remapClass(name);
446
+ }
447
+ return null;
448
+ }
427
449
  detectRegistration(args, site) {
428
450
  const names = [];
429
451
  for (const arg of args) if (arg.kind === "string") names.push(arg.value);
@@ -439,8 +461,9 @@ var Interpreter = class Interpreter {
439
461
  let block = null;
440
462
  let blockType = null;
441
463
  for (const arg of args) if (arg.kind === "object" && arg.handle.isProps) props ??= arg.handle;
442
- else if (arg.kind === "object" && arg.handle.props) block ??= arg.handle;
464
+ else if (arg.kind === "object" && arg.handle.props && !this.shared.registeredBlocks.has(arg.handle)) block ??= arg.handle;
443
465
  else if (arg.kind === "lambda" && arg.name === "<init>") blockType ??= this.shared.source.remapClass(arg.owner);
466
+ else if (arg.kind === "lambda") blockType ??= this.constructedIn(arg);
444
467
  if (!props && !block) for (const arg of args) {
445
468
  if (arg.kind !== "lambda") continue;
446
469
  const made = this.invokeLambda(arg, []);
@@ -458,7 +481,9 @@ var Interpreter = class Interpreter {
458
481
  vanilla: this.caller !== null && this.shared.source.isVanillaClass(this.caller)
459
482
  };
460
483
  for (const name of ids) if (!this.shared.registrations.has(name)) this.shared.registrations.set(name, registration);
461
- return block ?? this.blockFor(registration);
484
+ const registered = block ?? this.blockFor(registration);
485
+ this.shared.registeredBlocks.add(registered);
486
+ return registered;
462
487
  }
463
488
  /**
464
489
  * The block a registration stands for, when the call was handed properties and a factory rather than
@@ -848,6 +873,14 @@ var Interpreter = class Interpreter {
848
873
  }
849
874
  if (receiver?.kind === "object") {
850
875
  const target = receiver.handle;
876
+ const named = source.nameOf?.(reference, false) ?? remapped.name;
877
+ if (target.props && args.length === 0 && (named === "defaultMapColor" || named === "defaultMaterialColor")) {
878
+ const colour = statedMapColor(target.props);
879
+ if (colour && colour.kind !== "lambda") {
880
+ this.push(colour);
881
+ return;
882
+ }
883
+ }
851
884
  const getter = source.lightGetters.find((candidate) => matchesGetter(candidate, remapped.name, remapped.descriptor));
852
885
  if (getter && target.props && args[0]?.kind === "state") {
853
886
  const found = findGetter(source, target.type ?? remapped.owner, getter);
@@ -892,6 +925,12 @@ var Interpreter = class Interpreter {
892
925
  return;
893
926
  }
894
927
  if (returns.startsWith("L") && this.isPropsType(returns.slice(1, -1))) {
928
+ const name = source.nameOf?.(reference, false) ?? remapped.name;
929
+ (target.calls ??= []).push({
930
+ name: name === reference.name ? remapped.name : name,
931
+ descriptor: remapped.descriptor,
932
+ args
933
+ });
895
934
  this.push(receiver);
896
935
  return;
897
936
  }
@@ -1407,6 +1446,8 @@ var Interpreter = class Interpreter {
1407
1446
  const reference = constants.reference(index);
1408
1447
  if (target.kind === "object" && reference) {
1409
1448
  target.handle.fields.set(reference.name, value);
1449
+ const mapped = this.shared.source.nameOf?.(reference, true) ?? reference.name;
1450
+ if (mapped !== reference.name) target.handle.fields.set(`mapped:${mapped}`, value);
1410
1451
  if (value.kind === "object" && value.handle.isProps) target.handle.props = value.handle;
1411
1452
  }
1412
1453
  break;
@@ -1547,6 +1588,42 @@ var Interpreter = class Interpreter {
1547
1588
  this.note(`${classFile.thisClass}: ${err.message}`);
1548
1589
  }
1549
1590
  }
1591
+ /** Runs a function of a block state against one state; null where the interpreter lost the value. */
1592
+ evaluateLambda(fn, probe) {
1593
+ this.shared.probe = probe;
1594
+ this.shared.steps = STEP_BUDGET;
1595
+ this.shared.frames = FRAME_BUDGET;
1596
+ try {
1597
+ const result = this.invokeLambda(fn, [{
1598
+ kind: "state",
1599
+ probe
1600
+ }]);
1601
+ return probe.failure ? null : result;
1602
+ } finally {
1603
+ this.shared.probe = null;
1604
+ }
1605
+ }
1606
+ /**
1607
+ * Runs a block class's own method of a state (`getLightValue(state)`, `useShapeForLightOcclusion(state)`)
1608
+ * on the block, the state first and anything after it unknown; null where the interpreter lost it.
1609
+ */
1610
+ evaluateMethod(owner, name, descriptor, receiver, probe, typedArguments = false) {
1611
+ const method = findMethod(this.shared.source, owner, name, descriptor);
1612
+ if (!method) return null;
1613
+ const self = {
1614
+ kind: "object",
1615
+ handle: receiver ?? this.handle(owner)
1616
+ };
1617
+ const rest = parseDescriptor(descriptor).args.slice(1).map((shape) => typedArguments && shape.startsWith("L") ? {
1618
+ kind: "object",
1619
+ handle: this.handle(shape.slice(1, -1))
1620
+ } : UNKNOWN);
1621
+ const inlined = this.inline(method.classFile.thisClass, name, descriptor, self, [{
1622
+ kind: "state",
1623
+ probe
1624
+ }, ...rest]);
1625
+ return inlined.ok ? inlined.value : null;
1626
+ }
1550
1627
  /** Evaluates a light spec against one state; null where the interpreter lost the value. */
1551
1628
  evaluate(spec, probe) {
1552
1629
  this.shared.probe = probe;
@@ -1559,20 +1636,8 @@ var Interpreter = class Interpreter {
1559
1636
  };
1560
1637
  let result;
1561
1638
  if (spec.kind === "function") result = this.invokeLambda(spec.fn, [state]);
1562
- else if (spec.kind === "method") {
1563
- const method = findMethod(this.shared.source, spec.owner, spec.getter.name, spec.getter.descriptor);
1564
- if (!method) return null;
1565
- const receiver = spec.receiver ? {
1566
- kind: "object",
1567
- handle: spec.receiver
1568
- } : {
1569
- kind: "object",
1570
- handle: this.handle(spec.owner)
1571
- };
1572
- const extra = parseDescriptor(spec.getter.descriptor).args.length - 1;
1573
- const inlined = this.inline(method.classFile.thisClass, spec.getter.name, spec.getter.descriptor, receiver, [state, ...Array.from({ length: extra }, () => UNKNOWN)]);
1574
- result = inlined.ok ? inlined.value : null;
1575
- } else return spec.kind === "constant" ? spec.level : null;
1639
+ else if (spec.kind === "method") result = this.evaluateMethod(spec.owner, spec.getter.name, spec.getter.descriptor, spec.receiver, probe);
1640
+ else return spec.kind === "constant" ? spec.level : null;
1576
1641
  if (probe.failure || result?.kind !== "number" || !Number.isFinite(result.value)) return null;
1577
1642
  return Math.max(0, Math.min(15, Math.round(result.value)));
1578
1643
  } finally {
@@ -1646,6 +1711,7 @@ function extractBlockLight(roots, source) {
1646
1711
  statics: /* @__PURE__ */ new Map(),
1647
1712
  initialised: /* @__PURE__ */ new Set(),
1648
1713
  registrations: /* @__PURE__ */ new Map(),
1714
+ registeredBlocks: /* @__PURE__ */ new Set(),
1649
1715
  steps: STEP_BUDGET,
1650
1716
  frames: FRAME_BUDGET,
1651
1717
  notes: [],
@@ -1700,37 +1766,30 @@ function extractBlockLight(roots, source) {
1700
1766
  }
1701
1767
  if (spec.kind === "constant") return { light: Math.max(0, Math.min(15, Math.round(spec.level))) };
1702
1768
  if (spec.kind === "opaque") return { failure: `light could not be read: ${spec.reason}` };
1703
- const domains = /* @__PURE__ */ new Map();
1704
- let properties = [];
1705
1769
  const evaluator = new Interpreter(shared);
1706
- for (let rounds = 0; rounds < 8; rounds++) {
1707
- const table = [];
1708
- const discovered = /* @__PURE__ */ new Set();
1709
- const assignments = combinations(properties.map((name) => domains.get(name)));
1710
- if (assignments.length > MAX_STATES) return { failure: `light function depends on ${assignments.length} states; too many to be a real block` };
1711
- for (const values of assignments) {
1712
- const probe = {
1713
- values,
1714
- domains,
1715
- reads: /* @__PURE__ */ new Set(),
1716
- failure: null
1717
- };
1718
- const before = shared.notes.length;
1719
- const level = evaluator.evaluate(spec, probe);
1720
- if (level === null) {
1721
- const detail = shared.notes.slice(before).join("; ");
1722
- return { failure: `light function ${probe.failure ?? "did not return a number"}${detail ? ` (${detail})` : ""}` };
1723
- }
1724
- table.push({
1725
- values,
1726
- level
1727
- });
1728
- for (const read of probe.reads) if (!properties.includes(read)) discovered.add(read);
1770
+ const folded = tabulateStates(shared, (probe) => evaluator.evaluate(spec, probe), "light function");
1771
+ return "failure" in folded ? folded : { light: folded.value };
1772
+ };
1773
+ const tabulate = (fn, read) => {
1774
+ const evaluator = new Interpreter(shared);
1775
+ return tabulateStates(shared, (probe) => {
1776
+ const value = evaluator.evaluateLambda(fn, probe);
1777
+ return value === null ? null : read(value);
1778
+ }, "state function");
1779
+ };
1780
+ const tabulateMethod = (registration, method, read) => {
1781
+ const evaluator = new Interpreter(shared);
1782
+ return tabulateStates(shared, (probe) => {
1783
+ shared.probe = probe;
1784
+ shared.steps = STEP_BUDGET;
1785
+ shared.frames = FRAME_BUDGET;
1786
+ try {
1787
+ const value = evaluator.evaluateMethod(method.owner, method.name, method.descriptor, registration.block, probe, true);
1788
+ return value === null || probe.failure ? null : read(value);
1789
+ } finally {
1790
+ shared.probe = null;
1729
1791
  }
1730
- if (discovered.size === 0) return { light: foldCases(table, properties) };
1731
- properties = [...properties, ...discovered];
1732
- }
1733
- return { failure: "light function reads more properties than a blockstate can have" };
1792
+ }, `${method.name} override`);
1734
1793
  };
1735
1794
  const describe = (blockId) => {
1736
1795
  const registration = registrationOf(blockId);
@@ -1742,8 +1801,47 @@ function extractBlockLight(roots, source) {
1742
1801
  registrations: shared.registrations,
1743
1802
  notes: shared.notes,
1744
1803
  lightOf,
1804
+ registrationOf,
1805
+ tabulate,
1806
+ tabulateMethod,
1745
1807
  describe
1746
1808
  };
1747
1809
  }
1810
+ /**
1811
+ * Runs `evaluate` over every combination of the properties it turns out to read, discovering them as
1812
+ * it goes: the first round runs with none, and each round adds whatever the last one read.
1813
+ */
1814
+ function tabulateStates(shared, evaluate, what) {
1815
+ const domains = /* @__PURE__ */ new Map();
1816
+ let properties = [];
1817
+ for (let rounds = 0; rounds < 8; rounds++) {
1818
+ const table = [];
1819
+ const discovered = /* @__PURE__ */ new Set();
1820
+ const assignments = combinations(properties.map((name) => domains.get(name)));
1821
+ if (assignments.length > MAX_STATES) return { failure: `${what} depends on ${assignments.length} states; too many to be a real block` };
1822
+ for (const values of assignments) {
1823
+ const probe = {
1824
+ values,
1825
+ domains,
1826
+ reads: /* @__PURE__ */ new Set(),
1827
+ failure: null
1828
+ };
1829
+ const before = shared.notes.length;
1830
+ const level = evaluate(probe);
1831
+ if (level === null) {
1832
+ const detail = shared.notes.slice(before).join("; ");
1833
+ return { failure: `${what} ${probe.failure ?? "did not return a number"}${detail ? ` (${detail})` : ""}` };
1834
+ }
1835
+ table.push({
1836
+ values,
1837
+ level
1838
+ });
1839
+ for (const read of probe.reads) if (!properties.includes(read)) discovered.add(read);
1840
+ }
1841
+ if (discovered.size === 0) return { value: foldCases(table, properties) };
1842
+ properties = [...properties, ...discovered];
1843
+ }
1844
+ return { failure: `${what} reads more properties than a blockstate can have` };
1845
+ }
1748
1846
  //#endregion
1749
1847
  export { extractBlockLight as t };
@@ -1,5 +1,5 @@
1
1
  import { n as BlockProperties } from "./blockstate-eval-BzznRcVY.js";
2
- import { d as BlockPackLight } from "./pack-format-BqWf-DNc.js";
2
+ import { j as BlockPackLight } from "./block-behaviour-BBslelpW.js";
3
3
  //#region src/blocks/light-eval.d.ts
4
4
  /**
5
5
  * The light a block emits in the given state, 0–15.
@@ -1,4 +1,4 @@
1
- import { t as parseClassFile } from "./classfile-CiIDF3vc.js";
1
+ import { t as parseClassFile } from "./classfile-BJSs3JH0.js";
2
2
  //#region src/entities/link.ts
3
3
  /**
4
4
  * Which class holds a given entity's geometry.
@@ -1,5 +1,5 @@
1
1
  import { n as ResourceLocator } from "./locator-jDbdUeTd.js";
2
- import { a as ResourceManager } from "./manager-exOIcdyx.js";
2
+ import { a as ResourceManager } from "./manager-Ct0dEOMg.js";
3
3
  import { c as ModelJson, n as DisplayTransformJson, o as ModelElementJson, t as DisplayPosition } from "./types-qlp3I8_-.js";
4
4
  //#region src/models/loader.d.ts
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { n as ResourceLocator } from "./locator-jDbdUeTd.js";
2
- import { a as ResourceManager } from "./manager-exOIcdyx.js";
2
+ import { a as ResourceManager } from "./manager-Ct0dEOMg.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 {
@@ -81,6 +81,12 @@ declare const ResourceKind: {
81
81
  readonly directory: "worldgen/biome";
82
82
  readonly extension: ".json";
83
83
  };
84
+ /** Any datapack JSON under data/<ns>/: tags, advancements, whatever the version ships as data. */
85
+ readonly data: {
86
+ readonly root: "data";
87
+ readonly directory: "";
88
+ readonly extension: ".json";
89
+ };
84
90
  };
85
91
  type ResourceKindName = keyof typeof ResourceKind;
86
92
  interface ResourceManager {
@@ -58,6 +58,12 @@ const ResourceKind = {
58
58
  root: "data",
59
59
  directory: "worldgen/biome",
60
60
  extension: ".json"
61
+ },
62
+ /** Any datapack JSON under data/<ns>/: tags, advancements, whatever the version ships as data. */
63
+ data: {
64
+ root: "data",
65
+ directory: "",
66
+ extension: ".json"
61
67
  }
62
68
  };
63
69
  /**
@@ -106,6 +106,8 @@ function parseMappings(text) {
106
106
  const originalOf = /* @__PURE__ */ new Map();
107
107
  const fieldOf = /* @__PURE__ */ new Map();
108
108
  const methodOf = /* @__PURE__ */ new Map();
109
+ const methods = [];
110
+ const fields = [];
109
111
  let owner = "";
110
112
  for (const line of text.split("\n")) {
111
113
  if (line.length === 0 || line.startsWith("#")) continue;
@@ -129,18 +131,33 @@ function parseMappings(text) {
129
131
  const open = signature.indexOf("(");
130
132
  if (open === -1) {
131
133
  fieldOf.set(`${owner}.${signature}`, obfuscated);
134
+ fields.push({
135
+ owner,
136
+ name: signature,
137
+ obfuscated
138
+ });
132
139
  continue;
133
140
  }
134
141
  const name = signature.slice(0, open);
135
142
  const params = signature.slice(open + 1, -1);
136
143
  const descriptor = `(${params.length === 0 ? "" : params.split(",").map((param) => typeDescriptor(param.trim())).join("")})${typeDescriptor(returnType)}`;
137
144
  methodOf.set(`${owner}.${name}${descriptor}`, obfuscated);
145
+ methods.push({
146
+ owner,
147
+ name,
148
+ descriptor,
149
+ obfuscated
150
+ });
138
151
  }
152
+ const nameOf = /* @__PURE__ */ new Map();
153
+ for (const field of fields) nameOf.set(`${obfuscatedOf.get(field.owner)}.${field.obfuscated}`, field.name);
154
+ for (const method of methods) nameOf.set(`${obfuscatedOf.get(method.owner)}.${method.obfuscated}${remapDescriptor(method.descriptor, obfuscatedOf)}`, method.name);
139
155
  return {
140
156
  obfuscatedOf,
141
157
  originalOf,
142
158
  fieldOf,
143
- methodOf
159
+ methodOf,
160
+ nameOf
144
161
  };
145
162
  }
146
163
  async function loadMappings(version, cacheDir) {
@@ -40,6 +40,11 @@ interface Mappings {
40
40
  */
41
41
  fieldOf: Map<string, string>;
42
42
  methodOf: Map<string, string>;
43
+ /**
44
+ * The other way: a member as the obfuscated client spells it (`eea$d.a(FF)Leea$d;`) to its original
45
+ * name (`strength`), for reading what the game's own code calls. Absent for an identity mapping.
46
+ */
47
+ nameOf?: Map<string, string>;
43
48
  }
44
49
  /**
45
50
  * A descriptor with every class in it renamed through the map: `(Lnet/minecraft/…/Block;)V` on an
@@ -1,4 +1,4 @@
1
- import { t as parseClassFile } from "./classfile-CiIDF3vc.js";
1
+ import { t as parseClassFile } from "./classfile-BJSs3JH0.js";
2
2
  import { a as mergeModels, r as cubesOf, t as buildsOwnMesh } from "./merge-DeHruviG.js";
3
3
  //#region src/entities/model-bytecode.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { t as ClassFile } from "./classfile-CsLXlh5z.js";
1
+ import { t as ClassFile } from "./classfile-Dzn0gW9M.js";
2
2
  //#region src/entities/model-code.d.ts
3
3
  interface ModelCode {
4
4
  /** The parsed class, when it is model code a call may be followed into. */
@@ -1,4 +1,4 @@
1
- import { t as parseClassFile } from "./classfile-CiIDF3vc.js";
1
+ import { t as parseClassFile } from "./classfile-BJSs3JH0.js";
2
2
  //#region src/entities/model-code.ts
3
3
  /**
4
4
  * Which classes in a jar count as model code, and their parsed form.
@@ -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-DSir1-P0.js";
1
+ import { a as resolveTexture, i as flattenLoaderModel, n as ModelResolutionError, o as salvageJson, r as ResolvedModel, t as ModelLoader } from "../loader-BYyPIs9f.js";
2
2
  export { ModelLoader, ModelResolutionError, ResolvedModel, flattenLoaderModel, resolveTexture, salvageJson };
@@ -1,5 +1,5 @@
1
1
  import { r as modModelPackPath } from "./builtin-WkWjATeh.js";
2
- import { t as FolderResourceManager } from "./manager-BNibYkmI.js";
2
+ import { t as FolderResourceManager } from "./manager-D6zXmFrO.js";
3
3
  //#region src/mods/models.ts
4
4
  /**
5
5
  * Geometry for mod items the game draws in code. A `builtin/entity` item model
@@ -1,4 +1,4 @@
1
- import { a as ResourceManager } from "../manager-exOIcdyx.js";
1
+ import { a as ResourceManager } from "../manager-Ct0dEOMg.js";
2
2
  //#region src/mods/models.d.ts
3
3
  declare function curatedModelOverrides(): ResourceManager;
4
4
  //#endregion
@@ -1,2 +1,2 @@
1
- import { t as curatedModelOverrides } from "../models-CZjCOjs4.js";
1
+ import { t as curatedModelOverrides } from "../models-BsYA-NZg.js";
2
2
  export { curatedModelOverrides };
@@ -1,2 +1,2 @@
1
- import { i as prepareModResources, n as ModPreparation, r as PrepareModsOptions, t as LOADER_NAMESPACES } from "../prepare-OS7wL3jv.js";
1
+ import { i as prepareModResources, n as ModPreparation, r as PrepareModsOptions, t as LOADER_NAMESPACES } from "../prepare-BPzsZI_S.js";
2
2
  export { LOADER_NAMESPACES, ModPreparation, PrepareModsOptions, prepareModResources };
@@ -1,2 +1,2 @@
1
- import { n as prepareModResources, t as LOADER_NAMESPACES } from "../prepare-DxPEu9mo.js";
1
+ import { n as prepareModResources, t as LOADER_NAMESPACES } from "../prepare-sj36BP90.js";
2
2
  export { LOADER_NAMESPACES, prepareModResources };
@@ -1,5 +1,5 @@
1
- import { a as ResourceManager } from "../manager-exOIcdyx.js";
2
- import { n as MapResourceManager } from "../synthetic-B3R7mW9k.js";
1
+ import { a as ResourceManager } from "../manager-Ct0dEOMg.js";
2
+ import { n as MapResourceManager } from "../synthetic-CWtFtAkR.js";
3
3
  //#region src/mods/synthesize.d.ts
4
4
  interface SynthesisResult {
5
5
  models: MapResourceManager;
@@ -1,5 +1,5 @@
1
- import { a as ResourceManager } from "../manager-exOIcdyx.js";
2
- import { n as MapResourceManager } from "../synthetic-B3R7mW9k.js";
1
+ import { a as ResourceManager } from "../manager-Ct0dEOMg.js";
2
+ import { n as MapResourceManager } from "../synthetic-CWtFtAkR.js";
3
3
  //#region src/mods/tints.d.ts
4
4
  interface HarvestTintsOptions {
5
5
  /** Assets from 1.21.4+ releases of the same mods, read only for their tints. */
@@ -1,2 +1,2 @@
1
- import { n as harvestTintOverrides, t as curatedTintOverrides } from "../tints-CWQz6UkM.js";
1
+ import { n as harvestTintOverrides, t as curatedTintOverrides } from "../tints-CZeyKzMv.js";
2
2
  export { curatedTintOverrides, harvestTintOverrides };
@@ -0,0 +1,10 @@
1
+ import { a as ResourceManager } from "./manager-Ct0dEOMg.js";
2
+ //#region src/blocks/names.d.ts
3
+ /** `names.json`: display names by id, one table per registry. */
4
+ interface NamePack {
5
+ block: Record<string, string>;
6
+ item: Record<string, string>;
7
+ }
8
+ declare function collectNames(resources: ResourceManager, namespaces: readonly string[]): Promise<NamePack>;
9
+ //#endregion
10
+ export { collectNames as n, NamePack as t };