@adeficior/data-modifier 1.0.0-rc.9

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 (274) hide show
  1. package/dist/cli/codegen/registry.d.ts +3 -0
  2. package/dist/cli/codegen/registry.js +81 -0
  3. package/dist/cli/codegen/registry.js.map +1 -0
  4. package/dist/cli/config.d.ts +10 -0
  5. package/dist/cli/config.js +60 -0
  6. package/dist/cli/config.js.map +1 -0
  7. package/dist/cli/index.d.ts +1 -0
  8. package/dist/cli/index.js +34 -0
  9. package/dist/cli/index.js.map +1 -0
  10. package/dist/common/id.d.ts +15 -0
  11. package/dist/common/id.js +42 -0
  12. package/dist/common/id.js.map +1 -0
  13. package/dist/common/ingredient.d.ts +49 -0
  14. package/dist/common/ingredient.js +108 -0
  15. package/dist/common/ingredient.js.map +1 -0
  16. package/dist/common/predicates.d.ts +7 -0
  17. package/dist/common/predicates.js +32 -0
  18. package/dist/common/predicates.js.map +1 -0
  19. package/dist/common/registry.d.ts +12 -0
  20. package/dist/common/registry.js +36 -0
  21. package/dist/common/registry.js.map +1 -0
  22. package/dist/common/result.d.ts +48 -0
  23. package/dist/common/result.js +37 -0
  24. package/dist/common/result.js.map +1 -0
  25. package/dist/emit/assets/blockstates.d.ts +18 -0
  26. package/dist/emit/assets/blockstates.js +46 -0
  27. package/dist/emit/assets/blockstates.js.map +1 -0
  28. package/dist/emit/assets/lang.d.ts +33 -0
  29. package/dist/emit/assets/lang.js +103 -0
  30. package/dist/emit/assets/lang.js.map +1 -0
  31. package/dist/emit/assets/models.d.ts +24 -0
  32. package/dist/emit/assets/models.js +59 -0
  33. package/dist/emit/assets/models.js.map +1 -0
  34. package/dist/emit/blacklist.d.ts +32 -0
  35. package/dist/emit/blacklist.js +99 -0
  36. package/dist/emit/blacklist.js.map +1 -0
  37. package/dist/emit/content/blockDefinition.d.ts +58 -0
  38. package/dist/emit/content/blockDefinition.js +58 -0
  39. package/dist/emit/content/blockDefinition.js.map +1 -0
  40. package/dist/emit/content/innerBlockDefinition.d.ts +12 -0
  41. package/dist/emit/content/innerBlockDefinition.js +32 -0
  42. package/dist/emit/content/innerBlockDefinition.js.map +1 -0
  43. package/dist/emit/content/itemDefinition.d.ts +58 -0
  44. package/dist/emit/content/itemDefinition.js +54 -0
  45. package/dist/emit/content/itemDefinition.js.map +1 -0
  46. package/dist/emit/custom.d.ts +15 -0
  47. package/dist/emit/custom.js +42 -0
  48. package/dist/emit/custom.js.map +1 -0
  49. package/dist/emit/data/loot.d.ts +48 -0
  50. package/dist/emit/data/loot.js +108 -0
  51. package/dist/emit/data/loot.js.map +1 -0
  52. package/dist/emit/data/recipe.d.ts +46 -0
  53. package/dist/emit/data/recipe.js +106 -0
  54. package/dist/emit/data/recipe.js.map +1 -0
  55. package/dist/emit/data/tags.d.ts +38 -0
  56. package/dist/emit/data/tags.js +115 -0
  57. package/dist/emit/data/tags.js.map +1 -0
  58. package/dist/emit/index.d.ts +11 -0
  59. package/dist/emit/index.js +1 -0
  60. package/dist/emit/index.js.map +1 -0
  61. package/dist/emit/polytoneTabs.d.ts +65 -0
  62. package/dist/emit/polytoneTabs.js +101 -0
  63. package/dist/emit/polytoneTabs.js.map +1 -0
  64. package/dist/emit/rule/index.d.ts +10 -0
  65. package/dist/emit/rule/index.js +10 -0
  66. package/dist/emit/rule/index.js.map +1 -0
  67. package/dist/emit/rule/lootTable.d.ts +14 -0
  68. package/dist/emit/rule/lootTable.js +47 -0
  69. package/dist/emit/rule/lootTable.js.map +1 -0
  70. package/dist/emit/rule/recipe.d.ts +16 -0
  71. package/dist/emit/rule/recipe.js +29 -0
  72. package/dist/emit/rule/recipe.js.map +1 -0
  73. package/dist/emit/ruled.d.ts +18 -0
  74. package/dist/emit/ruled.js +47 -0
  75. package/dist/emit/ruled.js.map +1 -0
  76. package/dist/error.d.ts +12 -0
  77. package/dist/error.js +45 -0
  78. package/dist/error.js.map +1 -0
  79. package/dist/index.d.ts +31 -0
  80. package/dist/index.js +12 -0
  81. package/dist/index.js.map +1 -0
  82. package/dist/loader/index.d.ts +16 -0
  83. package/dist/loader/index.js +40 -0
  84. package/dist/loader/index.js.map +1 -0
  85. package/dist/loader/lang.d.ts +7 -0
  86. package/dist/loader/lang.js +12 -0
  87. package/dist/loader/lang.js.map +1 -0
  88. package/dist/loader/loot.d.ts +7 -0
  89. package/dist/loader/loot.js +12 -0
  90. package/dist/loader/loot.js.map +1 -0
  91. package/dist/loader/pack.d.ts +62 -0
  92. package/dist/loader/pack.js +131 -0
  93. package/dist/loader/pack.js.map +1 -0
  94. package/dist/loader/recipe.d.ts +25 -0
  95. package/dist/loader/recipe.js +207 -0
  96. package/dist/loader/recipe.js.map +1 -0
  97. package/dist/loader/registry/dump.d.ts +19 -0
  98. package/dist/loader/registry/dump.js +74 -0
  99. package/dist/loader/registry/dump.js.map +1 -0
  100. package/dist/loader/registry/empty.d.ts +11 -0
  101. package/dist/loader/registry/empty.js +22 -0
  102. package/dist/loader/registry/empty.js.map +1 -0
  103. package/dist/loader/registry/index.d.ts +11 -0
  104. package/dist/loader/registry/index.js +1 -0
  105. package/dist/loader/registry/index.js.map +1 -0
  106. package/dist/loader/tags.d.ts +26 -0
  107. package/dist/loader/tags.js +131 -0
  108. package/dist/loader/tags.js.map +1 -0
  109. package/dist/parser/adAstra.d.ts +11 -0
  110. package/dist/parser/adAstra.js +6 -0
  111. package/dist/parser/adAstra.js.map +1 -0
  112. package/dist/parser/botania.d.ts +20 -0
  113. package/dist/parser/botania.js +11 -0
  114. package/dist/parser/botania.js.map +1 -0
  115. package/dist/parser/create.d.ts +4 -0
  116. package/dist/parser/create.js +3 -0
  117. package/dist/parser/create.js.map +1 -0
  118. package/dist/parser/farmersdelight.d.ts +4 -0
  119. package/dist/parser/farmersdelight.js +3 -0
  120. package/dist/parser/farmersdelight.js.map +1 -0
  121. package/dist/parser/index.d.ts +13 -0
  122. package/dist/parser/index.js +8 -0
  123. package/dist/parser/index.js.map +1 -0
  124. package/dist/parser/lootTable.d.ts +7 -0
  125. package/dist/parser/lootTable.js +70 -0
  126. package/dist/parser/lootTable.js.map +1 -0
  127. package/dist/parser/recipe/adAstra/conversion.d.ts +20 -0
  128. package/dist/parser/recipe/adAstra/conversion.js +33 -0
  129. package/dist/parser/recipe/adAstra/conversion.js.map +1 -0
  130. package/dist/parser/recipe/adAstra/hammering.d.ts +18 -0
  131. package/dist/parser/recipe/adAstra/hammering.js +27 -0
  132. package/dist/parser/recipe/adAstra/hammering.js.map +1 -0
  133. package/dist/parser/recipe/adAstra/index.d.ts +5 -0
  134. package/dist/parser/recipe/adAstra/index.js +1 -0
  135. package/dist/parser/recipe/adAstra/index.js.map +1 -0
  136. package/dist/parser/recipe/adAstra/inputOutput.d.ts +24 -0
  137. package/dist/parser/recipe/adAstra/inputOutput.js +42 -0
  138. package/dist/parser/recipe/adAstra/inputOutput.js.map +1 -0
  139. package/dist/parser/recipe/adAstra/nasaWorkbench.d.ts +20 -0
  140. package/dist/parser/recipe/adAstra/nasaWorkbench.js +30 -0
  141. package/dist/parser/recipe/adAstra/nasaWorkbench.js.map +1 -0
  142. package/dist/parser/recipe/adAstra/spaceStation.d.ts +19 -0
  143. package/dist/parser/recipe/adAstra/spaceStation.js +27 -0
  144. package/dist/parser/recipe/adAstra/spaceStation.js.map +1 -0
  145. package/dist/parser/recipe/botania/apothecary.d.ts +19 -0
  146. package/dist/parser/recipe/botania/apothecary.js +28 -0
  147. package/dist/parser/recipe/botania/apothecary.js.map +1 -0
  148. package/dist/parser/recipe/botania/brew.d.ts +18 -0
  149. package/dist/parser/recipe/botania/brew.js +24 -0
  150. package/dist/parser/recipe/botania/brew.js.map +1 -0
  151. package/dist/parser/recipe/botania/elvenTrade.d.ts +19 -0
  152. package/dist/parser/recipe/botania/elvenTrade.js +27 -0
  153. package/dist/parser/recipe/botania/elvenTrade.js.map +1 -0
  154. package/dist/parser/recipe/botania/gogWrapper.d.ts +22 -0
  155. package/dist/parser/recipe/botania/gogWrapper.js +34 -0
  156. package/dist/parser/recipe/botania/gogWrapper.js.map +1 -0
  157. package/dist/parser/recipe/botania/manaInfusion.d.ts +21 -0
  158. package/dist/parser/recipe/botania/manaInfusion.js +33 -0
  159. package/dist/parser/recipe/botania/manaInfusion.js.map +1 -0
  160. package/dist/parser/recipe/botania/nbtWrapper.d.ts +20 -0
  161. package/dist/parser/recipe/botania/nbtWrapper.js +30 -0
  162. package/dist/parser/recipe/botania/nbtWrapper.js.map +1 -0
  163. package/dist/parser/recipe/botania/orechid.d.ts +35 -0
  164. package/dist/parser/recipe/botania/orechid.js +74 -0
  165. package/dist/parser/recipe/botania/orechid.js.map +1 -0
  166. package/dist/parser/recipe/botania/pureDaisy.d.ts +19 -0
  167. package/dist/parser/recipe/botania/pureDaisy.js +30 -0
  168. package/dist/parser/recipe/botania/pureDaisy.js.map +1 -0
  169. package/dist/parser/recipe/botania/runicAltar.d.ts +19 -0
  170. package/dist/parser/recipe/botania/runicAltar.js +27 -0
  171. package/dist/parser/recipe/botania/runicAltar.js.map +1 -0
  172. package/dist/parser/recipe/botania/terraPlate.d.ts +19 -0
  173. package/dist/parser/recipe/botania/terraPlate.js +27 -0
  174. package/dist/parser/recipe/botania/terraPlate.js.map +1 -0
  175. package/dist/parser/recipe/create/assembly.d.ts +25 -0
  176. package/dist/parser/recipe/create/assembly.js +45 -0
  177. package/dist/parser/recipe/create/assembly.js.map +1 -0
  178. package/dist/parser/recipe/create/processing.d.ts +21 -0
  179. package/dist/parser/recipe/create/processing.js +27 -0
  180. package/dist/parser/recipe/create/processing.js.map +1 -0
  181. package/dist/parser/recipe/farmersdelight/cooking.d.ts +22 -0
  182. package/dist/parser/recipe/farmersdelight/cooking.js +29 -0
  183. package/dist/parser/recipe/farmersdelight/cooking.js.map +1 -0
  184. package/dist/parser/recipe/farmersdelight/cutting.d.ts +23 -0
  185. package/dist/parser/recipe/farmersdelight/cutting.js +38 -0
  186. package/dist/parser/recipe/farmersdelight/cutting.js.map +1 -0
  187. package/dist/parser/recipe/forge/conditional.d.ts +25 -0
  188. package/dist/parser/recipe/forge/conditional.js +45 -0
  189. package/dist/parser/recipe/forge/conditional.js.map +1 -0
  190. package/dist/parser/recipe/ignored.d.ts +10 -0
  191. package/dist/parser/recipe/ignored.js +16 -0
  192. package/dist/parser/recipe/ignored.js.map +1 -0
  193. package/dist/parser/recipe/index.d.ts +19 -0
  194. package/dist/parser/recipe/index.js +22 -0
  195. package/dist/parser/recipe/index.js.map +1 -0
  196. package/dist/parser/recipe/quark/exclusion.d.ts +20 -0
  197. package/dist/parser/recipe/quark/exclusion.js +32 -0
  198. package/dist/parser/recipe/quark/exclusion.js.map +1 -0
  199. package/dist/parser/recipe/roots/component.d.ts +18 -0
  200. package/dist/parser/recipe/roots/component.js +24 -0
  201. package/dist/parser/recipe/roots/component.js.map +1 -0
  202. package/dist/parser/recipe/roots/ritual.d.ts +22 -0
  203. package/dist/parser/recipe/roots/ritual.js +32 -0
  204. package/dist/parser/recipe/roots/ritual.js.map +1 -0
  205. package/dist/parser/recipe/sullys/polishing.d.ts +19 -0
  206. package/dist/parser/recipe/sullys/polishing.js +27 -0
  207. package/dist/parser/recipe/sullys/polishing.js.map +1 -0
  208. package/dist/parser/recipe/thermal/catalyst.d.ts +22 -0
  209. package/dist/parser/recipe/thermal/catalyst.js +24 -0
  210. package/dist/parser/recipe/thermal/catalyst.js.map +1 -0
  211. package/dist/parser/recipe/thermal/fuel.d.ts +18 -0
  212. package/dist/parser/recipe/thermal/fuel.js +24 -0
  213. package/dist/parser/recipe/thermal/fuel.js.map +1 -0
  214. package/dist/parser/recipe/thermal/index.d.ts +22 -0
  215. package/dist/parser/recipe/thermal/index.js +36 -0
  216. package/dist/parser/recipe/thermal/index.js.map +1 -0
  217. package/dist/parser/recipe/thermal/ingredient.d.ts +21 -0
  218. package/dist/parser/recipe/thermal/ingredient.js +43 -0
  219. package/dist/parser/recipe/thermal/ingredient.js.map +1 -0
  220. package/dist/parser/recipe/thermal/treeExtraction.d.ts +24 -0
  221. package/dist/parser/recipe/thermal/treeExtraction.js +47 -0
  222. package/dist/parser/recipe/thermal/treeExtraction.js.map +1 -0
  223. package/dist/parser/recipe/vanilla/shaped.d.ts +19 -0
  224. package/dist/parser/recipe/vanilla/shaped.js +28 -0
  225. package/dist/parser/recipe/vanilla/shaped.js.map +1 -0
  226. package/dist/parser/recipe/vanilla/shapeless.d.ts +18 -0
  227. package/dist/parser/recipe/vanilla/shapeless.js +27 -0
  228. package/dist/parser/recipe/vanilla/shapeless.js.map +1 -0
  229. package/dist/parser/recipe/vanilla/smelting.d.ts +19 -0
  230. package/dist/parser/recipe/vanilla/smelting.js +27 -0
  231. package/dist/parser/recipe/vanilla/smelting.js.map +1 -0
  232. package/dist/parser/recipe/vanilla/smithing.d.ts +19 -0
  233. package/dist/parser/recipe/vanilla/smithing.js +28 -0
  234. package/dist/parser/recipe/vanilla/smithing.js.map +1 -0
  235. package/dist/parser/recipe/vanilla/stonecutting.d.ts +20 -0
  236. package/dist/parser/recipe/vanilla/stonecutting.js +36 -0
  237. package/dist/parser/recipe/vanilla/stonecutting.js.map +1 -0
  238. package/dist/parser/roots.d.ts +4 -0
  239. package/dist/parser/roots.js +3 -0
  240. package/dist/parser/roots.js.map +1 -0
  241. package/dist/parser/thermal.d.ts +10 -0
  242. package/dist/parser/thermal.js +6 -0
  243. package/dist/parser/thermal.js.map +1 -0
  244. package/dist/schema/assets/blockstate.d.ts +10 -0
  245. package/dist/schema/assets/blockstate.js +1 -0
  246. package/dist/schema/assets/blockstate.js.map +1 -0
  247. package/dist/schema/assets/lang.d.ts +3 -0
  248. package/dist/schema/assets/lang.js +3 -0
  249. package/dist/schema/assets/lang.js.map +1 -0
  250. package/dist/schema/assets/model.d.ts +27 -0
  251. package/dist/schema/assets/model.js +1 -0
  252. package/dist/schema/assets/model.js.map +1 -0
  253. package/dist/schema/content/blockDefinition.d.ts +11 -0
  254. package/dist/schema/content/blockDefinition.js +1 -0
  255. package/dist/schema/content/blockDefinition.js.map +1 -0
  256. package/dist/schema/content/itemDefinition.d.ts +14 -0
  257. package/dist/schema/content/itemDefinition.js +1 -0
  258. package/dist/schema/content/itemDefinition.js.map +1 -0
  259. package/dist/schema/data/loot.d.ts +1151 -0
  260. package/dist/schema/data/loot.js +76 -0
  261. package/dist/schema/data/loot.js.map +1 -0
  262. package/dist/schema/data/recipe.d.ts +13 -0
  263. package/dist/schema/data/recipe.js +1 -0
  264. package/dist/schema/data/recipe.js.map +1 -0
  265. package/dist/schema/data/tag.d.ts +11 -0
  266. package/dist/schema/data/tag.js +6 -0
  267. package/dist/schema/data/tag.js.map +1 -0
  268. package/dist/stubTypes.d.ts +7 -0
  269. package/dist/stubTypes.js +1 -0
  270. package/dist/stubTypes.js.map +1 -0
  271. package/dist/textHelper.d.ts +3 -0
  272. package/dist/textHelper.js +20 -0
  273. package/dist/textHelper.js.map +1 -0
  274. package/package.json +96 -0
@@ -0,0 +1,74 @@
1
+ import zod from "zod";
2
+ import { encodeId } from "../../common/id.js";
3
+ import Registry from "../../common/registry.js";
4
+ import { tryCatching, UnknownRegistryEntry } from "../../error.js";
5
+ import { tryParseJson } from "../index.js";
6
+ const schema = zod.array(zod.string());
7
+ export default class RegistryDumpLoader {
8
+ logger;
9
+ registry = new Registry();
10
+ constructor(logger) {
11
+ this.logger = logger;
12
+ }
13
+ async extract(resolver) {
14
+ await resolver.extract((path, content) => this.accept(this.logger, path, content));
15
+ }
16
+ registryOf(registry) {
17
+ return this.registry.getOrPut(registry, () => new Set());
18
+ }
19
+ accept = (logger, path, content) => {
20
+ const match = /(?<registry>[\w-/]+)\/[\w-]+.json/.exec(path);
21
+ if (!match?.groups) {
22
+ return false;
23
+ }
24
+ const { registry } = match.groups;
25
+ const grouped = logger.group(path);
26
+ const json = tryParseJson(grouped, content.toString());
27
+ if (!json)
28
+ return false;
29
+ const parsed = tryCatching(grouped, () => schema.parse(json));
30
+ if (!parsed)
31
+ return false;
32
+ const set = this.registryOf(registry);
33
+ parsed.map(encodeId).forEach((id) => set.add(id));
34
+ };
35
+ registries() {
36
+ return this.registry.keys();
37
+ }
38
+ keys(registry) {
39
+ const keys = this.registry.get(registry);
40
+ if (keys === undefined) {
41
+ this.logger.warn(`tried to access registry '${encodeId(registry)}', which has not been loaded`);
42
+ }
43
+ return keys;
44
+ }
45
+ isKnown(registry) {
46
+ return this.registry.has(registry);
47
+ }
48
+ validateEntry(registry, id) {
49
+ const keys = this.keys(registry);
50
+ if (!keys)
51
+ return;
52
+ const normalizedId = encodeId(id);
53
+ if (keys.has(normalizedId))
54
+ return;
55
+ throw new UnknownRegistryEntry(`unknown ${registry} '${normalizedId}'`, registry, normalizedId);
56
+ }
57
+ validate(ingredient) {
58
+ if (Array.isArray(ingredient)) {
59
+ ingredient.forEach((it) => this.validate(it));
60
+ }
61
+ if ("item" in ingredient)
62
+ this.validateEntry("minecraft:item", ingredient.item);
63
+ if ("block" in ingredient)
64
+ this.validateEntry("minecraft:block", ingredient.block);
65
+ if ("fluid" in ingredient)
66
+ this.validateEntry("minecraft:fluid", ingredient.fluid);
67
+ }
68
+ addCustom(key, input) {
69
+ const id = encodeId(input);
70
+ this.registryOf(key).add(id);
71
+ return id;
72
+ }
73
+ }
74
+ //# sourceMappingURL=dump.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dump.js","sourceRoot":"","sources":["../../../src/loader/registry/dump.ts"],"names":[],"mappings":"AAEA,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,QAAQ,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;AAEvC,MAAM,CAAC,OAAO,OAAO,kBAAkB;IAG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,gBAAgB,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;QACxD,IAAI,OAAO,IAAI,UAAU;YACvB,IAAI,CAAC,aAAa,CAAC,iBAAiB,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;QAC1D,IAAI,OAAO,IAAI,UAAU;YACvB,IAAI,CAAC,aAAa,CAAC,iBAAiB,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IAC5D,CAAC;IAED,SAAS,CAAC,GAAe,EAAE,KAAc;QACvC,MAAM,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC3B,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC7B,OAAO,EAAE,CAAC;IACZ,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ import type { RegistryId } from "@adeficior/data-modifier/generated";
2
+ import type { IdInput, NormalizedId } from "../../common/id.js";
3
+ import type RegistryLookup from "./index.js";
4
+ export default class EmptyRegistryLookup implements RegistryLookup {
5
+ isKnown(): boolean;
6
+ registries(): NormalizedId<RegistryId>[];
7
+ keys(): undefined;
8
+ validate(): void;
9
+ validateEntry(): void;
10
+ addCustom(key: RegistryId, id: IdInput): `${string}:${string}`;
11
+ }
@@ -0,0 +1,22 @@
1
+ import { encodeId } from "../../common/id.js";
2
+ export default class EmptyRegistryLookup {
3
+ isKnown() {
4
+ return false;
5
+ }
6
+ registries() {
7
+ return [];
8
+ }
9
+ keys() {
10
+ return undefined;
11
+ }
12
+ validate() {
13
+ // Nothing done
14
+ }
15
+ validateEntry() {
16
+ // Nothing done
17
+ }
18
+ addCustom(key, id) {
19
+ return encodeId(id);
20
+ }
21
+ }
22
+ //# sourceMappingURL=empty.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empty.js","sourceRoot":"","sources":["../../../src/loader/registry/empty.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG9C,MAAM,CAAC,OAAO,OAAO,mBAAmB;IACtC,OAAO;QACL,OAAO,KAAK,CAAC;IACf,CAAC;IAED,UAAU;QACR,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI;QACF,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,QAAQ;QACN,eAAe;IACjB,CAAC;IAED,aAAa;QACX,eAAe;IACjB,CAAC;IAED,SAAS,CAAC,GAAe,EAAE,EAAW;QACpC,OAAO,QAAQ,CAAC,EAAE,CAAC,CAAC;IACtB,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ import type { InferIds, RegistryId } from "@adeficior/data-modifier/generated";
2
+ import type { IdInput, NormalizedId } from "../../common/id.js";
3
+ import type { Ingredient } from "../../common/ingredient.js";
4
+ export default interface RegistryLookup {
5
+ registries(): NormalizedId<RegistryId>[];
6
+ keys<T extends RegistryId>(registry: IdInput<T>): ReadonlySet<NormalizedId<InferIds<T>>> | undefined;
7
+ isKnown(registry: IdInput<RegistryId>): boolean;
8
+ validate(ingredient: Ingredient): void;
9
+ validateEntry(key: RegistryId, id: IdInput): void;
10
+ addCustom<T extends RegistryId>(key: T, id: IdInput): InferIds<T>;
11
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/loader/registry/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,26 @@
1
+ import type { InferIds, RegistryId } from "@adeficior/data-modifier/generated";
2
+ import type { IdInput, TagInput } from "../common/id.js";
3
+ import type { TagEntry } from "../schema/data/tag.js";
4
+ import type { AcceptorWithLoader } from "./index.js";
5
+ import type RegistryLookup from "./registry/index.js";
6
+ export declare function entryId(entry: TagEntry): string;
7
+ export declare function orderTagEntries(entries: TagEntry[]): TagEntry[];
8
+ export interface TagRegistryHolder {
9
+ registry<T extends RegistryId>(key: T): TagRegistry<T>;
10
+ }
11
+ export interface TagRegistry<T extends RegistryId> {
12
+ list(): string[];
13
+ get(id: TagInput): TagEntry<InferIds<T>>[] | undefined;
14
+ resolve(id: TagInput): TagEntry<InferIds<T>>[];
15
+ contains(id: TagInput, entry: IdInput<InferIds<T>>): boolean;
16
+ }
17
+ export default class TagsLoader implements TagRegistryHolder {
18
+ private readonly lookup;
19
+ private registries;
20
+ constructor(lookup: () => RegistryLookup);
21
+ registerRegistry(key: IdInput, folder?: string): void;
22
+ registry<T extends RegistryId>(key: IdInput<T>): TagRegistry<T>;
23
+ private parsePath;
24
+ readonly accept: AcceptorWithLoader;
25
+ freeze(): void;
26
+ }
@@ -0,0 +1,131 @@
1
+ import { orderBy, uniqBy } from "lodash-es";
2
+ import { encodeId } from "../common/id.js";
3
+ import Registry from "../common/registry.js";
4
+ import { tagFolderOf } from "../schema/data/tag.js";
5
+ import { fromJson } from "../textHelper.js";
6
+ export function entryId(entry) {
7
+ if (typeof entry === "string")
8
+ return entry;
9
+ else
10
+ return encodeId(entry.id);
11
+ }
12
+ export function orderTagEntries(entries) {
13
+ return orderBy(uniqBy(entries, (it) => entryId(it)), (it) => entryId(it));
14
+ }
15
+ class WriteableTagRegistry {
16
+ folder;
17
+ entries = new Registry();
18
+ frozen = false;
19
+ constructor(folder) {
20
+ this.folder = folder;
21
+ }
22
+ validateId(input) {
23
+ const id = encodeId(input);
24
+ if (!id.startsWith("#"))
25
+ throw new Error("tag id's must start with a '#'");
26
+ }
27
+ freeze() {
28
+ this.frozen = true;
29
+ }
30
+ load(id, definition) {
31
+ this.validateId(id);
32
+ if (this.frozen)
33
+ throw new Error("TagRegistry has already been frozen");
34
+ const existingEntries = this.entries.get(id) ?? [];
35
+ const unique = orderTagEntries([
36
+ ...existingEntries,
37
+ ...(definition.values ?? []),
38
+ ]);
39
+ // TODO support for advanced-tag-loader packs?
40
+ this.entries.set(id, unique);
41
+ }
42
+ list() {
43
+ if (!this.frozen)
44
+ throw new Error("TagRegistry has not been frozen yet");
45
+ return this.entries.keys();
46
+ }
47
+ get(id) {
48
+ this.validateId(id);
49
+ if (!this.frozen)
50
+ throw new Error("TagRegistry has not been frozen yet");
51
+ return this.entries.get(id);
52
+ }
53
+ resolve(input, level = 0) {
54
+ const id = encodeId(input);
55
+ if (level >= 100)
56
+ throw new Error(`Circular TagDefinition: ${id}`);
57
+ const entries = this.get(input) ?? [];
58
+ return entries.flatMap((it) => {
59
+ const entry = entryId(it);
60
+ const required = typeof it === "string" ? true : it.required !== false;
61
+ if (entry.startsWith("#")) {
62
+ if (entry === id)
63
+ throw new Error(`Circular TagDefinition: ${entry} -> ${id}`);
64
+ const step = this.resolve(entry);
65
+ if (required)
66
+ return step;
67
+ return step.map((it) => {
68
+ if (typeof it === "string")
69
+ return { required: false, id: it };
70
+ return { ...it, required: false };
71
+ });
72
+ }
73
+ return [it];
74
+ });
75
+ }
76
+ contains(id, entry) {
77
+ const entryId = encodeId(entry);
78
+ return (this.get(id)?.some((it) => {
79
+ const value = encodeId(typeof it === "string" ? it : it.id);
80
+ if (value === entryId)
81
+ return true;
82
+ if (value.startsWith("#"))
83
+ return this.contains(value, entryId);
84
+ return false;
85
+ }) ?? false);
86
+ }
87
+ }
88
+ export default class TagsLoader {
89
+ lookup;
90
+ // TODO lookup should add some?
91
+ registries = {};
92
+ constructor(lookup) {
93
+ this.lookup = lookup;
94
+ this.registerRegistry("minecraft:item", "items");
95
+ this.registerRegistry("minecraft:block", "blocks");
96
+ this.registerRegistry("minecraft:fluid", "fluids");
97
+ this.registerRegistry("minecraft:entity_type", "entity_types");
98
+ }
99
+ registerRegistry(key, folder = tagFolderOf(key)) {
100
+ this.registries[encodeId(key)] = new WriteableTagRegistry(folder);
101
+ }
102
+ registry(key) {
103
+ const id = encodeId(key);
104
+ if (!(id in this.registries))
105
+ throw new Error(`unknown registry tags '${id}'. Register them using \`registerRegistry\``);
106
+ return this.registries[id];
107
+ }
108
+ parsePath(input) {
109
+ const match = /data\/(?<namespace>[\w-]+)\/tags\/(?<rest>[\w-/]+).json/.exec(input);
110
+ if (!match?.groups)
111
+ return null;
112
+ const { namespace, rest } = match.groups;
113
+ const registry = Object.values(this.registries).find((it) => rest.startsWith(`${it.folder}/`));
114
+ if (!registry)
115
+ return null;
116
+ const path = rest.substring(registry.folder.length + 1);
117
+ return { namespace, registry, path, isTag: true };
118
+ }
119
+ accept = (_, path, content) => {
120
+ const info = this.parsePath(path);
121
+ if (!info)
122
+ return false;
123
+ const parsed = fromJson(content.toString());
124
+ const id = encodeId(info);
125
+ info.registry.load(id, parsed);
126
+ };
127
+ freeze() {
128
+ Object.values(this.registries).forEach((it) => it.freeze());
129
+ }
130
+ }
131
+ //# sourceMappingURL=tags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tags.js","sourceRoot":"","sources":["../../src/loader/tags.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,QAAQ,MAAM,uBAAuB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAI5C,MAAM,UAAU,OAAO,CAAC,KAAe;IACrC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;;QACvC,OAAO,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,OAAmB;IACjD,OAAO,OAAO,CACZ,MAAM,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,EACpC,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CACpB,CAAC;AACJ,CAAC;AAgBD,MAAM,oBAAoB;IAII;IAHX,OAAO,GAAG,IAAI,QAAQ,EAAc,CAAC;IAC9C,MAAM,GAAG,KAAK,CAAC;IAEvB,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,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9D,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ export type { HammeringRecipeDefinition } from "./recipe/adAstra/hammering.js";
2
+ export { HammeringRecipe, default as HammeringRecipeParser, } from "./recipe/adAstra/hammering.js";
3
+ export type { InputOutputRecipeDefinition, IdResult, } from "./recipe/adAstra/inputOutput.js";
4
+ export { InputOutputRecipe, default as InputOutputRecipeRecipeParser, toIdResult, fromIdResult, } from "./recipe/adAstra/inputOutput.js";
5
+ export type { NasaWorkbenchRecipeDefinition } from "./recipe/adAstra/nasaWorkbench.js";
6
+ export { NasaWorkbenchRecipe, default as NasaWorkbenchRecipeParser, } from "./recipe/adAstra/nasaWorkbench.js";
7
+ export type { FluidConversionRecipeDefinition } from "./recipe/adAstra/conversion.js";
8
+ export { FluidConversionRecipe, default as FluidConversionRecipeParser, } from "./recipe/adAstra/conversion.js";
9
+ export type { SpaceStationRecipeDefinition } from "./recipe/adAstra/spaceStation.js";
10
+ export { SpaceStationRecipe, default as SpaceStationRecipeParser, } from "./recipe/adAstra/spaceStation.js";
11
+ export type { WrappedIngredient } from "./recipe/adAstra/index.js";
@@ -0,0 +1,6 @@
1
+ export { HammeringRecipe, default as HammeringRecipeParser, } from "./recipe/adAstra/hammering.js";
2
+ export { InputOutputRecipe, default as InputOutputRecipeRecipeParser, toIdResult, fromIdResult, } from "./recipe/adAstra/inputOutput.js";
3
+ export { NasaWorkbenchRecipe, default as NasaWorkbenchRecipeParser, } from "./recipe/adAstra/nasaWorkbench.js";
4
+ export { FluidConversionRecipe, default as FluidConversionRecipeParser, } from "./recipe/adAstra/conversion.js";
5
+ export { SpaceStationRecipe, default as SpaceStationRecipeParser, } from "./recipe/adAstra/spaceStation.js";
6
+ //# sourceMappingURL=adAstra.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adAstra.js","sourceRoot":"","sources":["../../src/parser/adAstra.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,OAAO,IAAI,qBAAqB,GACjC,MAAM,+BAA+B,CAAC;AAKvC,OAAO,EACL,iBAAiB,EACjB,OAAO,IAAI,6BAA6B,EACxC,UAAU,EACV,YAAY,GACb,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,mBAAmB,EACnB,OAAO,IAAI,yBAAyB,GACrC,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EACL,qBAAqB,EACrB,OAAO,IAAI,2BAA2B,GACvC,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,kBAAkB,EAClB,OAAO,IAAI,wBAAwB,GACpC,MAAM,kCAAkC,CAAC"}
@@ -0,0 +1,20 @@
1
+ export type { ApothecaryRecipeDefinition } from "./recipe/botania/apothecary.js";
2
+ export { ApothecaryRecipe, default as ApothecaryRecipeParser, } from "./recipe/botania/apothecary.js";
3
+ export type { BrewRecipeDefinition } from "./recipe/botania/brew.js";
4
+ export { BrewRecipe, default as BrewRecipeParser, } from "./recipe/botania/brew.js";
5
+ export type { ElvenTradeRecipeDefinition } from "./recipe/botania/elvenTrade.js";
6
+ export { ElvenTradeRecipe, default as ElvenTradeRecipeParser, } from "./recipe/botania/elvenTrade.js";
7
+ export type { GogWrapperRecipeDefinition } from "./recipe/botania/gogWrapper.js";
8
+ export { GogWrapperRecipe, default as GogWrapperRecipeParser, } from "./recipe/botania/gogWrapper.js";
9
+ export type { ManaInfusionRecipeDefinition } from "./recipe/botania/manaInfusion.js";
10
+ export { ManaInfusionRecipe, default as ManaInfusionRecipeParser, } from "./recipe/botania/manaInfusion.js";
11
+ export type { NbtWrapperRecipeDefinition } from "./recipe/botania/nbtWrapper.js";
12
+ export { NbtWrapperRecipe, default as NbtWrapperRecipeParser, } from "./recipe/botania/nbtWrapper.js";
13
+ export type { OrechidRecipeDefinition, BlockInput, BlockOutput, } from "./recipe/botania/orechid.js";
14
+ export { OrechidRecipe, default as OrechidRecipeParser, createBlockInput, createBlockOutput, fromBlockInput, fromBlockOutput, } from "./recipe/botania/orechid.js";
15
+ export type { PureDaisyRecipeDefinition } from "./recipe/botania/pureDaisy.js";
16
+ export { PureDaisyRecipe, default as PureDaisyRecipeParser, } from "./recipe/botania/pureDaisy.js";
17
+ export type { RunicAltarRecipeDefinition } from "./recipe/botania/runicAltar.js";
18
+ export { RunicAltarRecipe, default as RunicAltarRecipeParser, } from "./recipe/botania/runicAltar.js";
19
+ export type { TerraPlateRecipeDefinition } from "./recipe/botania/terraPlate.js";
20
+ export { TerraPlateRecipe, default as TerraPlateRecipeParser, } from "./recipe/botania/terraPlate.js";
@@ -0,0 +1,11 @@
1
+ export { ApothecaryRecipe, default as ApothecaryRecipeParser, } from "./recipe/botania/apothecary.js";
2
+ export { BrewRecipe, default as BrewRecipeParser, } from "./recipe/botania/brew.js";
3
+ export { ElvenTradeRecipe, default as ElvenTradeRecipeParser, } from "./recipe/botania/elvenTrade.js";
4
+ export { GogWrapperRecipe, default as GogWrapperRecipeParser, } from "./recipe/botania/gogWrapper.js";
5
+ export { ManaInfusionRecipe, default as ManaInfusionRecipeParser, } from "./recipe/botania/manaInfusion.js";
6
+ export { NbtWrapperRecipe, default as NbtWrapperRecipeParser, } from "./recipe/botania/nbtWrapper.js";
7
+ export { OrechidRecipe, default as OrechidRecipeParser, createBlockInput, createBlockOutput, fromBlockInput, fromBlockOutput, } from "./recipe/botania/orechid.js";
8
+ export { PureDaisyRecipe, default as PureDaisyRecipeParser, } from "./recipe/botania/pureDaisy.js";
9
+ export { RunicAltarRecipe, default as RunicAltarRecipeParser, } from "./recipe/botania/runicAltar.js";
10
+ export { TerraPlateRecipe, default as TerraPlateRecipeParser, } from "./recipe/botania/terraPlate.js";
11
+ //# sourceMappingURL=botania.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"botania.js","sourceRoot":"","sources":["../../src/parser/botania.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,OAAO,IAAI,sBAAsB,GAClC,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,UAAU,EACV,OAAO,IAAI,gBAAgB,GAC5B,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,gBAAgB,EAChB,OAAO,IAAI,sBAAsB,GAClC,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,gBAAgB,EAChB,OAAO,IAAI,sBAAsB,GAClC,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,kBAAkB,EAClB,OAAO,IAAI,wBAAwB,GACpC,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACL,gBAAgB,EAChB,OAAO,IAAI,sBAAsB,GAClC,MAAM,gCAAgC,CAAC;AAMxC,OAAO,EACL,aAAa,EACb,OAAO,IAAI,mBAAmB,EAC9B,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,eAAe,GAChB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,eAAe,EACf,OAAO,IAAI,qBAAqB,GACjC,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACL,gBAAgB,EAChB,OAAO,IAAI,sBAAsB,GAClC,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,gBAAgB,EAChB,OAAO,IAAI,sBAAsB,GAClC,MAAM,gCAAgC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export type { AssemblyRecipeDefinition } from "./recipe/create/assembly.js";
2
+ export { AssemblyRecipe, default as AssemblyRecipeParser, } from "./recipe/create/assembly.js";
3
+ export type { CreateProcessingRecipeDefinition } from "./recipe/create/processing.js";
4
+ export { CreateProcessingRecipe, default as CreateProcessingRecipeParser, } from "./recipe/create/processing.js";
@@ -0,0 +1,3 @@
1
+ export { AssemblyRecipe, default as AssemblyRecipeParser, } from "./recipe/create/assembly.js";
2
+ export { CreateProcessingRecipe, default as CreateProcessingRecipeParser, } from "./recipe/create/processing.js";
3
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/parser/create.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,OAAO,IAAI,oBAAoB,GAChC,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,sBAAsB,EACtB,OAAO,IAAI,4BAA4B,GACxC,MAAM,+BAA+B,CAAC"}
@@ -0,0 +1,4 @@
1
+ export type { CookingRecipeDefinition } from "./recipe/farmersdelight/cooking.js";
2
+ export { CookingRecipe, default as CookingRecipeParser, } from "./recipe/farmersdelight/cooking.js";
3
+ export type { CuttingRecipeDefinition, ToolInput, } from "./recipe/farmersdelight/cutting.js";
4
+ export { CuttingRecipe, default as CuttingRecipeParser, } from "./recipe/farmersdelight/cutting.js";
@@ -0,0 +1,3 @@
1
+ export { CookingRecipe, default as CookingRecipeParser, } from "./recipe/farmersdelight/cooking.js";
2
+ export { CuttingRecipe, default as CuttingRecipeParser, } from "./recipe/farmersdelight/cutting.js";
3
+ //# sourceMappingURL=farmersdelight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"farmersdelight.js","sourceRoot":"","sources":["../../src/parser/farmersdelight.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,OAAO,IAAI,mBAAmB,GAC/B,MAAM,oCAAoC,CAAC;AAK5C,OAAO,EACL,aAAa,EACb,OAAO,IAAI,mBAAmB,GAC/B,MAAM,oCAAoC,CAAC"}
@@ -0,0 +1,13 @@
1
+ export { Recipe, default as RecipeParser } from "./recipe/index.js";
2
+ export type { GrindstonePolishingDefinition } from "./recipe/sullys/polishing.js";
3
+ export { GrindstonePolishing, default as GrindstonePolishingParser, } from "./recipe/sullys/polishing.js";
4
+ export type { ShapedRecipeDefinition } from "./recipe/vanilla/shaped.js";
5
+ export { ShapedRecipe, default as ShapedRecipeParser, } from "./recipe/vanilla/shaped.js";
6
+ export type { ShapelessRecipeDefinition } from "./recipe/vanilla/shapeless.js";
7
+ export { ShapelessRecipe, default as ShapelessRecipeParser, } from "./recipe/vanilla/shapeless.js";
8
+ export type { SmeltingRecipeDefinition } from "./recipe/vanilla/smelting.js";
9
+ export { SmeltingRecipe, default as SmeltingRecipeParser, } from "./recipe/vanilla/smelting.js";
10
+ export type { SmithingRecipeDefinition } from "./recipe/vanilla/smithing.js";
11
+ export { SmithingRecipe, default as SmithingRecipeParser, } from "./recipe/vanilla/smithing.js";
12
+ export type { StonecuttingRecipeDefinition } from "./recipe/vanilla/stonecutting.js";
13
+ export { StonecuttingRecipe, default as StonecuttingRecipeParser, } from "./recipe/vanilla/stonecutting.js";
@@ -0,0 +1,8 @@
1
+ export { Recipe, default as RecipeParser } from "./recipe/index.js";
2
+ export { GrindstonePolishing, default as GrindstonePolishingParser, } from "./recipe/sullys/polishing.js";
3
+ export { ShapedRecipe, default as ShapedRecipeParser, } from "./recipe/vanilla/shaped.js";
4
+ export { ShapelessRecipe, default as ShapelessRecipeParser, } from "./recipe/vanilla/shapeless.js";
5
+ export { SmeltingRecipe, default as SmeltingRecipeParser, } from "./recipe/vanilla/smelting.js";
6
+ export { SmithingRecipe, default as SmithingRecipeParser, } from "./recipe/vanilla/smithing.js";
7
+ export { StonecuttingRecipe, default as StonecuttingRecipeParser, } from "./recipe/vanilla/stonecutting.js";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/parser/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGpE,OAAO,EACL,mBAAmB,EACnB,OAAO,IAAI,yBAAyB,GACrC,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,YAAY,EACZ,OAAO,IAAI,kBAAkB,GAC9B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,eAAe,EACf,OAAO,IAAI,qBAAqB,GACjC,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACL,cAAc,EACd,OAAO,IAAI,oBAAoB,GAChC,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,cAAc,EACd,OAAO,IAAI,oBAAoB,GAChC,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,kBAAkB,EAClB,OAAO,IAAI,wBAAwB,GACpC,MAAM,kCAAkC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { LootEntry, LootEntryBase, LootTable } from "../schema/data/loot.js";
2
+ import type { IngredientInput, ItemIngredient, Predicate } from "../common/ingredient.js";
3
+ import type RegistryLookup from "../loader/registry/index.js";
4
+ export type LootItemInput = ItemIngredient | LootEntry;
5
+ export declare function createLootEntry(input: LootItemInput, lookup?: RegistryLookup): LootEntry;
6
+ export declare function replaceItemInEntry(predicate: Predicate<IngredientInput>, to: LootEntry): (base: LootEntryBase) => LootEntry;
7
+ export declare function replaceItemInTable(predicate: Predicate<IngredientInput>, to: LootEntry): (table: LootTable) => LootTable;
@@ -0,0 +1,70 @@
1
+ import { extendLootEntry } from "../schema/data/loot.js";
2
+ import { IllegalShapeError } from "../error.js";
3
+ function createUnvalidatedLootEntry(input) {
4
+ if (input && typeof input === "object") {
5
+ if ("type" in input)
6
+ return extendLootEntry(input);
7
+ if ("tag" in input)
8
+ return {
9
+ type: "minecraft:tag",
10
+ name: input.tag,
11
+ };
12
+ if ("item" in input)
13
+ return {
14
+ type: "minecraft:item",
15
+ name: input.item,
16
+ };
17
+ }
18
+ throw new IllegalShapeError("unknown loot entry input", input);
19
+ }
20
+ function validateLootEntry(entry, lookup) {
21
+ if (entry.type === "minecraft:item")
22
+ lookup?.validate({ item: entry.name });
23
+ if (entry.type === "minecraft:tag")
24
+ lookup?.validate({ tag: entry.name });
25
+ if (entry.type === "minecraft:alternatives") {
26
+ entry.children.forEach((it) => validateLootEntry(extendLootEntry(it), lookup));
27
+ }
28
+ }
29
+ export function createLootEntry(input, lookup) {
30
+ const unvalidated = createUnvalidatedLootEntry(input);
31
+ if (lookup)
32
+ validateLootEntry(unvalidated, lookup);
33
+ return unvalidated;
34
+ }
35
+ export function replaceItemInEntry(predicate, to) {
36
+ const replace = (base) => {
37
+ const entry = extendLootEntry(base);
38
+ const shared = {
39
+ functions: entry.functions,
40
+ conditions: entry.conditions,
41
+ };
42
+ switch (entry.type) {
43
+ case "minecraft:alternatives":
44
+ return {
45
+ ...entry,
46
+ children: entry.children.map(replace),
47
+ };
48
+ case "minecraft:item":
49
+ return predicate({ item: entry.name }) ? { ...shared, ...to } : entry;
50
+ case "minecraft:tag":
51
+ return predicate({ tag: entry.name }) ? { ...shared, ...to } : entry;
52
+ default:
53
+ return entry;
54
+ }
55
+ };
56
+ return replace;
57
+ }
58
+ export function replaceItemInTable(predicate, to) {
59
+ const replaceEntry = replaceItemInEntry(predicate, to);
60
+ return (table) => {
61
+ return {
62
+ ...table,
63
+ pools: table.pools.map((pool) => ({
64
+ ...pool,
65
+ entries: pool.entries.map(replaceEntry),
66
+ })),
67
+ };
68
+ };
69
+ }
70
+ //# sourceMappingURL=lootTable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lootTable.js","sourceRoot":"","sources":["../../src/parser/lootTable.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAUhD,SAAS,0BAA0B,CAAC,KAAoB;IACtD,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACvC,IAAI,MAAM,IAAI,KAAK;YAAE,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;QAEnD,IAAI,KAAK,IAAI,KAAK;YAChB,OAAO;gBACL,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,KAAK,CAAC,GAAG;aAChB,CAAC;QAEJ,IAAI,MAAM,IAAI,KAAK;YACjB,OAAO;gBACL,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,KAAK,CAAC,IAAI;aACjB,CAAC;IACN,CAAC;IAED,MAAM,IAAI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C;iBACtC,CAAC;YAEJ,KAAK,gBAAgB;gBACnB,OAAO,SAAS,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;YAExE,KAAK,eAAe;gBAClB,OAAO,SAAS,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;YAEvE;gBACE,OAAO,KAAK,CAAC;QACjB,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,SAAqC,EACrC,EAAa;IAEb,MAAM,YAAY,GAAG,kBAAkB,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IACvD,OAAO,CAAC,KAAgB,EAAa,EAAE;QACrC,OAAO;YACL,GAAG,KAAK;YACR,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBAChC,GAAG,IAAI;gBACP,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;aACxC,CAAC,CAAC;SACJ,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { Replacer } from "../index.js";
2
+ import RecipeParser, { Recipe } from "../index.js";
3
+ import type { Ingredient, IngredientInput } from "../../../common/ingredient.js";
4
+ import type { RecipeDefinition } from "../../../schema/data/recipe.js";
5
+ import type { Result, ResultInput } from "../../../common/result.js";
6
+ export type FluidConversionRecipeDefinition = RecipeDefinition & Readonly<{
7
+ input: Ingredient;
8
+ output: string;
9
+ }>;
10
+ export declare class FluidConversionRecipe extends Recipe<FluidConversionRecipeDefinition> {
11
+ private readonly output;
12
+ constructor(definition: FluidConversionRecipeDefinition);
13
+ getIngredients(): IngredientInput[];
14
+ getResults(): ResultInput[];
15
+ replaceIngredient(replace: Replacer<Ingredient>): Recipe;
16
+ replaceResult(replace: Replacer<Result>): Recipe;
17
+ }
18
+ export default class FluidConversionRecipeParser extends RecipeParser<FluidConversionRecipeDefinition, FluidConversionRecipe> {
19
+ create(definition: FluidConversionRecipeDefinition): FluidConversionRecipe;
20
+ }
@@ -0,0 +1,33 @@
1
+ import RecipeParser, { Recipe } from "../index.js";
2
+ export class FluidConversionRecipe extends Recipe {
3
+ output;
4
+ constructor(definition) {
5
+ super(definition);
6
+ this.output = { fluid: this.definition.output };
7
+ }
8
+ getIngredients() {
9
+ return [this.definition.input];
10
+ }
11
+ getResults() {
12
+ return [this.output];
13
+ }
14
+ replaceIngredient(replace) {
15
+ return new FluidConversionRecipe({
16
+ ...this.definition,
17
+ input: replace(this.definition.input),
18
+ });
19
+ }
20
+ replaceResult(replace) {
21
+ const replaced = replace(this.output);
22
+ return new FluidConversionRecipe({
23
+ ...this.definition,
24
+ output: "fluid" in replaced ? replaced.fluid : this.definition.output,
25
+ });
26
+ }
27
+ }
28
+ export default class FluidConversionRecipeParser extends RecipeParser {
29
+ create(definition) {
30
+ return new FluidConversionRecipe(definition);
31
+ }
32
+ }
33
+ //# sourceMappingURL=conversion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversion.js","sourceRoot":"","sources":["../../../../src/parser/recipe/adAstra/conversion.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAcnD,MAAM,OAAO,qBAAsB,SAAQ,MAAuC;IAC/D,MAAM,CAAS;IAEhC,YAAY,UAA2C;QACrD,KAAK,CAAC,UAAU,CAAC,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;IAClD,CAAC;IAED,cAAc;QACZ,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAED,UAAU;QACR,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC;IAED,iBAAiB,CAAC,OAA6B;QAC7C,OAAO,IAAI,qBAAqB,CAAC;YAC/B,GAAG,IAAI,CAAC,UAAU;YAClB,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;SACtC,CAAC,CAAC;IACL,CAAC;IAED,aAAa,CAAC,OAAyB;QACrC,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtC,OAAO,IAAI,qBAAqB,CAAC;YAC/B,GAAG,IAAI,CAAC,UAAU;YAClB,MAAM,EAAE,OAAO,IAAI,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM;SACtE,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,CAAC,OAAO,OAAO,2BAA4B,SAAQ,YAGxD;IACC,MAAM,CAAC,UAA2C;QAChD,OAAO,IAAI,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAC/C,CAAC;CACF"}
@@ -0,0 +1,18 @@
1
+ import type { Ingredient, IngredientInput } from "../../../common/ingredient.js";
2
+ import type { Result, ResultInput } from "../../../common/result.js";
3
+ import type { RecipeDefinition } from "../../../schema/data/recipe.js";
4
+ import type { Replacer } from "../index.js";
5
+ import RecipeParser, { Recipe } from "../index.js";
6
+ export type HammeringRecipeDefinition = RecipeDefinition & Readonly<{
7
+ ingredients: Ingredient[];
8
+ result: Result;
9
+ }>;
10
+ export declare class HammeringRecipe extends Recipe<HammeringRecipeDefinition> {
11
+ getIngredients(): IngredientInput[];
12
+ getResults(): ResultInput[];
13
+ replaceIngredient(replace: Replacer<Ingredient>): Recipe;
14
+ replaceResult(replace: Replacer<Result>): Recipe;
15
+ }
16
+ export default class HammeringRecipeParser extends RecipeParser<HammeringRecipeDefinition, HammeringRecipe> {
17
+ create(definition: HammeringRecipeDefinition): HammeringRecipe;
18
+ }
@@ -0,0 +1,27 @@
1
+ import RecipeParser, { Recipe } from "../index.js";
2
+ export class HammeringRecipe extends Recipe {
3
+ getIngredients() {
4
+ return this.definition.ingredients;
5
+ }
6
+ getResults() {
7
+ return [this.definition.result];
8
+ }
9
+ replaceIngredient(replace) {
10
+ return new HammeringRecipe({
11
+ ...this.definition,
12
+ ingredients: this.definition.ingredients.map(replace),
13
+ });
14
+ }
15
+ replaceResult(replace) {
16
+ return new HammeringRecipe({
17
+ ...this.definition,
18
+ result: replace(this.definition.result),
19
+ });
20
+ }
21
+ }
22
+ export default class HammeringRecipeParser extends RecipeParser {
23
+ create(definition) {
24
+ return new HammeringRecipe(definition);
25
+ }
26
+ }
27
+ //# sourceMappingURL=hammering.js.map