@nodecraft/rendermite 1.7.4 → 1.9.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 (164) hide show
  1. package/README.md +8 -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-9Tj_GIUC.d.ts +632 -0
  9. package/dist/block-behaviour-D-SG2Xfp.js +155 -0
  10. package/dist/blocks/atlas-pack.d.ts +1 -1
  11. package/dist/blocks/biomes.d.ts +2 -2
  12. package/dist/blocks/biomes.js +2 -2
  13. package/dist/blocks/block-behaviour.d.ts +2 -0
  14. package/dist/blocks/block-behaviour.js +2 -0
  15. package/dist/blocks/block-entities.d.ts +3 -3
  16. package/dist/blocks/cli.js +1 -1
  17. package/dist/blocks/datapack.d.ts +2 -0
  18. package/dist/blocks/datapack.js +2 -0
  19. package/dist/blocks/ender-storage.d.ts +2 -2
  20. package/dist/blocks/entities.d.ts +3 -3
  21. package/dist/blocks/entity-geo.d.ts +1 -1
  22. package/dist/blocks/entity-models.d.ts +4 -4
  23. package/dist/blocks/entity-models.js +1 -1
  24. package/dist/blocks/entity-sizes.d.ts +25 -0
  25. package/dist/blocks/entity-sizes.js +2 -0
  26. package/dist/blocks/export.d.ts +1 -1
  27. package/dist/blocks/export.js +1 -1
  28. package/dist/blocks/game-rules.d.ts +2 -0
  29. package/dist/blocks/game-rules.js +2 -0
  30. package/dist/blocks/geo-blocks.d.ts +2 -2
  31. package/dist/blocks/item-sprites.d.ts +4 -4
  32. package/dist/blocks/light-bytecode.d.ts +2 -0
  33. package/dist/blocks/light-bytecode.js +2 -0
  34. package/dist/blocks/light-eval.d.ts +2 -0
  35. package/dist/blocks/light-eval.js +2 -0
  36. package/dist/blocks/light.d.ts +48 -0
  37. package/dist/blocks/light.js +2 -0
  38. package/dist/blocks/obj-mesh.d.ts +1 -1
  39. package/dist/blocks/pack-format.d.ts +2 -2
  40. package/dist/blocks/sprite-sheet.d.ts +3 -3
  41. package/dist/blocks/states.d.ts +2 -0
  42. package/dist/blocks/states.js +2 -0
  43. package/dist/blocks/tints.d.ts +1 -1
  44. package/dist/{classfile-Bo7FUrrD.js → classfile-CiIDF3vc.js} +23 -1
  45. package/dist/{classfile-BdLIk4Pe.d.ts → classfile-CsLXlh5z.d.ts} +23 -0
  46. package/dist/{cli-DBNuCnry.js → cli-xBcMuKA3.js} +11 -5
  47. package/dist/cli.js +7 -7
  48. package/dist/datapack-CmEg0Vko.d.ts +15 -0
  49. package/dist/datapack-D6eH46ay.js +71 -0
  50. package/dist/{descriptor-JyXhfd-c.js → descriptor-Dz2cR-BH.js} +2 -2
  51. package/dist/{discovery-Cmir3QfC.d.ts → discovery-DWe_kX8W.d.ts} +1 -1
  52. package/dist/dynamic/generators.d.ts +1 -1
  53. package/dist/{encode-Br_vPrd8.d.ts → encode-BNEYHHR0.d.ts} +1 -1
  54. package/dist/entities/classfile.d.ts +1 -1
  55. package/dist/entities/classfile.js +1 -1
  56. package/dist/entities/geo-model.d.ts +1 -1
  57. package/dist/entities/inherit.d.ts +2 -2
  58. package/dist/entities/inherit.js +1 -1
  59. package/dist/entities/jar-classes.js +1 -1
  60. package/dist/entities/link.d.ts +2 -2
  61. package/dist/entities/link.js +1 -1
  62. package/dist/entities/mappings.d.ts +2 -2
  63. package/dist/entities/mappings.js +2 -2
  64. package/dist/entities/model-bytecode.d.ts +7 -2
  65. package/dist/entities/model-bytecode.js +2 -2
  66. package/dist/entities/model-code.d.ts +1 -1
  67. package/dist/entities/model-code.js +1 -1
  68. package/dist/{entity-models-DUKiHpn1.js → entity-models-BYAxrTsk.js} +5 -5
  69. package/dist/entity-sizes-CpO1gA7p.js +194 -0
  70. package/dist/{export-Ds1EelMa.js → export-CbG2Rx3i.js} +73 -4
  71. package/dist/{export-B8tPsf4K.d.ts → export-HEoqcV-Y.d.ts} +19 -2
  72. package/dist/{face-DqEd9G_U.d.ts → face-uWXECGNr.d.ts} +2 -2
  73. package/dist/game-rules-DuLlFc7o.js +104 -0
  74. package/dist/game-rules-ThvdDG3B.d.ts +16 -0
  75. package/dist/{generators-BnIzAftW.d.ts → generators-hu_vk10m.d.ts} +1 -1
  76. package/dist/{geo-C9QYeLVN.d.ts → geo-DsWwuC5o.d.ts} +4 -4
  77. package/dist/index.d.ts +20 -20
  78. package/dist/index.js +8 -8
  79. package/dist/{inherit-BYLi3Q28.js → inherit-BUn0Cve9.js} +2 -2
  80. package/dist/items/blockstate.d.ts +1 -1
  81. package/dist/items/discovery.d.ts +1 -1
  82. package/dist/{jar-B5iRZQeL.d.ts → jar-4Jg7ufWK.d.ts} +1 -1
  83. package/dist/{jar-W2cV2ZVO.js → jar-DvofBm71.js} +2 -2
  84. package/dist/{jar-classes-3GVCJZT7.js → jar-classes-0wqWbTax.js} +2 -2
  85. package/dist/light-CC3VMsjl.js +614 -0
  86. package/dist/light-bytecode-DYxb6pJk.js +1799 -0
  87. package/dist/light-eval-BsJJoSv4.js +23 -0
  88. package/dist/light-eval-DMjK6xnb.d.ts +13 -0
  89. package/dist/{link-5GmBLTzk.js → link-Cuhyrz07.js} +1 -1
  90. package/dist/{loader-DSir1-P0.d.ts → loader-BYyPIs9f.d.ts} +1 -1
  91. package/dist/{loader-59_eMa8e.d.ts → loader-C4gsX_wO.d.ts} +1 -1
  92. package/dist/{manager-exOIcdyx.d.ts → manager-Ct0dEOMg.d.ts} +6 -0
  93. package/dist/{manager-BNibYkmI.js → manager-D6zXmFrO.js} +6 -0
  94. package/dist/{mappings-BEPVaiwE.js → mappings-DEl_7xxQ.js} +94 -9
  95. package/dist/{mappings-DxX4KoZl.d.ts → mappings-DhOPQTgV.d.ts} +33 -2
  96. package/dist/{model-bytecode-B43uSqet.js → model-bytecode-VaLUQfGO.js} +2 -2
  97. package/dist/{model-code-BY44ao27.d.ts → model-code-Csc3bs3h.d.ts} +1 -1
  98. package/dist/{model-code-1Vuk-zj_.js → model-code-DbN2uVhp.js} +1 -1
  99. package/dist/models/loader.d.ts +1 -1
  100. package/dist/{models-CZjCOjs4.js → models-BsYA-NZg.js} +1 -1
  101. package/dist/mods/models.d.ts +1 -1
  102. package/dist/mods/models.js +1 -1
  103. package/dist/mods/prepare.d.ts +1 -1
  104. package/dist/mods/prepare.js +1 -1
  105. package/dist/mods/synthesize.d.ts +2 -2
  106. package/dist/mods/tints.d.ts +2 -2
  107. package/dist/mods/tints.js +1 -1
  108. package/dist/{obj-mesh-ydhVfLKs.d.ts → obj-mesh-CzL0lOlJ.d.ts} +2 -2
  109. package/dist/output/encode.d.ts +1 -1
  110. package/dist/pack.d.ts +7 -5
  111. package/dist/pack.js +2 -1
  112. package/dist/{pipeline-DFuQa8ZT.d.ts → pipeline-DuPF3sap.d.ts} +3 -3
  113. package/dist/{pipeline-BTlk9-s5.js → pipeline-Q_185kY6.js} +1 -1
  114. package/dist/{prepare-OS7wL3jv.d.ts → prepare-BPzsZI_S.d.ts} +1 -1
  115. package/dist/{prepare-6pH3CNpg.d.ts → prepare-Ce5SpR7Y.d.ts} +1 -1
  116. package/dist/{prepare-D49Gu4Lv.js → prepare-DkJkZXuQ.js} +2 -2
  117. package/dist/{prepare-Myd_ec4v.js → prepare-sj36BP90.js} +4 -4
  118. package/dist/{rasterizer-C2wgJZ6J.d.ts → rasterizer-DjnurUgD.d.ts} +1 -1
  119. package/dist/render/blend.d.ts +1 -1
  120. package/dist/render/compose.d.ts +2 -2
  121. package/dist/render/entity-fallback.d.ts +6 -6
  122. package/dist/render/face.d.ts +1 -1
  123. package/dist/render/fluid-bucket.d.ts +2 -2
  124. package/dist/render/geo.d.ts +1 -1
  125. package/dist/render/legacy-tints.d.ts +2 -2
  126. package/dist/render/obj.d.ts +5 -5
  127. package/dist/render/pipeline.d.ts +1 -1
  128. package/dist/render/pipeline.js +1 -1
  129. package/dist/render/rasterizer.d.ts +1 -1
  130. package/dist/render/renderer.d.ts +1 -1
  131. package/dist/render/tints.d.ts +1 -1
  132. package/dist/{renderer-DbUmTFDb.d.ts → renderer-QgROYvPv.d.ts} +5 -5
  133. package/dist/resources/descriptor.d.ts +1 -1
  134. package/dist/resources/descriptor.js +1 -1
  135. package/dist/resources/entity-textures.d.ts +2 -2
  136. package/dist/resources/jar.d.ts +1 -1
  137. package/dist/resources/jar.js +1 -1
  138. package/dist/resources/manager.d.ts +1 -1
  139. package/dist/resources/manager.js +1 -1
  140. package/dist/resources/synthetic.d.ts +1 -1
  141. package/dist/resources/zip-reader.js +1 -1
  142. package/dist/{run-Ctt_1iTd.js → run-5yX5KRiI.js} +4 -4
  143. package/dist/{run-CLjF0N2d.d.ts → run-CxB1qabg.d.ts} +2 -2
  144. package/dist/run.d.ts +1 -1
  145. package/dist/run.js +1 -1
  146. package/dist/{sources-e5D09Jz_.d.ts → sources-sFtealLJ.d.ts} +1 -1
  147. package/dist/states-BvoZA-ql.js +40 -0
  148. package/dist/states-OzneeCTU.d.ts +25 -0
  149. package/dist/{synthetic-B3R7mW9k.d.ts → synthetic-CWtFtAkR.d.ts} +1 -1
  150. package/dist/textures/loader.d.ts +1 -1
  151. package/dist/textures/overlay.d.ts +1 -1
  152. package/dist/{tints-uLl1CIkC.d.ts → tints-B0a1K11c.d.ts} +2 -2
  153. package/dist/{tints-BspVCz2G.js → tints-CZeyKzMv.js} +2 -2
  154. package/dist/{tints-CQX8a1F0.d.ts → tints-DwFmEkf3.d.ts} +2 -2
  155. package/dist/versions/legacy-reshape.d.ts +1 -1
  156. package/dist/versions/prepare.d.ts +1 -1
  157. package/dist/versions/prepare.js +1 -1
  158. package/dist/workers/render-worker.d.ts +2 -2
  159. package/dist/workers/render-worker.js +2 -2
  160. package/dist/{zip-reader-BSbJKUT1.js → zip-reader-onwEVMea.js} +4 -4
  161. package/package.json +6 -6
  162. package/dist/biomes-5ZwYxMYe.js +0 -384
  163. package/dist/biomes-CJDJQqJb.d.ts +0 -38
  164. package/dist/pack-format-Baoc_aSZ.d.ts +0 -328
@@ -0,0 +1,71 @@
1
+ //#region src/blocks/datapack.ts
2
+ /**
3
+ * 1.21 renamed the tag folders to the registry's singular name. Normalised here so a consumer asks
4
+ * for `block` at every version rather than knowing which spelling a jar used.
5
+ */
6
+ const PLURAL_TAG_FOLDERS = {
7
+ blocks: "block",
8
+ items: "item",
9
+ fluids: "fluid",
10
+ entity_types: "entity_type",
11
+ game_events: "game_event",
12
+ functions: "function"
13
+ };
14
+ /** `advancements/` before 1.21, `advancement/` from it. */
15
+ const ADVANCEMENT_FOLDER = /^advancements?\//;
16
+ async function readJson(resources, locator) {
17
+ const raw = await resources.getResource("data", locator);
18
+ if (raw === null) return null;
19
+ try {
20
+ return JSON.parse(raw.toString("utf8"));
21
+ } catch {
22
+ return null;
23
+ }
24
+ }
25
+ async function collectDatapack(resources, namespaces) {
26
+ const tags = {};
27
+ const advancements = {};
28
+ const unreadable = [];
29
+ for (const namespace of namespaces) {
30
+ const listed = await resources.listResources("data", namespace);
31
+ for (const locator of listed.toSorted((left, right) => left.path.localeCompare(right.path))) {
32
+ const tag = /^tags\/(.+)$/.exec(locator.path);
33
+ if (tag) {
34
+ const rest = tag[1];
35
+ const split = /^(worldgen\/[^/]+)\/(.+)$/.exec(rest) ?? /^([^/]+)\/(.+)$/.exec(rest);
36
+ if (!split) continue;
37
+ const registry = PLURAL_TAG_FOLDERS[split[1]] ?? split[1];
38
+ const json = await readJson(resources, locator);
39
+ if (!Array.isArray(json?.values)) {
40
+ unreadable.push(locator.toString());
41
+ continue;
42
+ }
43
+ const values = json.values.flatMap((value) => {
44
+ if (typeof value === "string") return [value];
45
+ const id = value?.id;
46
+ return typeof id === "string" ? [id] : [];
47
+ });
48
+ tags[registry] ??= {};
49
+ tags[registry][`${namespace}:${split[2]}`] = values;
50
+ continue;
51
+ }
52
+ if (ADVANCEMENT_FOLDER.test(locator.path)) {
53
+ const name = locator.path.replace(ADVANCEMENT_FOLDER, "");
54
+ if (name.startsWith("recipes/")) continue;
55
+ const json = await readJson(resources, locator);
56
+ if (typeof json?.criteria !== "object" || json.criteria === null) {
57
+ unreadable.push(locator.toString());
58
+ continue;
59
+ }
60
+ advancements[`${namespace}:${name}`] = Object.keys(json.criteria);
61
+ }
62
+ }
63
+ }
64
+ return {
65
+ tags,
66
+ advancements,
67
+ unreadable
68
+ };
69
+ }
70
+ //#endregion
71
+ export { collectDatapack as t };
@@ -1,6 +1,6 @@
1
- import { n as LayeredResourceManager, t as FolderResourceManager } from "./manager-BNibYkmI.js";
2
- import { t as JarResourceManager } from "./jar-W2cV2ZVO.js";
3
1
  import { n as MapResourceManager, t as KindFilteredResourceManager } from "./synthetic-rc9BPT4P.js";
2
+ import { n as LayeredResourceManager, t as FolderResourceManager } from "./manager-D6zXmFrO.js";
3
+ import { t as JarResourceManager } from "./jar-DvofBm71.js";
4
4
  //#region src/resources/descriptor.ts
5
5
  /**
6
6
  * Serializable descriptions of a resource tree, so the same layered tree can be
@@ -1,4 +1,4 @@
1
- import { a as ResourceManager } from "./manager-exOIcdyx.js";
1
+ import { a as ResourceManager } from "./manager-Ct0dEOMg.js";
2
2
  import { i as ItemRenderInstruction, r as ItemProperties } from "./definition-ricL7Jqf.js";
3
3
  //#region src/items/discovery.d.ts
4
4
  declare class ItemResolutionError extends Error {}
@@ -1,2 +1,2 @@
1
- import { a as TRIM_DARKER_MATERIALS, i as POTTERY_SHERDS, n as DynamicItem, o as TRIM_MATERIALS, r as DynamicResources, s as builtinDynamicResources, t as ARMOR_ITEM_TYPES } from "../generators-BnIzAftW.js";
1
+ import { a as TRIM_DARKER_MATERIALS, i as POTTERY_SHERDS, n as DynamicItem, o as TRIM_MATERIALS, r as DynamicResources, s as builtinDynamicResources, t as ARMOR_ITEM_TYPES } from "../generators-hu_vk10m.js";
2
2
  export { ARMOR_ITEM_TYPES, DynamicItem, DynamicResources, POTTERY_SHERDS, TRIM_DARKER_MATERIALS, TRIM_MATERIALS, builtinDynamicResources };
@@ -1,4 +1,4 @@
1
- import { n as FloatTexture } from "./blend-C5UYzink.js";
1
+ import { n as FloatTexture } from "./blend-mJAeQB3C.js";
2
2
  //#region src/output/encode.d.ts
3
3
  interface EncodedIcon {
4
4
  png: Buffer;
@@ -1,2 +1,2 @@
1
- import { a as parseClassFile, i as MethodInfo, n as Constant, r as ConstantTag, t as ClassFile } from "../classfile-BdLIk4Pe.js";
1
+ import { a as parseClassFile, i as MethodInfo, n as Constant, r as ConstantTag, t as ClassFile } from "../classfile-CsLXlh5z.js";
2
2
  export { ClassFile, Constant, ConstantTag, MethodInfo, parseClassFile };
@@ -1,2 +1,2 @@
1
- import { t as parseClassFile } from "../classfile-Bo7FUrrD.js";
1
+ import { t as parseClassFile } from "../classfile-CiIDF3vc.js";
2
2
  export { parseClassFile };
@@ -1,5 +1,5 @@
1
1
  import { r as ExtractedModel } from "../model-PnQ4gV0-.js";
2
- import { t as ParsedGeo } from "../geo-C9QYeLVN.js";
2
+ import { t as ParsedGeo } from "../geo-DsWwuC5o.js";
3
3
  //#region src/entities/geo-model.d.ts
4
4
  /**
5
5
  * Converts one parsed `.geo.json` into a model.
@@ -1,6 +1,6 @@
1
+ import { t as ClassFile } from "../classfile-CsLXlh5z.js";
1
2
  import { r as ExtractedModel } from "../model-PnQ4gV0-.js";
2
- import { t as ClassFile } from "../classfile-BdLIk4Pe.js";
3
- import { t as ModelCode } from "../model-code-BY44ao27.js";
3
+ import { t as ModelCode } from "../model-code-Csc3bs3h.js";
4
4
  //#region src/entities/inherit.d.ts
5
5
  interface Ancestry {
6
6
  /** The class and its ancestors by internal name, parsed. */
@@ -1,2 +1,2 @@
1
- import { n as extractInheritedModel, t as ancestryOf } from "../inherit-BYLi3Q28.js";
1
+ import { n as extractInheritedModel, t as ancestryOf } from "../inherit-BUn0Cve9.js";
2
2
  export { ancestryOf, extractInheritedModel };
@@ -1,2 +1,2 @@
1
- import { n as layeredClasses, t as JarClassReader } from "../jar-classes-3GVCJZT7.js";
1
+ import { n as layeredClasses, t as JarClassReader } from "../jar-classes-0wqWbTax.js";
2
2
  export { JarClassReader, layeredClasses };
@@ -1,5 +1,5 @@
1
- import { t as Mappings } from "../mappings-DxX4KoZl.js";
2
- import { t as ClassFile } from "../classfile-BdLIk4Pe.js";
1
+ import { t as ClassFile } from "../classfile-CsLXlh5z.js";
2
+ import { t as Mappings } from "../mappings-DhOPQTgV.js";
3
3
  //#region src/entities/link.d.ts
4
4
  /**
5
5
  * Entity types whose renderer or model is not named after them. Values are class simple names to look
@@ -1,2 +1,2 @@
1
- import { a as linkEntityModel, i as classReader, n as RENDERER_ALIASES, o as normaliseModelName, r as buildModelNameIndex, t as NO_MODEL } from "../link-5GmBLTzk.js";
1
+ import { a as linkEntityModel, i as classReader, n as RENDERER_ALIASES, o as normaliseModelName, r as buildModelNameIndex, t as NO_MODEL } from "../link-Cuhyrz07.js";
2
2
  export { NO_MODEL, RENDERER_ALIASES, buildModelNameIndex, classReader, linkEntityModel, normaliseModelName };
@@ -1,2 +1,2 @@
1
- import { a as isObfuscated, c as resolveMappings, i as identityMappings, n as MappingsUnavailableError, o as loadMappings, r as downloadClientMappings, s as parseMappings, t as Mappings } from "../mappings-DxX4KoZl.js";
2
- export { Mappings, MappingsUnavailableError, downloadClientMappings, identityMappings, isObfuscated, loadMappings, parseMappings, resolveMappings };
1
+ import { a as isObfuscated, c as remapDescriptor, i as identityMappings, l as resolveMappings, n as MappingsUnavailableError, o as loadMappings, r as downloadClientMappings, s as parseMappings, t as Mappings } from "../mappings-DhOPQTgV.js";
2
+ export { Mappings, MappingsUnavailableError, downloadClientMappings, identityMappings, isObfuscated, loadMappings, parseMappings, remapDescriptor, resolveMappings };
@@ -1,2 +1,2 @@
1
- import { a as loadMappings, i as isObfuscated, n as downloadClientMappings, o as parseMappings, r as identityMappings, s as resolveMappings, t as MappingsUnavailableError } from "../mappings-BEPVaiwE.js";
2
- export { MappingsUnavailableError, downloadClientMappings, identityMappings, isObfuscated, loadMappings, parseMappings, resolveMappings };
1
+ import { a as loadMappings, c as resolveMappings, i as isObfuscated, n as downloadClientMappings, o as parseMappings, r as identityMappings, s as remapDescriptor, t as MappingsUnavailableError } from "../mappings-DEl_7xxQ.js";
2
+ export { MappingsUnavailableError, downloadClientMappings, identityMappings, isObfuscated, loadMappings, parseMappings, remapDescriptor, resolveMappings };
@@ -1,6 +1,11 @@
1
+ import { t as ClassFile } from "../classfile-CsLXlh5z.js";
1
2
  import { r as ExtractedModel } from "../model-PnQ4gV0-.js";
2
- import { t as ClassFile } from "../classfile-BdLIk4Pe.js";
3
3
  //#region src/entities/model-bytecode.d.ts
4
+ /** Argument slot count and shape of a descriptor's parameter list. */
5
+ declare function parseDescriptor(descriptor: string): {
6
+ args: string[];
7
+ returns: string;
8
+ };
4
9
  /**
5
10
  * Extracts whatever geometry a class's methods build.
6
11
  *
@@ -43,4 +48,4 @@ interface Following {
43
48
  declare function extractArmourMesh(bytes: Uint8Array, following: Following): ExtractedModel;
44
49
  declare function extractModel(bytes: Uint8Array, following?: Following): ExtractedModel;
45
50
  //#endregion
46
- export { Following, extractArmourMesh, extractModel };
51
+ export { Following, extractArmourMesh, extractModel, parseDescriptor };
@@ -1,2 +1,2 @@
1
- import { n as extractModel, t as extractArmourMesh } from "../model-bytecode-B43uSqet.js";
2
- export { extractArmourMesh, extractModel };
1
+ import { n as extractModel, r as parseDescriptor, t as extractArmourMesh } from "../model-bytecode-VaLUQfGO.js";
2
+ export { extractArmourMesh, extractModel, parseDescriptor };
@@ -1,2 +1,2 @@
1
- import { n as isModelCode, r as loadModelCode, t as ModelCode } from "../model-code-BY44ao27.js";
1
+ import { n as isModelCode, r as loadModelCode, t as ModelCode } from "../model-code-Csc3bs3h.js";
2
2
  export { ModelCode, isModelCode, loadModelCode };
@@ -1,2 +1,2 @@
1
- import { n as loadModelCode, t as isModelCode } from "../model-code-1Vuk-zj_.js";
1
+ import { n as loadModelCode, t as isModelCode } from "../model-code-DbN2uVhp.js";
2
2
  export { isModelCode, loadModelCode };
@@ -1,11 +1,11 @@
1
1
  import { n as ResourceLocator } from "./locator-COMEtEn9.js";
2
2
  import { t as findGeoForEntity } from "./entity-geo-DbTtMlPL.js";
3
3
  import { t as EQUIPMENT_SLOTS } from "./pack-format-BP5dJMYY.js";
4
- import { n as extractModel, t as extractArmourMesh } from "./model-bytecode-B43uSqet.js";
5
- import { n as extractInheritedModel, t as ancestryOf } from "./inherit-BYLi3Q28.js";
6
- import { a as linkEntityModel, i as classReader, r as buildModelNameIndex } from "./link-5GmBLTzk.js";
7
- import { s as resolveMappings, t as MappingsUnavailableError } from "./mappings-BEPVaiwE.js";
8
- import { n as loadModelCode } from "./model-code-1Vuk-zj_.js";
4
+ import { n as extractModel, t as extractArmourMesh } from "./model-bytecode-VaLUQfGO.js";
5
+ import { n as extractInheritedModel, t as ancestryOf } from "./inherit-BUn0Cve9.js";
6
+ import { a as linkEntityModel, i as classReader, r as buildModelNameIndex } from "./link-Cuhyrz07.js";
7
+ import { c as resolveMappings, t as MappingsUnavailableError } from "./mappings-DEl_7xxQ.js";
8
+ import { n as loadModelCode } from "./model-code-DbN2uVhp.js";
9
9
  //#region src/blocks/entity-models.ts
10
10
  /**
11
11
  * Entity geometry for the pack: link each entity to the class that builds it, read that class's
@@ -0,0 +1,194 @@
1
+ import { t as parseClassFile } from "./classfile-CiIDF3vc.js";
2
+ import { c as resolveMappings, t as MappingsUnavailableError } from "./mappings-DEl_7xxQ.js";
3
+ //#region src/blocks/entity-sizes.ts
4
+ /**
5
+ * Each entity type's hitbox, read out of the code that registers it.
6
+ *
7
+ * `EntityType.Builder.of(Cow::new, CREATURE).sized(0.9F, 1.4F)` is the only place a cow's size is
8
+ * stated, so a consumer drawing a stand-in box for a mob either reads it here or hardcodes a table
9
+ * that is a release behind. The two floats are always pushed right before the call, and the name is
10
+ * a string near it: before it in vanilla's `register("cow", …)`, after it in a mod's
11
+ * `build("name")`, or before the lambda a `DeferredRegister.register("name", () -> …)` was handed.
12
+ * A linear pass over each method finds all three without interpreting anything.
13
+ *
14
+ * 1.13 has no builder size (a mob set its own in its constructor) and no mappings to read the call by,
15
+ * so it gets none. Sizes are the base ones: a baby or a large slime scales its own at runtime.
16
+ */
17
+ /**
18
+ * `sized` by every name a jar can call it: Mojang's (vanilla, NeoForge), Forge's SRG name, and
19
+ * Fabric's intermediary one, since a mod jar keeps whichever its loader compiles against.
20
+ */
21
+ const SIZED_NAMES = /* @__PURE__ */ new Set([
22
+ "sized",
23
+ "m_20699_",
24
+ "method_17687"
25
+ ]);
26
+ /** Operand bytes after each opcode that has a fixed number, for walking a method without decoding it. */
27
+ const OPERANDS = /* @__PURE__ */ new Map([
28
+ [16, 1],
29
+ [18, 1],
30
+ [21, 1],
31
+ [22, 1],
32
+ [23, 1],
33
+ [24, 1],
34
+ [25, 1],
35
+ [54, 1],
36
+ [55, 1],
37
+ [56, 1],
38
+ [57, 1],
39
+ [58, 1],
40
+ [169, 1],
41
+ [188, 1],
42
+ [17, 2],
43
+ [19, 2],
44
+ [20, 2],
45
+ [132, 2],
46
+ [167, 2],
47
+ [168, 2],
48
+ [198, 2],
49
+ [199, 2],
50
+ [178, 2],
51
+ [179, 2],
52
+ [180, 2],
53
+ [181, 2],
54
+ [182, 2],
55
+ [183, 2],
56
+ [184, 2],
57
+ [187, 2],
58
+ [189, 2],
59
+ [192, 2],
60
+ [193, 2],
61
+ [197, 3],
62
+ [185, 4],
63
+ [186, 4],
64
+ [200, 4],
65
+ [201, 4]
66
+ ]);
67
+ /** Every instruction of a method, in order. */
68
+ function* instructions(code) {
69
+ let at = 0;
70
+ while (at < code.length) {
71
+ const op = code[at];
72
+ const start = at;
73
+ at++;
74
+ if (op >= 153 && op <= 166) at += 2;
75
+ else if (op === 170 || op === 171) {
76
+ at += (4 - at % 4) % 4;
77
+ const read = (offset) => code[offset] << 24 | code[offset + 1] << 16 | code[offset + 2] << 8 | code[offset + 3];
78
+ if (op === 170) {
79
+ const low = read(at + 4);
80
+ const high = read(at + 8);
81
+ at += 12 + (high - low + 1) * 4;
82
+ } else at += 8 + read(at + 4) * 8;
83
+ } else if (op === 196) at += code[at] === 132 ? 5 : 3;
84
+ else at += OPERANDS.get(op) ?? 0;
85
+ yield {
86
+ op,
87
+ index: op === 18 ? code[start + 1] : code[start + 1] << 8 | code[start + 2]
88
+ };
89
+ }
90
+ }
91
+ function looksLikeId(text) {
92
+ return /^[a-z0-9_.\-/]+(?::[a-z0-9_.\-/]+)?$/.test(text) && text.length < 128;
93
+ }
94
+ /** A float as Java wrote it: `0.6F` widens to 0.6000000238418579, and 0.6 is what the code says. */
95
+ function float32(value) {
96
+ for (let digits = 1; digits < 10; digits++) {
97
+ const candidate = Number(value.toPrecision(digits));
98
+ if (Math.fround(candidate) === Math.fround(value)) return candidate;
99
+ }
100
+ return value;
101
+ }
102
+ async function collectEntitySizes(options) {
103
+ const sizes = /* @__PURE__ */ new Map();
104
+ const failures = [];
105
+ const names = await options.classes.list();
106
+ let mappings;
107
+ try {
108
+ ({mappings} = await resolveMappings(options.version, options.cacheDir, async () => names));
109
+ } catch (err) {
110
+ if (!(err instanceof MappingsUnavailableError)) throw err;
111
+ failures.push({
112
+ id: options.version,
113
+ reason: `no entity sizes: ${err.message}`
114
+ });
115
+ return {
116
+ sizes,
117
+ failures
118
+ };
119
+ }
120
+ const originalName = (owner, name, descriptor) => mappings.nameOf?.get(`${owner.replaceAll("/", ".")}.${name}${descriptor}`) ?? name;
121
+ const parsed = [];
122
+ for (const name of names) {
123
+ const bytes = await options.classes.read(name);
124
+ if (!bytes) continue;
125
+ try {
126
+ parsed.push(parseClassFile(bytes));
127
+ } catch {}
128
+ }
129
+ const keyNames = /* @__PURE__ */ new Map();
130
+ const lambdaNames = /* @__PURE__ */ new Map();
131
+ for (const classFile of parsed) for (const method of classFile.methods) {
132
+ if (!method.code) continue;
133
+ let last = null;
134
+ for (const { op, index } of instructions(method.code)) if (op === 18 || op === 19) {
135
+ const literal = classFile.literal(index);
136
+ if (typeof literal === "string" && looksLikeId(literal)) last = literal;
137
+ } else if (op === 179 && last !== null && method.name === "<clinit>") {
138
+ const field = classFile.reference(index);
139
+ if (field && /ResourceKey;$|^Ljava\/lang\/String;$/.test(field.descriptor)) keyNames.set(`${field.owner}.${field.name}`, last);
140
+ last = null;
141
+ } else if (op === 186 && last !== null) {
142
+ const target = classFile.lambdaTarget(index);
143
+ if (target) lambdaNames.set(`${target.owner}.${target.name}${target.descriptor}`, last);
144
+ }
145
+ }
146
+ const idsByPath = /* @__PURE__ */ new Map();
147
+ for (const id of options.entityIds) {
148
+ const path = id.slice(id.indexOf(":") + 1);
149
+ idsByPath.set(path, [...idsByPath.get(path) ?? [], id]);
150
+ }
151
+ const vanillaClass = (name) => name.startsWith("net/minecraft/") || mappings.originalOf.has(name.replaceAll("/", "."));
152
+ const resolveId = (name, owner) => {
153
+ if (name.includes(":")) return options.entityIds.includes(name) ? name : null;
154
+ const candidates = idsByPath.get(name) ?? [];
155
+ const vanilla = vanillaClass(owner);
156
+ return candidates.find((id) => id.startsWith("minecraft:") === vanilla) ?? null;
157
+ };
158
+ for (const classFile of parsed) for (const method of classFile.methods) {
159
+ if (!method.code) continue;
160
+ let last = lambdaNames.get(`${classFile.thisClass}.${method.name}${method.descriptor}`) ?? null;
161
+ const floats = [];
162
+ let pending = null;
163
+ const settle = (name) => {
164
+ const id = pending && resolveId(name, classFile.thisClass);
165
+ if (pending && id && !sizes.has(id)) sizes.set(id, [float32(pending[0]), float32(pending[1])]);
166
+ pending = null;
167
+ };
168
+ for (const { op, index } of instructions(method.code)) if (op >= 11 && op <= 13) floats.push(op - 11);
169
+ else if (op === 18 || op === 19) {
170
+ const literal = classFile.literal(index);
171
+ if (typeof literal === "number" && classFile.constants[index]?.tag === "float") floats.push(literal);
172
+ else if (typeof literal === "string" && looksLikeId(literal)) {
173
+ if (pending) settle(literal);
174
+ last = literal;
175
+ }
176
+ } else if (op === 178) {
177
+ const field = classFile.reference(index);
178
+ const key = field && keyNames.get(`${field.owner}.${field.name}`);
179
+ if (key) last = key;
180
+ } else if (op === 182 || op === 185) {
181
+ const call = classFile.reference(index);
182
+ if (call && call.descriptor.startsWith("(FF)") && SIZED_NAMES.has(originalName(call.owner, call.name, call.descriptor)) && floats.length >= 2) {
183
+ pending = [floats.at(-2), floats.at(-1)];
184
+ if (last !== null) settle(last);
185
+ }
186
+ }
187
+ }
188
+ return {
189
+ sizes,
190
+ failures
191
+ };
192
+ }
193
+ //#endregion
194
+ export { instructions as n, collectEntitySizes as t };
@@ -1,19 +1,24 @@
1
- import { r as buildBiomeClimates } from "./biomes-5ZwYxMYe.js";
2
1
  import { n as ResourceLocator } from "./locator-COMEtEn9.js";
2
+ import { n as LayeredResourceManager, t as FolderResourceManager } from "./manager-D6zXmFrO.js";
3
+ import { a as buildBiomeClimates } from "./biomes-BGOF6gRM.js";
3
4
  import { n as blockEntityGeometry, r as synthesizeVariants, t as INVISIBLE_BLOCKS } from "./block-entities-C807EY2I.js";
4
5
  import { a as parseBlockState, n as collectModels } from "./blockstate-eval-CV_LwUwj.js";
6
+ import { t as collectDatapack } from "./datapack-D6eH46ay.js";
5
7
  import { a as salvageJson, i as resolveTexture, t as ModelLoader } from "./loader-qOH0Jynq.js";
6
8
  import { t as enderStorageBlockModel } from "./ender-storage-Dgomp6r2.js";
7
9
  import { t as collectEntities } from "./entities-rQ4TZjEo.js";
8
- import { n as collectEntityGeometry } from "./entity-models-DUKiHpn1.js";
10
+ import { n as collectEntityGeometry } from "./entity-models-BYAxrTsk.js";
11
+ import { t as collectEntitySizes } from "./entity-sizes-CpO1gA7p.js";
12
+ import { t as collectGameRules } from "./game-rules-DuLlFc7o.js";
9
13
  import { t as geoBlockModel } from "./geo-blocks-W79q5A0f.js";
10
14
  import { n as discoverItems } from "./discovery-CD0QqxSF.js";
11
15
  import { t as collectItemSprites } from "./item-sprites-CwiEBEAJ.js";
16
+ import { n as collectBlockLight } from "./light-CC3VMsjl.js";
12
17
  import { n as buildObjMesh } from "./obj-mesh-BFhtTBXX.js";
13
18
  import { n as buildSpriteSheet, t as MISSING_SPRITE } from "./sprite-sheet-LQAEtGkp.js";
19
+ import { t as readBlockStates } from "./states-BvoZA-ql.js";
14
20
  import { n as buildBlockTints, t as UNREGISTERED_TINTS } from "./tints-Cl0r-Ol3.js";
15
21
  import { t as loadAtlasResolver } from "./registry-DafxsAhG.js";
16
- import { n as LayeredResourceManager, t as FolderResourceManager } from "./manager-BNibYkmI.js";
17
22
  import { n as TextureLoader } from "./loader-CsgtBuBo.js";
18
23
  import path from "node:path";
19
24
  import { createHash } from "node:crypto";
@@ -693,7 +698,41 @@ async function exportBlockPack(options) {
693
698
  });
694
699
  }
695
700
  }
696
- const biomes = await buildBiomeClimates(resources, namespaces);
701
+ let lightPack = {};
702
+ let behaviourPack = {};
703
+ if (options.classes) {
704
+ const collected = await collectBlockLight({
705
+ version,
706
+ cacheDir: options.cacheDir ?? output,
707
+ classes: options.classes,
708
+ blockIds: [.../* @__PURE__ */ new Set([...blockLocators.map((locator) => locator.toString()), ...Object.keys(blockStates)])],
709
+ onProgress: (count, total) => report("light", count, total)
710
+ });
711
+ lightPack = sortedByKey(collected.light);
712
+ for (const failure of collected.failures) failures.push({
713
+ id: failure.id,
714
+ kind: "light",
715
+ reason: failure.reason
716
+ });
717
+ behaviourPack = sortedByKey(collected.behaviour);
718
+ for (const failure of collected.behaviourFailures) failures.push({
719
+ id: failure.id,
720
+ kind: "behaviour",
721
+ reason: failure.reason
722
+ });
723
+ if (process.env.RENDERMITE_LIGHT_DEBUG) console.error(collected.notes.join("\n"));
724
+ }
725
+ const biomes = await buildBiomeClimates(resources, namespaces, version);
726
+ const datapack = await collectDatapack(resources, namespaces);
727
+ for (const file of datapack.unreadable) failures.push({
728
+ id: file,
729
+ kind: "data",
730
+ reason: "datapack file is unreadable or not in the shape its folder implies; left out"
731
+ });
732
+ const tagCount = Object.values(datapack.tags).reduce((sum, registry) => sum + Object.keys(registry).length, 0);
733
+ const gameRules = options.classes && namespaces.includes("minecraft") ? await collectGameRules(options.classes) : {};
734
+ const states = options.reports === void 0 ? null : await readBlockStates(options.reports);
735
+ const statesPack = states === null ? null : Object.fromEntries(Object.entries(states).filter(([id]) => namespaces.includes(id.split(":", 1)[0])));
697
736
  let itemPack = null;
698
737
  let itemPages = [];
699
738
  if (options.items ?? true) {
@@ -768,6 +807,21 @@ async function exportBlockPack(options) {
768
807
  reason: failure.reason
769
808
  });
770
809
  if (options.classes) {
810
+ const sized = await collectEntitySizes({
811
+ classes: options.classes,
812
+ version,
813
+ cacheDir: options.cacheDir ?? output,
814
+ entityIds: Object.keys(collected.entities)
815
+ });
816
+ for (const [id, [width, height]] of sized.sizes) {
817
+ collected.entities[id].width = width;
818
+ collected.entities[id].height = height;
819
+ }
820
+ for (const failure of sized.failures) failures.push({
821
+ id: failure.id,
822
+ kind: "entity",
823
+ reason: failure.reason
824
+ });
771
825
  const textureOf = /* @__PURE__ */ new Map();
772
826
  for (const [id, entry] of Object.entries(collected.entities)) if (entry.texture) textureOf.set(id, entry.texture);
773
827
  const geometry = await collectEntityGeometry({
@@ -885,7 +939,16 @@ async function exportBlockPack(options) {
885
939
  await emit("models.json", JSON.stringify(sortedByKey(emittedModels)));
886
940
  await emit("blockstates.json", JSON.stringify(sortedByKey(blockStates)));
887
941
  await emit("tints.json", JSON.stringify(tints.pack));
942
+ if (Object.keys(lightPack).length > 0) await emit("light.json", JSON.stringify(lightPack));
943
+ if (Object.keys(behaviourPack).length > 0) await emit("behaviour.json", JSON.stringify(behaviourPack));
888
944
  if (Object.keys(biomes.pack).length > 0) await emit("biomes.json", JSON.stringify(sortedByKey(biomes.pack)));
945
+ if (tagCount > 0) {
946
+ const tags = Object.fromEntries(Object.entries(datapack.tags).map(([registry, entries]) => [registry, sortedByKey(entries)]));
947
+ await emit("tags.json", JSON.stringify(sortedByKey(tags)));
948
+ }
949
+ if (Object.keys(gameRules).length > 0) await emit("game-rules.json", JSON.stringify(sortedByKey(gameRules)));
950
+ if (statesPack !== null && Object.keys(statesPack).length > 0) await emit("states.json", JSON.stringify(sortedByKey(statesPack)));
951
+ if (Object.keys(datapack.advancements).length > 0) await emit("advancements.json", JSON.stringify(sortedByKey(datapack.advancements)));
889
952
  for (const biome of biomes.unreadable) failures.push({
890
953
  id: biome,
891
954
  kind: "biome",
@@ -902,6 +965,12 @@ async function exportBlockPack(options) {
902
965
  items: Object.keys(itemPack?.items ?? {}).length,
903
966
  entities: Object.keys(entityPack ?? {}).length,
904
967
  entityModels: Object.keys(entityModelPack?.models ?? {}).length,
968
+ light: Object.keys(lightPack).length,
969
+ behaviour: Object.keys(behaviourPack).length,
970
+ tags: tagCount,
971
+ advancements: Object.keys(datapack.advancements).length,
972
+ states: Object.keys(statesPack ?? {}).length,
973
+ gameRules: Object.keys(gameRules).length,
905
974
  failures: failures.length
906
975
  };
907
976
  await emit("meta.json", JSON.stringify({
@@ -1,4 +1,4 @@
1
- import { a as ResourceManager } from "./manager-exOIcdyx.js";
1
+ import { a as ResourceManager } from "./manager-Ct0dEOMg.js";
2
2
  import { t as ClassSource } from "./jar-classes-CSRrPAUy.js";
3
3
  //#region src/blocks/export.d.ts
4
4
  interface ExportBlockPackOptions {
@@ -42,6 +42,11 @@ interface ExportBlockPackOptions {
42
42
  classes?: ClassSource;
43
43
  /** Where mappings cache; the jar cache directory. */
44
44
  cacheDir?: string;
45
+ /**
46
+ * A data generator `reports` directory for this version (`java -jar server.jar --reports`). Its
47
+ * `blocks.json` becomes `states.json`; without it the pack has no full property sets or defaults.
48
+ */
49
+ reports?: string;
45
50
  onProgress?: (stage: string, done: number, total: number) => void;
46
51
  }
47
52
  interface BlockPackFailure {
@@ -50,7 +55,7 @@ interface BlockPackFailure {
50
55
  * `intentional` is not a failure: it marks a block that is empty because the
51
56
  * game draws nothing for it. Filter it out to get the real gaps.
52
57
  */
53
- kind: 'blockstate' | 'model' | 'texture' | 'sprite' | 'geometry' | 'tint' | 'biome' | 'item' | 'entity' | 'intentional';
58
+ kind: 'blockstate' | 'model' | 'texture' | 'sprite' | 'geometry' | 'tint' | 'biome' | 'item' | 'entity' | 'light' | 'behaviour' | 'data' | 'intentional';
54
59
  reason: string;
55
60
  }
56
61
  interface BlockPackResult {
@@ -66,6 +71,18 @@ interface BlockPackResult {
66
71
  entities: number;
67
72
  /** Distinct entity models in `entity-models.json`; `0` means the file was not written. */
68
73
  entityModels: number;
74
+ /** Emitting blocks in `light.json`; `0` means the file was not written. */
75
+ light: number;
76
+ /** Blocks in `behaviour.json`; `0` means the file was not written. */
77
+ behaviour: number;
78
+ /** Tags across every registry in `tags.json`; `0` means the file was not written. */
79
+ tags: number;
80
+ /** Advancements in `advancements.json`; `0` means the file was not written. */
81
+ advancements: number;
82
+ /** Blocks in `states.json`; `0` means no reports were given and the file was not written. */
83
+ states: number;
84
+ /** Rules in `game-rules.json`; `0` means the file was not written. */
85
+ gameRules: number;
69
86
  /** Files actually written — the only trustworthy success signal. */
70
87
  writtenFiles: number;
71
88
  failures: BlockPackFailure[];
@@ -1,8 +1,8 @@
1
- import { n as FloatTexture } from "./blend-C5UYzink.js";
1
+ import { n as FloatTexture } from "./blend-mJAeQB3C.js";
2
2
  import { t as Mat4 } from "./vector-DRKRi4--.js";
3
3
  import { n as FaceGeometry } from "./geometry--UzHu1Vh.js";
4
4
  import { r as LightSource } from "./lighting-3FGRC3Af.js";
5
- import { n as FaceBuffer } from "./rasterizer-C2wgJZ6J.js";
5
+ import { n as FaceBuffer } from "./rasterizer-DjnurUgD.js";
6
6
  //#region src/render/face.d.ts
7
7
  interface TintColor {
8
8
  r: number;