@adeficior/data-modifier 1.0.0-rc.12 → 1.0.0-rc.14
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.
- package/dist/common/id.d.ts +1 -0
- package/dist/common/id.js +4 -0
- package/dist/common/id.js.map +1 -1
- package/dist/common/ingredient/filter.d.ts +6 -0
- package/dist/common/ingredient/filter.js +97 -0
- package/dist/common/ingredient/filter.js.map +1 -0
- package/dist/common/ingredient/index.d.ts +74 -0
- package/dist/common/ingredient/index.js +112 -0
- package/dist/common/ingredient/index.js.map +1 -0
- package/dist/common/ingredient/input.d.ts +3 -0
- package/dist/common/ingredient/input.js +1 -0
- package/dist/common/ingredient/input.js.map +1 -0
- package/dist/common/ingredient/serializer.d.ts +17 -0
- package/dist/common/ingredient/serializer.js +112 -0
- package/dist/common/ingredient/serializer.js.map +1 -0
- package/dist/common/predicates.d.ts +2 -1
- package/dist/common/predicates.js.map +1 -1
- package/dist/common/result/filter.d.ts +6 -0
- package/dist/common/result/filter.js +68 -0
- package/dist/common/result/filter.js.map +1 -0
- package/dist/common/result/index.d.ts +41 -0
- package/dist/common/result/index.js +59 -0
- package/dist/common/result/index.js.map +1 -0
- package/dist/common/result/input.d.ts +3 -0
- package/dist/common/result/input.js +1 -0
- package/dist/common/result/input.js.map +1 -0
- package/dist/common/result/serializer.d.ts +15 -0
- package/dist/common/result/serializer.js +81 -0
- package/dist/common/result/serializer.js.map +1 -0
- package/dist/common/serializable.d.ts +6 -0
- package/dist/common/serializable.js +1 -0
- package/dist/common/serializable.js.map +1 -0
- package/dist/common/units.d.ts +1 -0
- package/dist/common/units.js +2 -0
- package/dist/common/units.js.map +1 -0
- package/dist/emit/blacklist.d.ts +4 -6
- package/dist/emit/blacklist.js +19 -21
- package/dist/emit/blacklist.js.map +1 -1
- package/dist/emit/data/loot.d.ts +6 -8
- package/dist/emit/data/loot.js +11 -13
- package/dist/emit/data/loot.js.map +1 -1
- package/dist/emit/data/recipe.d.ts +20 -18
- package/dist/emit/data/recipe.js +40 -29
- package/dist/emit/data/recipe.js.map +1 -1
- package/dist/emit/data/tags.d.ts +1 -1
- package/dist/emit/data/tags.js.map +1 -1
- package/dist/emit/polytoneTabs.d.ts +1 -1
- package/dist/emit/polytoneTabs.js +1 -2
- package/dist/emit/polytoneTabs.js.map +1 -1
- package/dist/emit/rule/lootTable.d.ts +2 -1
- package/dist/emit/rule/lootTable.js +4 -2
- package/dist/emit/rule/lootTable.js.map +1 -1
- package/dist/emit/rule/recipe.d.ts +7 -5
- package/dist/emit/rule/recipe.js.map +1 -1
- package/dist/emit/ruled.d.ts +2 -1
- package/dist/emit/ruled.js +5 -2
- package/dist/emit/ruled.js.map +1 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/loader/context.d.ts +12 -0
- package/dist/loader/context.js +1 -0
- package/dist/loader/context.js.map +1 -0
- package/dist/loader/pack.d.ts +13 -7
- package/dist/loader/pack.js +43 -25
- package/dist/loader/pack.js.map +1 -1
- package/dist/loader/recipe.d.ts +9 -5
- package/dist/loader/recipe.js +39 -48
- package/dist/loader/recipe.js.map +1 -1
- package/dist/loader/registry/dump.d.ts +0 -2
- package/dist/loader/registry/dump.js +0 -11
- package/dist/loader/registry/dump.js.map +1 -1
- package/dist/loader/registry/index.d.ts +0 -2
- package/dist/loader/registry/wrapped.d.ts +13 -0
- package/dist/loader/registry/wrapped.js +26 -0
- package/dist/loader/registry/wrapped.js.map +1 -0
- package/dist/loader/tags.d.ts +1 -1
- package/dist/loader/tags.js.map +1 -1
- package/dist/parser/adAstra.d.ts +5 -11
- package/dist/parser/adAstra.js +5 -5
- package/dist/parser/adAstra.js.map +1 -1
- package/dist/parser/botania.d.ts +10 -20
- package/dist/parser/botania.js +10 -10
- package/dist/parser/botania.js.map +1 -1
- package/dist/parser/create.d.ts +2 -4
- package/dist/parser/create.js +2 -2
- package/dist/parser/create.js.map +1 -1
- package/dist/parser/index.d.ts +7 -13
- package/dist/parser/index.js +7 -7
- package/dist/parser/index.js.map +1 -1
- package/dist/parser/lootTable.d.ts +7 -6
- package/dist/parser/lootTable.js +25 -23
- package/dist/parser/lootTable.js.map +1 -1
- package/dist/parser/recipe/adAstra/conversion.d.ts +15 -14
- package/dist/parser/recipe/adAstra/conversion.js +27 -20
- package/dist/parser/recipe/adAstra/conversion.js.map +1 -1
- package/dist/parser/recipe/adAstra/hammering.d.ts +3 -17
- package/dist/parser/recipe/adAstra/hammering.js +2 -25
- package/dist/parser/recipe/adAstra/hammering.js.map +1 -1
- package/dist/parser/recipe/adAstra/inputOutput.d.ts +16 -19
- package/dist/parser/recipe/adAstra/inputOutput.js +37 -29
- package/dist/parser/recipe/adAstra/inputOutput.js.map +1 -1
- package/dist/parser/recipe/adAstra/nasaWorkbench.d.ts +3 -19
- package/dist/parser/recipe/adAstra/nasaWorkbench.js +2 -28
- package/dist/parser/recipe/adAstra/nasaWorkbench.js.map +1 -1
- package/dist/parser/recipe/adAstra/spaceStation.d.ts +15 -14
- package/dist/parser/recipe/adAstra/spaceStation.js +33 -14
- package/dist/parser/recipe/adAstra/spaceStation.js.map +1 -1
- package/dist/parser/recipe/botania/apothecary.d.ts +17 -14
- package/dist/parser/recipe/botania/apothecary.js +26 -17
- package/dist/parser/recipe/botania/apothecary.js.map +1 -1
- package/dist/parser/recipe/botania/blocks.d.ts +21 -0
- package/dist/parser/recipe/botania/blocks.js +77 -0
- package/dist/parser/recipe/botania/blocks.js.map +1 -0
- package/dist/parser/recipe/botania/brew.d.ts +13 -12
- package/dist/parser/recipe/botania/brew.js +16 -11
- package/dist/parser/recipe/botania/brew.js.map +1 -1
- package/dist/parser/recipe/botania/elvenTrade.d.ts +8 -13
- package/dist/parser/recipe/botania/elvenTrade.js +11 -22
- package/dist/parser/recipe/botania/elvenTrade.js.map +1 -1
- package/dist/parser/recipe/botania/gogWrapper.d.ts +12 -12
- package/dist/parser/recipe/botania/gogWrapper.js +14 -15
- package/dist/parser/recipe/botania/gogWrapper.js.map +1 -1
- package/dist/parser/recipe/botania/manaInfusion.d.ts +18 -15
- package/dist/parser/recipe/botania/manaInfusion.js +29 -21
- package/dist/parser/recipe/botania/manaInfusion.js.map +1 -1
- package/dist/parser/recipe/botania/nbtWrapper.d.ts +12 -12
- package/dist/parser/recipe/botania/nbtWrapper.js +12 -13
- package/dist/parser/recipe/botania/nbtWrapper.js.map +1 -1
- package/dist/parser/recipe/botania/orechid.d.ts +3 -30
- package/dist/parser/recipe/botania/orechid.js +2 -72
- package/dist/parser/recipe/botania/orechid.js.map +1 -1
- package/dist/parser/recipe/botania/pureDaisy.d.ts +3 -18
- package/dist/parser/recipe/botania/pureDaisy.js +2 -28
- package/dist/parser/recipe/botania/pureDaisy.js.map +1 -1
- package/dist/parser/recipe/botania/runicAltar.d.ts +8 -13
- package/dist/parser/recipe/botania/runicAltar.js +11 -22
- package/dist/parser/recipe/botania/runicAltar.js.map +1 -1
- package/dist/parser/recipe/botania/terraPlate.d.ts +4 -16
- package/dist/parser/recipe/botania/terraPlate.js +2 -25
- package/dist/parser/recipe/botania/terraPlate.js.map +1 -1
- package/dist/parser/recipe/create/assembly.d.ts +18 -17
- package/dist/parser/recipe/create/assembly.js +28 -28
- package/dist/parser/recipe/create/assembly.js.map +1 -1
- package/dist/parser/recipe/create/processing.d.ts +4 -16
- package/dist/parser/recipe/create/processing.js +2 -25
- package/dist/parser/recipe/create/processing.js.map +1 -1
- package/dist/parser/recipe/farmersdelight/cooking.d.ts +16 -12
- package/dist/parser/recipe/farmersdelight/cooking.js +27 -15
- package/dist/parser/recipe/farmersdelight/cooking.js.map +1 -1
- package/dist/parser/recipe/farmersdelight/cutting.d.ts +14 -15
- package/dist/parser/recipe/farmersdelight/cutting.js +32 -29
- package/dist/parser/recipe/farmersdelight/cutting.js.map +1 -1
- package/dist/parser/recipe/forge/conditional.d.ts +11 -11
- package/dist/parser/recipe/forge/conditional.js +17 -21
- package/dist/parser/recipe/forge/conditional.js.map +1 -1
- package/dist/parser/recipe/index.d.ts +36 -13
- package/dist/parser/recipe/index.js +38 -5
- package/dist/parser/recipe/index.js.map +1 -1
- package/dist/parser/recipe/ingredientMap.d.ts +12 -0
- package/dist/parser/recipe/ingredientMap.js +17 -0
- package/dist/parser/recipe/ingredientMap.js.map +1 -0
- package/dist/parser/recipe/manyToMany.d.ts +20 -0
- package/dist/parser/recipe/manyToMany.js +33 -0
- package/dist/parser/recipe/manyToMany.js.map +1 -0
- package/dist/parser/recipe/manyToOne.d.ts +20 -0
- package/dist/parser/recipe/manyToOne.js +33 -0
- package/dist/parser/recipe/manyToOne.js.map +1 -0
- package/dist/parser/recipe/oneToOne.d.ts +20 -0
- package/dist/parser/recipe/oneToOne.js +33 -0
- package/dist/parser/recipe/oneToOne.js.map +1 -0
- package/dist/parser/recipe/roots/component.d.ts +13 -12
- package/dist/parser/recipe/roots/component.js +16 -11
- package/dist/parser/recipe/roots/component.js.map +1 -1
- package/dist/parser/recipe/roots/ritual.d.ts +14 -16
- package/dist/parser/recipe/roots/ritual.js +18 -25
- package/dist/parser/recipe/roots/ritual.js.map +1 -1
- package/dist/parser/recipe/sullys/polishing.d.ts +4 -16
- package/dist/parser/recipe/sullys/polishing.js +2 -25
- package/dist/parser/recipe/sullys/polishing.js.map +1 -1
- package/dist/parser/recipe/thermal/catalyst.d.ts +13 -12
- package/dist/parser/recipe/thermal/catalyst.js +16 -11
- package/dist/parser/recipe/thermal/catalyst.js.map +1 -1
- package/dist/parser/recipe/thermal/fuel.d.ts +13 -12
- package/dist/parser/recipe/thermal/fuel.js +17 -11
- package/dist/parser/recipe/thermal/fuel.js.map +1 -1
- package/dist/parser/recipe/thermal/index.d.ts +16 -14
- package/dist/parser/recipe/thermal/index.js +35 -24
- package/dist/parser/recipe/thermal/index.js.map +1 -1
- package/dist/parser/recipe/thermal/ingredient.d.ts +4 -21
- package/dist/parser/recipe/thermal/ingredient.js +40 -33
- package/dist/parser/recipe/thermal/ingredient.js.map +1 -1
- package/dist/parser/recipe/thermal/treeExtraction.d.ts +17 -17
- package/dist/parser/recipe/thermal/treeExtraction.js +30 -31
- package/dist/parser/recipe/thermal/treeExtraction.js.map +1 -1
- package/dist/parser/recipe/vanilla/shaped.d.ts +17 -13
- package/dist/parser/recipe/vanilla/shaped.js +21 -16
- package/dist/parser/recipe/vanilla/shaped.js.map +1 -1
- package/dist/parser/recipe/vanilla/shapeless.d.ts +3 -17
- package/dist/parser/recipe/vanilla/shapeless.js +2 -25
- package/dist/parser/recipe/vanilla/shapeless.js.map +1 -1
- package/dist/parser/recipe/vanilla/smelting.d.ts +16 -13
- package/dist/parser/recipe/vanilla/smelting.js +21 -15
- package/dist/parser/recipe/vanilla/smelting.js.map +1 -1
- package/dist/parser/recipe/vanilla/smithing.d.ts +18 -14
- package/dist/parser/recipe/vanilla/smithing.js +25 -16
- package/dist/parser/recipe/vanilla/smithing.js.map +1 -1
- package/dist/parser/recipe/vanilla/stonecutting.d.ts +15 -13
- package/dist/parser/recipe/vanilla/stonecutting.js +22 -24
- package/dist/parser/recipe/vanilla/stonecutting.js.map +1 -1
- package/dist/parser/roots.d.ts +2 -4
- package/dist/parser/roots.js +2 -2
- package/dist/parser/roots.js.map +1 -1
- package/dist/parser/thermal.d.ts +4 -10
- package/dist/parser/thermal.js +4 -5
- package/dist/parser/thermal.js.map +1 -1
- package/dist/schema/data/recipe.d.ts +2 -1
- package/package.json +2 -1
- package/dist/common/ingredient.d.ts +0 -49
- package/dist/common/ingredient.js +0 -108
- package/dist/common/ingredient.js.map +0 -1
- package/dist/common/result.d.ts +0 -48
- package/dist/common/result.js +0 -37
- package/dist/common/result.js.map +0 -1
- package/dist/parser/recipe/adAstra/index.d.ts +0 -5
- package/dist/parser/recipe/adAstra/index.js +0 -1
- package/dist/parser/recipe/adAstra/index.js.map +0 -1
- package/dist/parser/recipe/ignored.d.ts +0 -10
- package/dist/parser/recipe/ignored.js +0 -16
- package/dist/parser/recipe/ignored.js.map +0 -1
- package/dist/parser/recipe/quark/exclusion.d.ts +0 -20
- package/dist/parser/recipe/quark/exclusion.js +0 -32
- package/dist/parser/recipe/quark/exclusion.js.map +0 -1
|
@@ -1,43 +1,50 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { ItemStackSchema } from "../../../common/result.js";
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { encodeId, IdSchema } from "../../../common/id.js";
|
|
3
|
+
import { FluidTagIngredient, ItemIngredient, ItemTagIngredient, } from "../../../common/ingredient/index.js";
|
|
5
4
|
import { IllegalShapeError } from "../../../error.js";
|
|
6
|
-
const ThermalFluidTagSchema =
|
|
7
|
-
fluid_tag:
|
|
8
|
-
amount:
|
|
5
|
+
const ThermalFluidTagSchema = z.object({
|
|
6
|
+
fluid_tag: z.string(),
|
|
7
|
+
amount: z.number(),
|
|
9
8
|
});
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
9
|
+
const ThermalItemEntry = z.object({
|
|
10
|
+
item: IdSchema,
|
|
11
|
+
});
|
|
12
|
+
const ThermalTagEntry = z.object({
|
|
13
|
+
tag: IdSchema,
|
|
14
|
+
});
|
|
15
|
+
const ThermalIngredientEntry = ThermalItemEntry.or(ThermalTagEntry);
|
|
16
|
+
const ThermalIngredientList = z.object({
|
|
17
|
+
value: z.array(ThermalIngredientEntry),
|
|
18
|
+
count: z.number(),
|
|
19
|
+
});
|
|
20
|
+
// TODO serialize this?
|
|
21
|
+
// type ThermalItemList = z.infer<typeof ThermalIngredientList>;
|
|
22
|
+
export function createThermalIngredients(ingredients, input) {
|
|
22
23
|
if (input && typeof input === "object") {
|
|
23
|
-
if ("value" in input)
|
|
24
|
-
|
|
24
|
+
if ("value" in input) {
|
|
25
|
+
const parsed = ThermalIngredientList.parse(input);
|
|
26
|
+
return parsed.value.map((it) => {
|
|
27
|
+
if ("item" in it)
|
|
28
|
+
return new ItemIngredient(it.item, parsed.count);
|
|
29
|
+
if ("tag" in it)
|
|
30
|
+
return new ItemTagIngredient(it.tag, parsed.count);
|
|
31
|
+
throw new IllegalShapeError("unknown ingredient list entry shape", it);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
25
34
|
if ("fluid_tag" in input) {
|
|
26
|
-
|
|
35
|
+
const parsed = ThermalFluidTagSchema.parse(input);
|
|
36
|
+
return [new FluidTagIngredient(parsed.fluid_tag, parsed.amount)];
|
|
27
37
|
}
|
|
28
38
|
}
|
|
29
|
-
return
|
|
39
|
+
return [ingredients.create(input)];
|
|
30
40
|
}
|
|
31
|
-
export function
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
fluid_tag: resolved.fluidTag,
|
|
38
|
-
});
|
|
39
|
-
}
|
|
41
|
+
export function serializeThermalIngredient(ingredients, ingredient) {
|
|
42
|
+
if (ingredient instanceof FluidTagIngredient) {
|
|
43
|
+
return {
|
|
44
|
+
fluid_tag: encodeId(ingredient.tag),
|
|
45
|
+
amount: ingredient.amount,
|
|
46
|
+
};
|
|
40
47
|
}
|
|
41
|
-
return
|
|
48
|
+
return ingredients.serialize(ingredient);
|
|
42
49
|
}
|
|
43
50
|
//# sourceMappingURL=ingredient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ingredient.js","sourceRoot":"","sources":["../../../../src/parser/recipe/thermal/ingredient.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ingredient.js","sourceRoot":"","sources":["../../../../src/parser/recipe/thermal/ingredient.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,iBAAiB,G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IAAI,iBAAiB,CAAC,qCAAqC,EAAE,EAAE,CAAC,CAAC;YACzE,CAAC,CAAC,CAAC;QACL,CAAC;QAED,IAAI,WAAW,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,MAAM,GAAG,qBAAqB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAClD,OAAO,CAAC,IAAI,kBAAkB,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;IAED,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,WAAiC,EACjC,UAAsB;IAEtB,IAAI,UAAU,YAAY,kBAAkB,EAAE,CAAC;QAC7C,OAAO;YACL,SAAS,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC;YACnC,MAAM,EAAE,UAAU,CAAC,MAAM;SACA,CAAC;IAC9B,CAAC;IAED,OAAO,WAAW,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import
|
|
3
|
-
import type {
|
|
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
|
|
6
|
-
type ExtractionBlockInput = string;
|
|
5
|
+
import RecipeParser, { Recipe, type RecipeParseContext, type Replacer } from "../index.js";
|
|
7
6
|
export type TreeExtractionRecipeDefinition = RecipeDefinition & Readonly<{
|
|
8
|
-
leaves:
|
|
9
|
-
trunk:
|
|
10
|
-
result:
|
|
7
|
+
leaves: BlockId;
|
|
8
|
+
trunk: BlockId;
|
|
9
|
+
result: unknown;
|
|
11
10
|
}>;
|
|
12
|
-
export declare class TreeExtractionRecipe extends Recipe
|
|
11
|
+
export declare class TreeExtractionRecipe extends Recipe {
|
|
13
12
|
private readonly trunk;
|
|
14
13
|
private readonly leaves;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
private readonly result;
|
|
15
|
+
constructor(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
|
|
22
|
-
|
|
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
|
|
1
|
+
import { encodeId } from "../../../common/id.js";
|
|
2
|
+
import { BlockIngredient, } from "../../../common/ingredient/index.js";
|
|
2
3
|
import { IllegalShapeError } from "../../../error.js";
|
|
3
|
-
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
this.
|
|
8
|
+
result;
|
|
9
|
+
constructor(trunk, leaves, result) {
|
|
10
|
+
super();
|
|
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(ingredientReplacer(this.trunk), ingredientReplacer(this.leaves), resultReplacer(this.result));
|
|
30
23
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
39
|
-
return
|
|
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
|
|
43
|
-
|
|
44
|
-
|
|
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(trunk, leaves, result);
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
46
|
//# sourceMappingURL=treeExtraction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeExtraction.js","sourceRoot":"","sources":["../../../../src/parser/recipe/thermal/treeExtraction.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"treeExtraction.js","sourceRoot":"","sources":["../../../../src/parser/recipe/thermal/treeExtraction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EACL,eAAe,GAEhB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,YAAY,EAAE,EACnB,MAAM,GAGP,MAAM,aAAa,CAAC;AASrB,MAAM,OAAO,oBAAqB,SAAQ,MAAM;IAE3B;IACA;IACA;IAHnB,YACmB,KAAiB,EACjB,MAAkB,EAClB,MAAc;QAE/B,KAAK,EAAE,CAAC;QAJS,UAAK,GAAL,KAAK,CAAY;QACjB,WAAM,GAAN,MAAM,CAAY;QAClB,WAAM,GAAN,MAAM,CAAQ;IAGjC,CAAC;IAED,cAAc;QACZ,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED,UAAU;QACR,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC;IAEQ,OAAO,CACd,kBAAwC,EACxC,cAAgC;QAEhC,OAAO,IAAI,oBAAoB,CAC7B,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,EAC9B,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,EAC/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,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACzD,CAAC;CACF"}
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import
|
|
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 {
|
|
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:
|
|
8
|
+
key: IngredientMapInput;
|
|
8
9
|
pattern: string[];
|
|
9
|
-
result:
|
|
10
|
+
result: unknown;
|
|
10
11
|
}>;
|
|
11
|
-
export declare class ShapedRecipe extends Recipe
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
export declare class ShapedRecipe extends Recipe {
|
|
13
|
+
private readonly ingredients;
|
|
14
|
+
private readonly result;
|
|
15
|
+
constructor(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
|
|
18
|
-
|
|
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(ingredients, result) {
|
|
6
|
+
super();
|
|
7
|
+
this.ingredients = ingredients;
|
|
8
|
+
this.result = result;
|
|
9
|
+
}
|
|
4
10
|
getIngredients() {
|
|
5
|
-
return
|
|
11
|
+
return this.ingredients.list();
|
|
6
12
|
}
|
|
7
13
|
getResults() {
|
|
8
|
-
return [this.
|
|
14
|
+
return [this.result];
|
|
9
15
|
}
|
|
10
|
-
|
|
11
|
-
return new ShapedRecipe(
|
|
12
|
-
...this.definition,
|
|
13
|
-
key: mapValues(this.definition.key, replace),
|
|
14
|
-
});
|
|
16
|
+
replace(ingredientReplacer, resultReplacer) {
|
|
17
|
+
return new ShapedRecipe(this.ingredients.replace(ingredientReplacer), resultReplacer(this.result));
|
|
15
18
|
}
|
|
16
|
-
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
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
|
|
24
|
-
|
|
25
|
-
|
|
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(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":"
|
|
1
|
+
{"version":3,"file":"shaped.js","sourceRoot":"","sources":["../../../../src/parser/recipe/vanilla/shaped.ts"],"names":[],"mappings":"AAIA,OAAO,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAUnD,MAAM,OAAO,YAAa,SAAQ,MAAM;IAEnB;IACA;IAFnB,YACmB,WAA0B,EAC1B,MAAc;QAE/B,KAAK,EAAE,CAAC;QAHS,gBAAW,GAAX,WAAW,CAAe;QAC1B,WAAM,GAAN,MAAM,CAAQ;IAGjC,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;IACjC,CAAC;IAED,UAAU;QACR,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC;IAED,OAAO,CACL,kBAAwC,EACxC,cAAgC;QAEhC,OAAO,IAAI,YAAY,CACrB,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAC5C,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAC5B,CAAC;IACJ,CAAC;IAEQ,SAAS,CAChB,OAA2B;QAE3B,OAAO;YACL,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,OAAO,CAAC;YACxC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,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,WAAW,EAAE,MAAM,CAAC,CAAC;IAC/C,CAAC;CACF"}
|
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
3
|
-
|
|
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
|
|
2
|
-
export class
|
|
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":"
|
|
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 {
|
|
2
|
-
import
|
|
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 {
|
|
4
|
+
import type { RecipeParseContext, Replacer } from "../index.js";
|
|
5
|
+
import RecipeParser, { Recipe } from "../index.js";
|
|
6
6
|
export type SmeltingRecipeDefinition = RecipeDefinition & Readonly<{
|
|
7
|
-
ingredient:
|
|
8
|
-
result:
|
|
7
|
+
ingredient: unknown;
|
|
8
|
+
result: unknown;
|
|
9
9
|
experience?: number;
|
|
10
10
|
}>;
|
|
11
|
-
export declare class SmeltingRecipe extends Recipe
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
export declare class SmeltingRecipe extends Recipe {
|
|
12
|
+
private readonly ingredient;
|
|
13
|
+
private readonly result;
|
|
14
|
+
constructor(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
|
|
18
|
-
|
|
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(ingredient, result) {
|
|
6
|
+
super();
|
|
7
|
+
this.ingredient = ingredient;
|
|
8
|
+
this.result = result;
|
|
9
|
+
}
|
|
3
10
|
getIngredients() {
|
|
4
|
-
return [this.
|
|
11
|
+
return [this.ingredient];
|
|
5
12
|
}
|
|
6
13
|
getResults() {
|
|
7
|
-
return [this.
|
|
14
|
+
return [this.result];
|
|
8
15
|
}
|
|
9
|
-
|
|
10
|
-
return new SmeltingRecipe(
|
|
11
|
-
...this.definition,
|
|
12
|
-
ingredient: replace(this.definition.ingredient),
|
|
13
|
-
});
|
|
16
|
+
replace(ingredientReplacer, resultReplacer) {
|
|
17
|
+
return new SmeltingRecipe(ingredientReplacer(this.ingredient), resultReplacer(this.result));
|
|
14
18
|
}
|
|
15
|
-
|
|
16
|
-
return
|
|
17
|
-
|
|
18
|
-
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
|
|
23
|
-
|
|
24
|
-
|
|
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(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":"
|
|
1
|
+
{"version":3,"file":"smelting.js","sourceRoot":"","sources":["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-
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 {
|
|
4
|
+
import type { RecipeParseContext, Replacer } from "../index.js";
|
|
5
|
+
import RecipeParser, { Recipe } from "../index.js";
|
|
6
6
|
export type SmithingRecipeDefinition = RecipeDefinition & Readonly<{
|
|
7
|
-
base:
|
|
8
|
-
addition:
|
|
9
|
-
result:
|
|
7
|
+
base: unknown;
|
|
8
|
+
addition: unknown;
|
|
9
|
+
result: unknown;
|
|
10
10
|
}>;
|
|
11
|
-
export declare class SmithingRecipe extends Recipe
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
export declare class SmithingRecipe extends Recipe {
|
|
12
|
+
private readonly base;
|
|
13
|
+
private readonly addition;
|
|
14
|
+
private readonly result;
|
|
15
|
+
constructor(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
|
|
18
|
-
|
|
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(base, addition, result) {
|
|
7
|
+
super();
|
|
8
|
+
this.base = base;
|
|
9
|
+
this.addition = addition;
|
|
10
|
+
this.result = result;
|
|
11
|
+
}
|
|
3
12
|
getIngredients() {
|
|
4
|
-
return [this.
|
|
13
|
+
return [this.base, this.addition];
|
|
5
14
|
}
|
|
6
15
|
getResults() {
|
|
7
|
-
return [this.
|
|
16
|
+
return [this.result];
|
|
8
17
|
}
|
|
9
|
-
|
|
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(ingredientReplacer(this.base), ingredientReplacer(this.addition), resultReplacer(this.result));
|
|
15
20
|
}
|
|
16
|
-
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
|
|
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
|
|
24
|
-
|
|
25
|
-
|
|
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(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":"
|
|
1
|
+
{"version":3,"file":"smithing.js","sourceRoot":"","sources":["../../../../src/parser/recipe/vanilla/smithing.ts"],"names":[],"mappings":"AAIA,OAAO,YA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