@adeficior/data-modifier 1.0.0-rc.11 → 1.0.0-rc.13

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 (236) hide show
  1. package/dist/common/id.d.ts +1 -0
  2. package/dist/common/id.js +4 -0
  3. package/dist/common/id.js.map +1 -1
  4. package/dist/common/ingredient/filter.d.ts +6 -0
  5. package/dist/common/ingredient/filter.js +97 -0
  6. package/dist/common/ingredient/filter.js.map +1 -0
  7. package/dist/common/ingredient/index.d.ts +74 -0
  8. package/dist/common/ingredient/index.js +112 -0
  9. package/dist/common/ingredient/index.js.map +1 -0
  10. package/dist/common/ingredient/input.d.ts +3 -0
  11. package/dist/common/ingredient/input.js +1 -0
  12. package/dist/common/ingredient/input.js.map +1 -0
  13. package/dist/common/ingredient/serializer.d.ts +17 -0
  14. package/dist/common/ingredient/serializer.js +112 -0
  15. package/dist/common/ingredient/serializer.js.map +1 -0
  16. package/dist/common/predicates.d.ts +2 -1
  17. package/dist/common/predicates.js.map +1 -1
  18. package/dist/common/result/filter.d.ts +6 -0
  19. package/dist/common/result/filter.js +68 -0
  20. package/dist/common/result/filter.js.map +1 -0
  21. package/dist/common/result/index.d.ts +41 -0
  22. package/dist/common/result/index.js +59 -0
  23. package/dist/common/result/index.js.map +1 -0
  24. package/dist/common/result/input.d.ts +3 -0
  25. package/dist/common/result/input.js +1 -0
  26. package/dist/common/result/input.js.map +1 -0
  27. package/dist/common/result/serializer.d.ts +15 -0
  28. package/dist/common/result/serializer.js +81 -0
  29. package/dist/common/result/serializer.js.map +1 -0
  30. package/dist/common/serializable.d.ts +6 -0
  31. package/dist/common/serializable.js +1 -0
  32. package/dist/common/serializable.js.map +1 -0
  33. package/dist/common/units.d.ts +1 -0
  34. package/dist/common/units.js +2 -0
  35. package/dist/common/units.js.map +1 -0
  36. package/dist/emit/blacklist.d.ts +4 -6
  37. package/dist/emit/blacklist.js +19 -21
  38. package/dist/emit/blacklist.js.map +1 -1
  39. package/dist/emit/data/loot.d.ts +6 -7
  40. package/dist/emit/data/loot.js +14 -13
  41. package/dist/emit/data/loot.js.map +1 -1
  42. package/dist/emit/data/recipe.d.ts +18 -16
  43. package/dist/emit/data/recipe.js +28 -22
  44. package/dist/emit/data/recipe.js.map +1 -1
  45. package/dist/emit/data/tags.d.ts +1 -1
  46. package/dist/emit/data/tags.js.map +1 -1
  47. package/dist/emit/polytoneTabs.d.ts +1 -1
  48. package/dist/emit/polytoneTabs.js +1 -2
  49. package/dist/emit/polytoneTabs.js.map +1 -1
  50. package/dist/emit/rule/lootTable.d.ts +2 -1
  51. package/dist/emit/rule/lootTable.js +4 -2
  52. package/dist/emit/rule/lootTable.js.map +1 -1
  53. package/dist/emit/rule/recipe.d.ts +4 -2
  54. package/dist/emit/rule/recipe.js.map +1 -1
  55. package/dist/emit/ruled.d.ts +2 -1
  56. package/dist/emit/ruled.js +5 -2
  57. package/dist/emit/ruled.js.map +1 -1
  58. package/dist/index.d.ts +1 -4
  59. package/dist/index.js +1 -2
  60. package/dist/index.js.map +1 -1
  61. package/dist/loader/context.d.ts +12 -0
  62. package/dist/loader/context.js +1 -0
  63. package/dist/loader/context.js.map +1 -0
  64. package/dist/loader/pack.d.ts +15 -8
  65. package/dist/loader/pack.js +43 -25
  66. package/dist/loader/pack.js.map +1 -1
  67. package/dist/loader/recipe.d.ts +8 -4
  68. package/dist/loader/recipe.js +41 -47
  69. package/dist/loader/recipe.js.map +1 -1
  70. package/dist/loader/registry/dump.d.ts +0 -2
  71. package/dist/loader/registry/dump.js +0 -11
  72. package/dist/loader/registry/dump.js.map +1 -1
  73. package/dist/loader/registry/index.d.ts +0 -2
  74. package/dist/loader/registry/wrapped.d.ts +13 -0
  75. package/dist/loader/registry/wrapped.js +26 -0
  76. package/dist/loader/registry/wrapped.js.map +1 -0
  77. package/dist/loader/tags.d.ts +1 -1
  78. package/dist/loader/tags.js.map +1 -1
  79. package/dist/packFormat.d.ts +11 -0
  80. package/dist/packFormat.js +59 -0
  81. package/dist/packFormat.js.map +1 -0
  82. package/dist/parser/adAstra.d.ts +5 -11
  83. package/dist/parser/adAstra.js +5 -5
  84. package/dist/parser/adAstra.js.map +1 -1
  85. package/dist/parser/botania.d.ts +10 -20
  86. package/dist/parser/botania.js +10 -10
  87. package/dist/parser/botania.js.map +1 -1
  88. package/dist/parser/create.d.ts +2 -4
  89. package/dist/parser/create.js +2 -2
  90. package/dist/parser/create.js.map +1 -1
  91. package/dist/parser/index.d.ts +6 -12
  92. package/dist/parser/index.js +6 -6
  93. package/dist/parser/index.js.map +1 -1
  94. package/dist/parser/lootTable.d.ts +7 -6
  95. package/dist/parser/lootTable.js +25 -23
  96. package/dist/parser/lootTable.js.map +1 -1
  97. package/dist/parser/recipe/adAstra/conversion.d.ts +15 -14
  98. package/dist/parser/recipe/adAstra/conversion.js +26 -19
  99. package/dist/parser/recipe/adAstra/conversion.js.map +1 -1
  100. package/dist/parser/recipe/adAstra/hammering.d.ts +3 -17
  101. package/dist/parser/recipe/adAstra/hammering.js +2 -25
  102. package/dist/parser/recipe/adAstra/hammering.js.map +1 -1
  103. package/dist/parser/recipe/adAstra/inputOutput.d.ts +16 -19
  104. package/dist/parser/recipe/adAstra/inputOutput.js +37 -29
  105. package/dist/parser/recipe/adAstra/inputOutput.js.map +1 -1
  106. package/dist/parser/recipe/adAstra/nasaWorkbench.d.ts +3 -19
  107. package/dist/parser/recipe/adAstra/nasaWorkbench.js +2 -28
  108. package/dist/parser/recipe/adAstra/nasaWorkbench.js.map +1 -1
  109. package/dist/parser/recipe/adAstra/spaceStation.d.ts +15 -14
  110. package/dist/parser/recipe/adAstra/spaceStation.js +33 -14
  111. package/dist/parser/recipe/adAstra/spaceStation.js.map +1 -1
  112. package/dist/parser/recipe/botania/apothecary.d.ts +17 -14
  113. package/dist/parser/recipe/botania/apothecary.js +26 -17
  114. package/dist/parser/recipe/botania/apothecary.js.map +1 -1
  115. package/dist/parser/recipe/botania/blocks.d.ts +21 -0
  116. package/dist/parser/recipe/botania/blocks.js +77 -0
  117. package/dist/parser/recipe/botania/blocks.js.map +1 -0
  118. package/dist/parser/recipe/botania/brew.d.ts +13 -12
  119. package/dist/parser/recipe/botania/brew.js +16 -11
  120. package/dist/parser/recipe/botania/brew.js.map +1 -1
  121. package/dist/parser/recipe/botania/elvenTrade.d.ts +8 -13
  122. package/dist/parser/recipe/botania/elvenTrade.js +11 -22
  123. package/dist/parser/recipe/botania/elvenTrade.js.map +1 -1
  124. package/dist/parser/recipe/botania/gogWrapper.d.ts +12 -12
  125. package/dist/parser/recipe/botania/gogWrapper.js +12 -13
  126. package/dist/parser/recipe/botania/gogWrapper.js.map +1 -1
  127. package/dist/parser/recipe/botania/manaInfusion.d.ts +18 -15
  128. package/dist/parser/recipe/botania/manaInfusion.js +29 -21
  129. package/dist/parser/recipe/botania/manaInfusion.js.map +1 -1
  130. package/dist/parser/recipe/botania/nbtWrapper.d.ts +12 -12
  131. package/dist/parser/recipe/botania/nbtWrapper.js +10 -11
  132. package/dist/parser/recipe/botania/nbtWrapper.js.map +1 -1
  133. package/dist/parser/recipe/botania/orechid.d.ts +3 -30
  134. package/dist/parser/recipe/botania/orechid.js +2 -72
  135. package/dist/parser/recipe/botania/orechid.js.map +1 -1
  136. package/dist/parser/recipe/botania/pureDaisy.d.ts +3 -18
  137. package/dist/parser/recipe/botania/pureDaisy.js +2 -28
  138. package/dist/parser/recipe/botania/pureDaisy.js.map +1 -1
  139. package/dist/parser/recipe/botania/runicAltar.d.ts +8 -13
  140. package/dist/parser/recipe/botania/runicAltar.js +11 -22
  141. package/dist/parser/recipe/botania/runicAltar.js.map +1 -1
  142. package/dist/parser/recipe/botania/terraPlate.d.ts +4 -16
  143. package/dist/parser/recipe/botania/terraPlate.js +2 -25
  144. package/dist/parser/recipe/botania/terraPlate.js.map +1 -1
  145. package/dist/parser/recipe/create/assembly.d.ts +18 -17
  146. package/dist/parser/recipe/create/assembly.js +27 -27
  147. package/dist/parser/recipe/create/assembly.js.map +1 -1
  148. package/dist/parser/recipe/create/processing.d.ts +4 -16
  149. package/dist/parser/recipe/create/processing.js +2 -25
  150. package/dist/parser/recipe/create/processing.js.map +1 -1
  151. package/dist/parser/recipe/farmersdelight/cooking.d.ts +16 -12
  152. package/dist/parser/recipe/farmersdelight/cooking.js +27 -15
  153. package/dist/parser/recipe/farmersdelight/cooking.js.map +1 -1
  154. package/dist/parser/recipe/farmersdelight/cutting.d.ts +14 -14
  155. package/dist/parser/recipe/farmersdelight/cutting.js +32 -29
  156. package/dist/parser/recipe/farmersdelight/cutting.js.map +1 -1
  157. package/dist/parser/recipe/forge/conditional.d.ts +10 -10
  158. package/dist/parser/recipe/forge/conditional.js +13 -17
  159. package/dist/parser/recipe/forge/conditional.js.map +1 -1
  160. package/dist/parser/recipe/index.d.ts +21 -12
  161. package/dist/parser/recipe/index.js +10 -3
  162. package/dist/parser/recipe/index.js.map +1 -1
  163. package/dist/parser/recipe/ingredientMap.d.ts +12 -0
  164. package/dist/parser/recipe/ingredientMap.js +17 -0
  165. package/dist/parser/recipe/ingredientMap.js.map +1 -0
  166. package/dist/parser/recipe/manyToMany.d.ts +20 -0
  167. package/dist/parser/recipe/manyToMany.js +33 -0
  168. package/dist/parser/recipe/manyToMany.js.map +1 -0
  169. package/dist/parser/recipe/manyToOne.d.ts +20 -0
  170. package/dist/parser/recipe/manyToOne.js +33 -0
  171. package/dist/parser/recipe/manyToOne.js.map +1 -0
  172. package/dist/parser/recipe/oneToOne.d.ts +20 -0
  173. package/dist/parser/recipe/oneToOne.js +33 -0
  174. package/dist/parser/recipe/oneToOne.js.map +1 -0
  175. package/dist/parser/recipe/roots/component.d.ts +13 -12
  176. package/dist/parser/recipe/roots/component.js +16 -11
  177. package/dist/parser/recipe/roots/component.js.map +1 -1
  178. package/dist/parser/recipe/roots/ritual.d.ts +14 -15
  179. package/dist/parser/recipe/roots/ritual.js +18 -25
  180. package/dist/parser/recipe/roots/ritual.js.map +1 -1
  181. package/dist/parser/recipe/sullys/polishing.d.ts +4 -16
  182. package/dist/parser/recipe/sullys/polishing.js +2 -25
  183. package/dist/parser/recipe/sullys/polishing.js.map +1 -1
  184. package/dist/parser/recipe/thermal/catalyst.d.ts +13 -12
  185. package/dist/parser/recipe/thermal/catalyst.js +16 -11
  186. package/dist/parser/recipe/thermal/catalyst.js.map +1 -1
  187. package/dist/parser/recipe/thermal/fuel.d.ts +13 -12
  188. package/dist/parser/recipe/thermal/fuel.js +17 -11
  189. package/dist/parser/recipe/thermal/fuel.js.map +1 -1
  190. package/dist/parser/recipe/thermal/index.d.ts +16 -14
  191. package/dist/parser/recipe/thermal/index.js +35 -24
  192. package/dist/parser/recipe/thermal/index.js.map +1 -1
  193. package/dist/parser/recipe/thermal/ingredient.d.ts +4 -21
  194. package/dist/parser/recipe/thermal/ingredient.js +40 -33
  195. package/dist/parser/recipe/thermal/ingredient.js.map +1 -1
  196. package/dist/parser/recipe/thermal/treeExtraction.d.ts +17 -17
  197. package/dist/parser/recipe/thermal/treeExtraction.js +29 -30
  198. package/dist/parser/recipe/thermal/treeExtraction.js.map +1 -1
  199. package/dist/parser/recipe/vanilla/shaped.d.ts +17 -13
  200. package/dist/parser/recipe/vanilla/shaped.js +21 -16
  201. package/dist/parser/recipe/vanilla/shaped.js.map +1 -1
  202. package/dist/parser/recipe/vanilla/shapeless.d.ts +3 -17
  203. package/dist/parser/recipe/vanilla/shapeless.js +2 -25
  204. package/dist/parser/recipe/vanilla/shapeless.js.map +1 -1
  205. package/dist/parser/recipe/vanilla/smelting.d.ts +16 -13
  206. package/dist/parser/recipe/vanilla/smelting.js +21 -15
  207. package/dist/parser/recipe/vanilla/smelting.js.map +1 -1
  208. package/dist/parser/recipe/vanilla/smithing.d.ts +18 -14
  209. package/dist/parser/recipe/vanilla/smithing.js +25 -16
  210. package/dist/parser/recipe/vanilla/smithing.js.map +1 -1
  211. package/dist/parser/recipe/vanilla/stonecutting.d.ts +15 -13
  212. package/dist/parser/recipe/vanilla/stonecutting.js +22 -24
  213. package/dist/parser/recipe/vanilla/stonecutting.js.map +1 -1
  214. package/dist/parser/roots.d.ts +2 -4
  215. package/dist/parser/roots.js +2 -2
  216. package/dist/parser/roots.js.map +1 -1
  217. package/dist/parser/thermal.d.ts +4 -10
  218. package/dist/parser/thermal.js +4 -5
  219. package/dist/parser/thermal.js.map +1 -1
  220. package/dist/schema/data/recipe.d.ts +2 -1
  221. package/package.json +3 -2
  222. package/dist/common/ingredient.d.ts +0 -49
  223. package/dist/common/ingredient.js +0 -108
  224. package/dist/common/ingredient.js.map +0 -1
  225. package/dist/common/result.d.ts +0 -48
  226. package/dist/common/result.js +0 -37
  227. package/dist/common/result.js.map +0 -1
  228. package/dist/parser/recipe/adAstra/index.d.ts +0 -5
  229. package/dist/parser/recipe/adAstra/index.js +0 -1
  230. package/dist/parser/recipe/adAstra/index.js.map +0 -1
  231. package/dist/parser/recipe/ignored.d.ts +0 -10
  232. package/dist/parser/recipe/ignored.js +0 -16
  233. package/dist/parser/recipe/ignored.js.map +0 -1
  234. package/dist/parser/recipe/quark/exclusion.d.ts +0 -20
  235. package/dist/parser/recipe/quark/exclusion.js +0 -32
  236. package/dist/parser/recipe/quark/exclusion.js.map +0 -1
@@ -1,24 +1,24 @@
1
- import type { Replacer } from "../index.js";
2
- import RecipeParser, { Recipe } from "../index.js";
3
- import type { Ingredient, IngredientInput } from "../../../common/ingredient.js";
1
+ import type { BlockId } from "@adeficior/data-modifier/generated";
2
+ import { type Ingredient } from "../../../common/ingredient/index.js";
3
+ import type { Result } from "../../../common/result/index.js";
4
4
  import type { RecipeDefinition } from "../../../schema/data/recipe.js";
5
- import type { ResultInput } from "../../../common/result.js";
6
- type ExtractionBlockInput = string;
5
+ import RecipeParser, { Recipe, type RecipeParseContext, type Replacer } from "../index.js";
7
6
  export type TreeExtractionRecipeDefinition = RecipeDefinition & Readonly<{
8
- leaves: ExtractionBlockInput;
9
- trunk: ExtractionBlockInput;
10
- result: ResultInput;
7
+ leaves: BlockId;
8
+ trunk: BlockId;
9
+ result: unknown;
11
10
  }>;
12
- export declare class TreeExtractionRecipe extends Recipe<TreeExtractionRecipeDefinition> {
11
+ export declare class TreeExtractionRecipe extends Recipe {
13
12
  private readonly trunk;
14
13
  private readonly leaves;
15
- constructor(definition: TreeExtractionRecipeDefinition);
16
- getIngredients(): IngredientInput[];
17
- getResults(): ResultInput[];
18
- replaceIngredient(replace: Replacer<Ingredient>): Recipe;
19
- replaceResult(): TreeExtractionRecipe;
14
+ private readonly result;
15
+ constructor(definition: RecipeDefinition, trunk: Ingredient, leaves: Ingredient, result: Result);
16
+ getIngredients(): Ingredient[];
17
+ getResults(): Result[];
18
+ replace(ingredientReplacer: Replacer<Ingredient>, resultReplacer: Replacer<Result>): TreeExtractionRecipe;
19
+ private serializeBlockIngredient;
20
+ serialize(context: RecipeParseContext): Partial<TreeExtractionRecipeDefinition>;
20
21
  }
21
- export default class TreeExtractionRecipeParser extends RecipeParser<TreeExtractionRecipeDefinition, TreeExtractionRecipe> {
22
- create(definition: TreeExtractionRecipeDefinition): TreeExtractionRecipe;
22
+ export declare class TreeExtractionRecipeParser extends RecipeParser<TreeExtractionRecipeDefinition, TreeExtractionRecipe> {
23
+ deserialize(definition: TreeExtractionRecipeDefinition, context: RecipeParseContext): TreeExtractionRecipe;
23
24
  }
24
- export {};
@@ -1,47 +1,46 @@
1
- import RecipeParser, { Recipe } from "../index.js";
1
+ import { encodeId } from "../../../common/id.js";
2
+ import { BlockIngredient, } from "../../../common/ingredient/index.js";
2
3
  import { IllegalShapeError } from "../../../error.js";
3
- function blockToIngredient(input) {
4
- if (typeof input !== "string")
5
- throw new IllegalShapeError("unknown block input shape", input);
6
- return {
7
- block: input,
8
- };
9
- }
10
- function ingredientToBlock(input) {
11
- if (input && typeof input === "object") {
12
- if ("block" in input)
13
- return input.block;
14
- }
15
- throw new IllegalShapeError("unknown block input shape", input);
16
- }
4
+ import RecipeParser, { Recipe, } from "../index.js";
17
5
  export class TreeExtractionRecipe extends Recipe {
18
6
  trunk;
19
7
  leaves;
20
- constructor(definition) {
8
+ result;
9
+ constructor(definition, trunk, leaves, result) {
21
10
  super(definition);
22
- this.trunk = blockToIngredient(definition.trunk);
23
- this.leaves = blockToIngredient(definition.leaves);
11
+ this.trunk = trunk;
12
+ this.leaves = leaves;
13
+ this.result = result;
24
14
  }
25
15
  getIngredients() {
26
16
  return [this.trunk, this.leaves];
27
17
  }
28
18
  getResults() {
29
- return [];
19
+ return [this.result];
20
+ }
21
+ replace(ingredientReplacer, resultReplacer) {
22
+ return new TreeExtractionRecipe(this.definition, ingredientReplacer(this.trunk), ingredientReplacer(this.leaves), resultReplacer(this.result));
30
23
  }
31
- replaceIngredient(replace) {
32
- return new TreeExtractionRecipe({
33
- ...this.definition,
34
- leaves: ingredientToBlock(replace(this.leaves)),
35
- trunk: ingredientToBlock(replace(this.trunk)),
36
- });
24
+ serializeBlockIngredient(ingredient) {
25
+ if (ingredient instanceof BlockIngredient) {
26
+ return encodeId(ingredient.id);
27
+ }
28
+ throw new IllegalShapeError("tree extraction recipes ingredients need to be blocks", ingredient);
37
29
  }
38
- replaceResult() {
39
- return new TreeExtractionRecipe(this.definition);
30
+ serialize(context) {
31
+ return {
32
+ result: context.results.serialize(this.result),
33
+ trunk: this.serializeBlockIngredient(this.trunk),
34
+ leaves: this.serializeBlockIngredient(this.leaves),
35
+ };
40
36
  }
41
37
  }
42
- export default class TreeExtractionRecipeParser extends RecipeParser {
43
- create(definition) {
44
- return new TreeExtractionRecipe(definition);
38
+ export class TreeExtractionRecipeParser extends RecipeParser {
39
+ deserialize(definition, context) {
40
+ const trunk = context.ingredients.create(new BlockIngredient(definition.trunk));
41
+ const leaves = context.ingredients.create(new BlockIngredient(definition.leaves));
42
+ const result = context.results.create(definition.result);
43
+ return new TreeExtractionRecipe(definition, trunk, leaves, result);
45
44
  }
46
45
  }
47
46
  //# sourceMappingURL=treeExtraction.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"treeExtraction.js","sourceRoot":"","s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/B,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAC5B,CAAC;IACJ,CAAC;IAEO,wBAAwB,CAAC,UAAsB;QACrD,IAAI,UAAU,YAAY,eAAe,EAAE,CAAC;YAC1C,OAAO,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QACjC,CAAC;QAED,MAAM,IAAI,iBAAiB,CACzB,uDAAuD,EACvD,UAAU,CACX,CAAC;IACJ,CAAC;IAEQ,SAAS,CAChB,OAA2B;QAE3B,OAAO;YACL,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC;YAC9C,KAAK,EAAE,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,KAAK,CAAC;YAChD,MAAM,EAAE,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,MAAM,CAAC;SACnD,CAAC;IACJ,CAAC;CACF;AAED,MAAM,OAAO,0BAA2B,SAAQ,YAG/C;IACC,WAAW,CACT,UAA0C,EAC1C,OAA2B;QAE3B,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CACtC,IAAI,eAAe,CAAC,UAAU,CAAC,KAAK,CAAC,CACtC,CAAC;QACF,MAAM,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CACvC,IAAI,eAAe,CAAC,UAAU,CAAC,MAAM,CAAC,CACvC,CAAC;QACF,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACzD,OAAO,IAAI,oBAAoB,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACrE,CAAC;CACF"}
@@ -1,19 +1,23 @@
1
- import type { Replacer } from "../index.js";
2
- import RecipeParser, { Recipe } from "../index.js";
3
- import type { Ingredient, IngredientInput } from "../../../common/ingredient.js";
1
+ import type { Ingredient } from "../../../common/ingredient/index.js";
2
+ import type { Result } from "../../../common/result/index.js";
4
3
  import type { RecipeDefinition } from "../../../schema/data/recipe.js";
5
- import type { Result, ResultInput } from "../../../common/result.js";
4
+ import type { RecipeParseContext, Replacer } from "../index.js";
5
+ import RecipeParser, { Recipe } from "../index.js";
6
+ import type { IngredientMap, IngredientMapInput } from "../ingredientMap.js";
6
7
  export type ShapedRecipeDefinition = RecipeDefinition & Readonly<{
7
- key: Record<string, Ingredient>;
8
+ key: IngredientMapInput;
8
9
  pattern: string[];
9
- result: Result;
10
+ result: unknown;
10
11
  }>;
11
- export declare class ShapedRecipe extends Recipe<ShapedRecipeDefinition> {
12
- getIngredients(): IngredientInput[];
13
- getResults(): ResultInput[];
14
- replaceIngredient(replace: Replacer<Ingredient>): Recipe;
15
- replaceResult(replace: Replacer<Result>): Recipe;
12
+ export declare class ShapedRecipe extends Recipe {
13
+ private readonly ingredients;
14
+ private readonly result;
15
+ constructor(definition: RecipeDefinition, ingredients: IngredientMap, result: Result);
16
+ getIngredients(): Ingredient[];
17
+ getResults(): Result[];
18
+ replace(ingredientReplacer: Replacer<Ingredient>, resultReplacer: Replacer<Result>): ShapedRecipe;
19
+ serialize(context: RecipeParseContext): Partial<ShapedRecipeDefinition>;
16
20
  }
17
- export default class ShapedParser extends RecipeParser<ShapedRecipeDefinition, ShapedRecipe> {
18
- create(definition: ShapedRecipeDefinition): ShapedRecipe;
21
+ export declare class ShapedParser extends RecipeParser<ShapedRecipeDefinition, ShapedRecipe> {
22
+ deserialize(definition: ShapedRecipeDefinition, context: RecipeParseContext): ShapedRecipe;
19
23
  }
@@ -1,28 +1,33 @@
1
1
  import RecipeParser, { Recipe } from "../index.js";
2
- import { mapValues } from "lodash-es";
3
2
  export class ShapedRecipe extends Recipe {
3
+ ingredients;
4
+ result;
5
+ constructor(definition, ingredients, result) {
6
+ super(definition);
7
+ this.ingredients = ingredients;
8
+ this.result = result;
9
+ }
4
10
  getIngredients() {
5
- return Object.values(this.definition.key);
11
+ return this.ingredients.list();
6
12
  }
7
13
  getResults() {
8
- return [this.definition.result];
14
+ return [this.result];
9
15
  }
10
- replaceIngredient(replace) {
11
- return new ShapedRecipe({
12
- ...this.definition,
13
- key: mapValues(this.definition.key, replace),
14
- });
16
+ replace(ingredientReplacer, resultReplacer) {
17
+ return new ShapedRecipe(this.definition, this.ingredients.replace(ingredientReplacer), resultReplacer(this.result));
15
18
  }
16
- replaceResult(replace) {
17
- return new ShapedRecipe({
18
- ...this.definition,
19
- result: replace(this.definition.result),
20
- });
19
+ serialize(context) {
20
+ return {
21
+ key: this.ingredients.serialize(context),
22
+ result: context.results.serialize(this.result),
23
+ };
21
24
  }
22
25
  }
23
- export default class ShapedParser extends RecipeParser {
24
- create(definition) {
25
- return new ShapedRecipe(definition);
26
+ export class ShapedParser extends RecipeParser {
27
+ deserialize(definition, context) {
28
+ const ingredients = context.ingredients.ingredientMap(definition.key);
29
+ const result = context.results.create(definition.result);
30
+ return new ShapedRecipe(definition, ingredients, result);
26
31
  }
27
32
  }
28
33
  //# sourceMappingURL=shaped.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shaped.js","sourceRoot":"","sources":["../../../../src/parser/recipe/vanilla/shaped.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAMnD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAUtC,MAAM,OAAO,YAAa,SAAQ,MAA8B;IAC9D,cAAc;QACZ,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAC5C,CAAC;IAED,UAAU;QACR,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IAED,iBAAiB,CAAC,OAA6B;QAC7C,OAAO,IAAI,YAAY,CAAC;YACtB,GAAG,IAAI,CAAC,UAAU;YAClB,GAAG,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC;SAC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,MAAM,CAAC;SAC/C,CAAC;IACJ,CAAC;CACF;AAED,MAAM,OAAO,YAAa,SAAQ,YAGjC;IACC,WAAW,CACT,UAAkC,EAClC,OAA2B;QAE3B,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACtE,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACzD,OAAO,IAAI,YAAY,CAAC,UAAU,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;IAC3D,CAAC;CACF"}
@@ -1,18 +1,4 @@
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 ShapelessRecipeDefinition = RecipeDefinition & Readonly<{
7
- ingredients: Ingredient[];
8
- result: Result;
9
- }>;
10
- export declare class ShapelessRecipe extends Recipe<ShapelessRecipeDefinition> {
11
- getIngredients(): IngredientInput[];
12
- getResults(): ResultInput[];
13
- replaceIngredient(replace: Replacer<Ingredient>): Recipe;
14
- replaceResult(replace: Replacer<Result>): Recipe;
15
- }
16
- export default class ShapelessParser extends RecipeParser<ShapelessRecipeDefinition, ShapelessRecipe> {
17
- create(definition: ShapelessRecipeDefinition): ShapelessRecipe;
1
+ import { ManyToOneRecipeParser, type ManyToOneRecipeDefinition } from "../manyToOne.js";
2
+ export type ShapelessRecipeDefinition = ManyToOneRecipeDefinition;
3
+ export declare class ShapelessParser extends ManyToOneRecipeParser<ShapelessRecipeDefinition> {
18
4
  }
@@ -1,27 +1,4 @@
1
- import RecipeParser, { Recipe } from "../index.js";
2
- export class ShapelessRecipe extends Recipe {
3
- getIngredients() {
4
- return this.definition.ingredients;
5
- }
6
- getResults() {
7
- return [this.definition.result];
8
- }
9
- replaceIngredient(replace) {
10
- return new ShapelessRecipe({
11
- ...this.definition,
12
- ingredients: this.definition.ingredients.map(replace),
13
- });
14
- }
15
- replaceResult(replace) {
16
- return new ShapelessRecipe({
17
- ...this.definition,
18
- result: replace(this.definition.result),
19
- });
20
- }
21
- }
22
- export default class ShapelessParser extends RecipeParser {
23
- create(definition) {
24
- return new ShapelessRecipe(definition);
25
- }
1
+ import { ManyToOneRecipeParser, } from "../manyToOne.js";
2
+ export class ShapelessParser extends ManyToOneRecipeParser {
26
3
  }
27
4
  //# sourceMappingURL=shapeless.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shapeless.js","sourceRoot":"","sources":["../../../../src/parser/recipe/vanilla/shapeless.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAcnD,MAAM,OAAO,eAAgB,SAAQ,MAAiC;IACpE,cAAc;QACZ,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;IACrC,CAAC;IAED,UAAU;QACR,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IAED,iBAAiB,CAAC,OAA6B;QAC7C,OAAO,IAAI,eAAe,CAAC;YACzB,GAAG,IAAI,CAAC,UAAU;YAClB,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC;SACtD,CAAC,CAAC;IACL,CAAC;IAED,aAAa,CAAC,OAAyB;QACrC,OAAO,IAAI,eAAe,CAAC;YACzB,GAAG,IAAI,CAAC,UAAU;YAClB,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;SACxC,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,YAG5C;IACC,MAAM,CAAC,UAAqC;QAC1C,OAAO,IAAI,eAAe,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC;CACF"}
1
+ {"version":3,"file":"shapeless.js","sourceRoot":"","sources":["../../../../src/parser/recipe/vanilla/shapeless.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,GAEtB,MAAM,iBAAiB,CAAC;AAIzB,MAAM,OAAO,eAAgB,SAAQ,qBAAgD;CAAG"}
@@ -1,19 +1,22 @@
1
- import type { Replacer } from "../index.js";
2
- import RecipeParser, { Recipe } from "../index.js";
3
- import type { Ingredient, IngredientInput } from "../../../common/ingredient.js";
1
+ import type { Ingredient } from "../../../common/ingredient/index.js";
2
+ import type { Result } from "../../../common/result/index.js";
4
3
  import type { RecipeDefinition } from "../../../schema/data/recipe.js";
5
- import type { Result, ResultInput } from "../../../common/result.js";
4
+ import type { RecipeParseContext, Replacer } from "../index.js";
5
+ import RecipeParser, { Recipe } from "../index.js";
6
6
  export type SmeltingRecipeDefinition = RecipeDefinition & Readonly<{
7
- ingredient: Ingredient;
8
- result: Result;
7
+ ingredient: unknown;
8
+ result: unknown;
9
9
  experience?: number;
10
10
  }>;
11
- export declare class SmeltingRecipe extends Recipe<SmeltingRecipeDefinition> {
12
- getIngredients(): IngredientInput[];
13
- getResults(): ResultInput[];
14
- replaceIngredient(replace: Replacer<Ingredient>): Recipe;
15
- replaceResult(replace: Replacer<Result>): Recipe;
11
+ export declare class SmeltingRecipe extends Recipe {
12
+ private readonly ingredient;
13
+ private readonly result;
14
+ constructor(definition: RecipeDefinition, ingredient: Ingredient, result: Result);
15
+ getIngredients(): Ingredient[];
16
+ getResults(): Result[];
17
+ replace(ingredientReplacer: Replacer<Ingredient>, resultReplacer: Replacer<Result>): SmeltingRecipe;
18
+ serialize(context: RecipeParseContext): Partial<SmeltingRecipeDefinition>;
16
19
  }
17
- export default class SmeltingParser extends RecipeParser<SmeltingRecipeDefinition, SmeltingRecipe> {
18
- create(definition: SmeltingRecipeDefinition): SmeltingRecipe;
20
+ export declare class SmeltingParser extends RecipeParser<SmeltingRecipeDefinition, SmeltingRecipe> {
21
+ deserialize(definition: SmeltingRecipeDefinition, context: RecipeParseContext): SmeltingRecipe;
19
22
  }
@@ -1,27 +1,33 @@
1
1
  import RecipeParser, { Recipe } from "../index.js";
2
2
  export class SmeltingRecipe extends Recipe {
3
+ ingredient;
4
+ result;
5
+ constructor(definition, ingredient, result) {
6
+ super(definition);
7
+ this.ingredient = ingredient;
8
+ this.result = result;
9
+ }
3
10
  getIngredients() {
4
- return [this.definition.ingredient];
11
+ return [this.ingredient];
5
12
  }
6
13
  getResults() {
7
- return [this.definition.result];
14
+ return [this.result];
8
15
  }
9
- replaceIngredient(replace) {
10
- return new SmeltingRecipe({
11
- ...this.definition,
12
- ingredient: replace(this.definition.ingredient),
13
- });
16
+ replace(ingredientReplacer, resultReplacer) {
17
+ return new SmeltingRecipe(this.definition, ingredientReplacer(this.ingredient), resultReplacer(this.result));
14
18
  }
15
- replaceResult(replace) {
16
- return new SmeltingRecipe({
17
- ...this.definition,
18
- result: replace(this.definition.result),
19
- });
19
+ serialize(context) {
20
+ return {
21
+ ingredient: context.ingredients.serialize(this.ingredient),
22
+ result: context.results.serialize(this.result),
23
+ };
20
24
  }
21
25
  }
22
- export default class SmeltingParser extends RecipeParser {
23
- create(definition) {
24
- return new SmeltingRecipe(definition);
26
+ export class SmeltingParser extends RecipeParser {
27
+ deserialize(definition, context) {
28
+ const ingredient = context.ingredients.create(definition.ingredient);
29
+ const result = context.results.create(definition.result);
30
+ return new SmeltingRecipe(definition, ingredient, result);
25
31
  }
26
32
  }
27
33
  //# sourceMappingURL=smelting.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"smelting.js","sourceRoot":"","sources":["../../../../src/parser/recipe/vanilla/smelting.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAenD,MAAM,OAAO,cAAe,SAAQ,MAAgC;IAClE,cAAc;QACZ,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC;IAED,U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AAC,MAAM,CAAC,CAC5B,CAAC;IACJ,CAAC;IAEQ,SAAS,CAChB,OAA2B;QAE3B,OAAO;YACL,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC;YAC1D,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC;SAC/C,CAAC;IACJ,CAAC;CACF;AAED,MAAM,OAAO,cAAe,SAAQ,YAGnC;IACC,WAAW,CACT,UAAoC,EACpC,OAA2B;QAE3B,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QACrE,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACzD,OAAO,IAAI,cAAc,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IAC5D,CAAC;CACF"}
@@ -1,19 +1,23 @@
1
- import type { Replacer } from "../index.js";
2
- import RecipeParser, { Recipe } from "../index.js";
3
- import type { Ingredient, IngredientInput } from "../../../common/ingredient.js";
1
+ import type { Ingredient } from "../../../common/ingredient/index.js";
2
+ import type { Result } from "../../../common/result/index.js";
4
3
  import type { RecipeDefinition } from "../../../schema/data/recipe.js";
5
- import type { Result, ResultInput } from "../../../common/result.js";
4
+ import type { RecipeParseContext, Replacer } from "../index.js";
5
+ import RecipeParser, { Recipe } from "../index.js";
6
6
  export type SmithingRecipeDefinition = RecipeDefinition & Readonly<{
7
- base: Ingredient;
8
- addition: Ingredient;
9
- result: Result;
7
+ base: unknown;
8
+ addition: unknown;
9
+ result: unknown;
10
10
  }>;
11
- export declare class SmithingRecipe extends Recipe<SmithingRecipeDefinition> {
12
- getIngredients(): IngredientInput[];
13
- getResults(): ResultInput[];
14
- replaceIngredient(replace: Replacer<Ingredient>): Recipe;
15
- replaceResult(replace: Replacer<Result>): Recipe;
11
+ export declare class SmithingRecipe extends Recipe {
12
+ private readonly base;
13
+ private readonly addition;
14
+ private readonly result;
15
+ constructor(definition: RecipeDefinition, base: Ingredient, addition: Ingredient, result: Result);
16
+ getIngredients(): Ingredient[];
17
+ getResults(): Result[];
18
+ replace(ingredientReplacer: Replacer<Ingredient>, resultReplacer: Replacer<Result>): SmithingRecipe;
19
+ serialize(context: RecipeParseContext): Partial<SmithingRecipeDefinition>;
16
20
  }
17
- export default class SmithingParser extends RecipeParser<SmithingRecipeDefinition, SmithingRecipe> {
18
- create(definition: SmithingRecipeDefinition): SmithingRecipe;
21
+ export declare class SmithingParser extends RecipeParser<SmithingRecipeDefinition, SmithingRecipe> {
22
+ deserialize(definition: SmithingRecipeDefinition, context: RecipeParseContext): SmithingRecipe;
19
23
  }
@@ -1,28 +1,37 @@
1
1
  import RecipeParser, { Recipe } from "../index.js";
2
2
  export class SmithingRecipe extends Recipe {
3
+ base;
4
+ addition;
5
+ result;
6
+ constructor(definition, base, addition, result) {
7
+ super(definition);
8
+ this.base = base;
9
+ this.addition = addition;
10
+ this.result = result;
11
+ }
3
12
  getIngredients() {
4
- return [this.definition.base, this.definition.addition];
13
+ return [this.base, this.addition];
5
14
  }
6
15
  getResults() {
7
- return [this.definition.result];
16
+ return [this.result];
8
17
  }
9
- replaceIngredient(replace) {
10
- return new SmithingRecipe({
11
- ...this.definition,
12
- base: replace(this.definition.base),
13
- addition: replace(this.definition.addition),
14
- });
18
+ replace(ingredientReplacer, resultReplacer) {
19
+ return new SmithingRecipe(this.definition, ingredientReplacer(this.base), ingredientReplacer(this.addition), resultReplacer(this.result));
15
20
  }
16
- replaceResult(replace) {
17
- return new SmithingRecipe({
18
- ...this.definition,
19
- result: replace(this.definition.result),
20
- });
21
+ serialize(context) {
22
+ return {
23
+ base: context.ingredients.serialize(this.base),
24
+ addition: context.ingredients.serialize(this.addition),
25
+ result: context.results.serialize(this.result),
26
+ };
21
27
  }
22
28
  }
23
- export default class SmithingParser extends RecipeParser {
24
- create(definition) {
25
- return new SmithingRecipe(definition);
29
+ export class SmithingParser extends RecipeParser {
30
+ deserialize(definition, context) {
31
+ const base = context.ingredients.create(definition.base);
32
+ const addition = context.ingredients.create(definition.addition);
33
+ const result = context.results.create(definition.result);
34
+ return new SmithingRecipe(definition, base, addition, result);
26
35
  }
27
36
  }
28
37
  //# sourceMappingURL=smithing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"smithing.js","sourceRoot":"","sources":["../../../../src/parser/recipe/vanilla/smithing.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAenD,MAAM,OAAO,cAAe,SAAQ,MAAgC;IAClE,cAAc;QACZ,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC1D,CAAC;IAED,UAAU;QACR,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IAED,iBAAiB,CAAC,OAA6B;QAC7C,OAAO,IAAI,cAAc,CAAC;YACxB,GAAG,IAAI,CAAC,UAAU;YAClB,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YACnC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;SAC5C,CAAC,CAAC;IACL,CAAC;IAED,aAAa,CAAC,OAAyB;QACrC,OAAO,IAAI,cAAc,CAAC;YACxB,GAAG,IAAI,CAAC,UAAU;YAClB,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;SACxC,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,YAG3C;IACC,MAAM,CAAC,UAAoC;QACzC,OAAO,IAAI,cAAc,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC;CACF"}
1
+ {"version":3,"file":"smithing.js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UAAU,CAAC,IAAI,CAAC,CAAC;QACzD,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QACjE,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACzD,OAAO,IAAI,cAAc,CAAC,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAChE,CAAC;CACF"}
@@ -1,20 +1,22 @@
1
- import type { ItemId } from "@adeficior/data-modifier/generated";
2
- import type { Ingredient, IngredientInput } from "../../../common/ingredient.js";
3
- import type { Result, ResultInput } from "../../../common/result.js";
1
+ import type { Ingredient } from "../../../common/ingredient/index.js";
2
+ import type { Result } from "../../../common/result/index.js";
4
3
  import type { RecipeDefinition } from "../../../schema/data/recipe.js";
5
- import type { Replacer } from "../index.js";
4
+ import type { RecipeParseContext, Replacer } from "../index.js";
6
5
  import RecipeParser, { Recipe } from "../index.js";
7
6
  export type StonecuttingRecipeDefinition = RecipeDefinition & Readonly<{
8
- ingredient: Ingredient;
9
- result: ItemId;
7
+ ingredient: unknown;
8
+ result: unknown;
10
9
  count?: number;
11
10
  }>;
12
- export declare class StonecuttingRecipe extends Recipe<StonecuttingRecipeDefinition> {
13
- getIngredients(): IngredientInput[];
14
- getResults(): ResultInput[];
15
- replaceIngredient(replace: Replacer<Ingredient>): Recipe;
16
- replaceResult(replace: Replacer<Result>): Recipe;
11
+ export declare class StonecuttingRecipe extends Recipe {
12
+ private readonly ingredient;
13
+ private readonly result;
14
+ constructor(definition: RecipeDefinition, ingredient: Ingredient, result: Result);
15
+ getIngredients(): Ingredient[];
16
+ getResults(): Result[];
17
+ replace(ingredientReplacer: Replacer<Ingredient>, resultReplacer: Replacer<Result>): StonecuttingRecipe;
18
+ serialize(context: RecipeParseContext): Partial<StonecuttingRecipeDefinition>;
17
19
  }
18
- export default class StonecuttingParser extends RecipeParser<StonecuttingRecipeDefinition, StonecuttingRecipe> {
19
- create(definition: StonecuttingRecipeDefinition): StonecuttingRecipe;
20
+ export declare class StonecuttingParser extends RecipeParser<StonecuttingRecipeDefinition, StonecuttingRecipe> {
21
+ deserialize(definition: StonecuttingRecipeDefinition, context: RecipeParseContext): StonecuttingRecipe;
20
22
  }
@@ -1,36 +1,34 @@
1
- import { encodeId } from "../../../common/id.js";
2
- import { createResult } from "../../../common/result.js";
3
- import { IllegalShapeError } from "../../../error.js";
4
1
  import RecipeParser, { Recipe } from "../index.js";
2
+ // TODO could also be SmeltingRecipe?
5
3
  export class StonecuttingRecipe extends Recipe {
4
+ ingredient;
5
+ result;
6
+ constructor(definition, ingredient, result) {
7
+ super(definition);
8
+ this.ingredient = ingredient;
9
+ this.result = result;
10
+ }
6
11
  getIngredients() {
7
- return [this.definition.ingredient];
12
+ return [this.ingredient];
8
13
  }
9
14
  getResults() {
10
- return [
11
- { item: encodeId(this.definition.result), count: this.definition.count },
12
- ];
15
+ return [this.result];
13
16
  }
14
- replaceIngredient(replace) {
15
- return new StonecuttingRecipe({
16
- ...this.definition,
17
- ingredient: replace(this.definition.ingredient),
18
- });
17
+ replace(ingredientReplacer, resultReplacer) {
18
+ return new StonecuttingRecipe(this.definition, ingredientReplacer(this.ingredient), resultReplacer(this.result));
19
19
  }
20
- replaceResult(replace) {
21
- const result = createResult(replace);
22
- if (!("item" in result))
23
- throw new IllegalShapeError("stonecutting does only support item results", result);
24
- return new StonecuttingRecipe({
25
- ...this.definition,
26
- result: result.item,
27
- count: result.count ?? 1,
28
- });
20
+ serialize(context) {
21
+ return {
22
+ ingredient: context.ingredients.serialize(this.ingredient),
23
+ result: context.ingredients.serialize(this.result),
24
+ };
29
25
  }
30
26
  }
31
- export default class StonecuttingParser extends RecipeParser {
32
- create(definition) {
33
- return new StonecuttingRecipe(definition);
27
+ export class StonecuttingParser extends RecipeParser {
28
+ deserialize(definition, context) {
29
+ const ingredient = context.ingredients.create(definition.ingredient);
30
+ const result = context.results.create(definition.result);
31
+ return new StonecuttingRecipe(definition, ingredient, result);
34
32
  }
35
33
  }
36
34
  //# sourceMappingURL=stonecutting.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stonecutting.js","sourceRoot":"","sources":["../../../../src/parser/recipe/vanilla/stonecutting.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAMjD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGtD,OAAO,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AASnD,MAAM,OAAO,kBAAmB,SAAQ,MAAoC;IAC1E,cAAc;QACZ,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC;IAED,UAAU;QACR,OAAO;YACL,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE;SACzE,CAAC;IACJ,CAAC;IAED,iBAAiB,CAAC,OAA6B;QAC7C,OAAO,IAAI,kBAAkB,CAAC;YAC5B,GAAG,IAAI,CAAC,UAAU;YAClB,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;SAChD,CAAC,CAAC;IACL,CAAC;IAED,aAAa,CAAC,OAAyB;QACrC,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;QACrC,IAAI,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC;YACrB,MAAM,IAAI,iBAAiB,CACzB,6CAA6C,EAC7C,MAAM,CACP,CAAC;QAEJ,OAAO,IAAI,kBAAkB,CAAC;YAC5B,GAAG,IAAI,CAAC,UAAU;YAClB,MAAM,EAAE,MAAM,CAAC,IAAI;YACnB,KAAK,EAAE,MAAM,CAAC,KAA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GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QACrE,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACzD,OAAO,IAAI,kBAAkB,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IAChE,CAAC;CACF"}
@@ -1,4 +1,2 @@
1
- export type { RootRitualRecipeDefinition } from "./recipe/roots/ritual.js";
2
- export { RootRitualRecipe, default as RootRitualRecipeParser, } from "./recipe/roots/ritual.js";
3
- export type { RootComponentRecipeDefinition } from "./recipe/roots/component.js";
4
- export { RootComponentRecipe, default as RootComponentRecipeParser, } from "./recipe/roots/component.js";
1
+ export * from "./recipe/roots/component.js";
2
+ export * from "./recipe/roots/ritual.js";
@@ -1,3 +1,3 @@
1
- export { RootRitualRecipe, default as RootRitualRecipeParser, } from "./recipe/roots/ritual.js";
2
- export { RootComponentRecipe, default as RootComponentRecipeParser, } from "./recipe/roots/component.js";
1
+ export * from "./recipe/roots/component.js";
2
+ export * from "./recipe/roots/ritual.js";
3
3
  //# sourceMappingURL=roots.js.map