@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.
- 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 -7
- package/dist/emit/data/loot.js +14 -13
- package/dist/emit/data/loot.js.map +1 -1
- package/dist/emit/data/recipe.d.ts +18 -16
- package/dist/emit/data/recipe.js +28 -22
- 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 +4 -2
- 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 +1 -4
- package/dist/index.js +1 -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 +15 -8
- package/dist/loader/pack.js +43 -25
- package/dist/loader/pack.js.map +1 -1
- package/dist/loader/recipe.d.ts +8 -4
- package/dist/loader/recipe.js +41 -47
- 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/packFormat.d.ts +11 -0
- package/dist/packFormat.js +59 -0
- package/dist/packFormat.js.map +1 -0
- 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 +6 -12
- package/dist/parser/index.js +6 -6
- 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 +26 -19
- 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 +12 -13
- 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 +10 -11
- 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 +27 -27
- 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 -14
- 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 +10 -10
- package/dist/parser/recipe/forge/conditional.js +13 -17
- package/dist/parser/recipe/forge/conditional.js.map +1 -1
- package/dist/parser/recipe/index.d.ts +21 -12
- package/dist/parser/recipe/index.js +10 -3
- 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 -15
- 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 +29 -30
- 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 +3 -2
- 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
package/dist/parser/lootTable.js
CHANGED
|
@@ -1,38 +1,36 @@
|
|
|
1
|
+
import { encodeId } from "../common/id.js";
|
|
2
|
+
import { ItemIngredient, ItemTagIngredient, } from "../common/ingredient/index.js";
|
|
3
|
+
import { ItemResult } from "../common/result/index.js";
|
|
1
4
|
import { extendLootEntry } from "../schema/data/loot.js";
|
|
2
|
-
import { IllegalShapeError } from "../error.js";
|
|
3
5
|
function createUnvalidatedLootEntry(input) {
|
|
4
|
-
if (input
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
name: input.item,
|
|
16
|
-
};
|
|
6
|
+
if (input instanceof ItemIngredient || input instanceof ItemResult) {
|
|
7
|
+
return {
|
|
8
|
+
type: "minecraft:item",
|
|
9
|
+
name: encodeId(input.id),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
if (input instanceof ItemTagIngredient) {
|
|
13
|
+
return {
|
|
14
|
+
type: "minecraft:tag",
|
|
15
|
+
name: encodeId(input.tag),
|
|
16
|
+
};
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
return extendLootEntry(input);
|
|
19
19
|
}
|
|
20
20
|
function validateLootEntry(entry, lookup) {
|
|
21
21
|
if (entry.type === "minecraft:item")
|
|
22
|
-
lookup
|
|
23
|
-
if (entry.type === "minecraft:tag")
|
|
24
|
-
lookup?.validate({ tag: entry.name });
|
|
22
|
+
lookup.validateEntry("minecraft:item", entry.name);
|
|
25
23
|
if (entry.type === "minecraft:alternatives") {
|
|
26
24
|
entry.children.forEach((it) => validateLootEntry(extendLootEntry(it), lookup));
|
|
27
25
|
}
|
|
28
26
|
}
|
|
29
27
|
export function createLootEntry(input, lookup) {
|
|
30
28
|
const unvalidated = createUnvalidatedLootEntry(input);
|
|
31
|
-
|
|
32
|
-
validateLootEntry(unvalidated, lookup);
|
|
29
|
+
validateLootEntry(unvalidated, lookup);
|
|
33
30
|
return unvalidated;
|
|
34
31
|
}
|
|
35
|
-
|
|
32
|
+
// TODO add function Predicate<Ingredient> -> Predicate<LootEntry>
|
|
33
|
+
function replaceItemInEntry(predicate, to) {
|
|
36
34
|
const replace = (base) => {
|
|
37
35
|
const entry = extendLootEntry(base);
|
|
38
36
|
const shared = {
|
|
@@ -46,9 +44,13 @@ export function replaceItemInEntry(predicate, to) {
|
|
|
46
44
|
children: entry.children.map(replace),
|
|
47
45
|
};
|
|
48
46
|
case "minecraft:item":
|
|
49
|
-
return predicate(
|
|
47
|
+
return predicate(new ItemIngredient(entry.name))
|
|
48
|
+
? { ...shared, ...to }
|
|
49
|
+
: entry;
|
|
50
50
|
case "minecraft:tag":
|
|
51
|
-
return predicate(
|
|
51
|
+
return predicate(new ItemTagIngredient(entry.name))
|
|
52
|
+
? { ...shared, ...to }
|
|
53
|
+
: entry;
|
|
52
54
|
default:
|
|
53
55
|
return entry;
|
|
54
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lootTable.js","sourceRoot":"","sources":["../../src/parser/lootTable.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lootTable.js","sourceRoot":"","sources":["../../src/parser/lootTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EACL,cAAc,EACd,iBAAiB,GAGlB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAOvD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAIzD,SAAS,0BAA0B,CAAC,KAAoB;IACtD,IAAI,KAA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,CAAC;QACF,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;YACnB,KAAK,wBAAwB;gBAC3B,OAAO;oBACL,GAAG,KAAK;oBACR,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;iBACtC,CAAC;YAEJ,KAAK,gBAAgB;gBACnB,OAAO,SAAS,CAAC,IAAI,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;oBAC9C,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,EAAE;oBACtB,CAAC,CAAC,KAAK,CAAC;YAEZ,KAAK,eAAe;gBAClB,OAAO,SAAS,CAAC,IAAI,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;oBACjD,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,EAAE;oBACtB,CAAC,CAAC,KAAK,CAAC;YAEZ;gBACE,OAAO,KAAK,CAAC;QACjB,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,SAAgC,EAChC,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"}
|
|
@@ -1,20 +1,21 @@
|
|
|
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 FluidConversionRecipeDefinition = RecipeDefinition & Readonly<{
|
|
7
|
-
input:
|
|
7
|
+
input: unknown;
|
|
8
8
|
output: string;
|
|
9
9
|
}>;
|
|
10
|
-
export declare class FluidConversionRecipe extends Recipe
|
|
11
|
-
private readonly
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
export declare class FluidConversionRecipe extends Recipe {
|
|
11
|
+
private readonly ingredient;
|
|
12
|
+
private readonly result;
|
|
13
|
+
constructor(definition: RecipeDefinition, ingredient: Ingredient, result: Result);
|
|
14
|
+
getIngredients(): Ingredient[];
|
|
15
|
+
getResults(): Result[];
|
|
16
|
+
replace(ingredientReplacer: Replacer<Ingredient>, resultReplacer: Replacer<Result>): FluidConversionRecipe;
|
|
17
|
+
serialize(context: RecipeParseContext): Partial<FluidConversionRecipeDefinition>;
|
|
17
18
|
}
|
|
18
|
-
export
|
|
19
|
-
|
|
19
|
+
export declare class FluidConversionRecipeParser extends RecipeParser<FluidConversionRecipeDefinition, FluidConversionRecipe> {
|
|
20
|
+
deserialize(definition: FluidConversionRecipeDefinition, context: RecipeParseContext): FluidConversionRecipe;
|
|
20
21
|
}
|
|
@@ -1,33 +1,40 @@
|
|
|
1
|
+
import { encodeId } from "../../../common/id.js";
|
|
2
|
+
import { FluidIngredient, } from "../../../common/ingredient/index.js";
|
|
3
|
+
import { FluidResult } from "../../../common/result/index.js";
|
|
4
|
+
import { IllegalShapeError } from "../../../error.js";
|
|
1
5
|
import RecipeParser, { Recipe } from "../index.js";
|
|
2
6
|
export class FluidConversionRecipe extends Recipe {
|
|
3
|
-
|
|
4
|
-
|
|
7
|
+
ingredient;
|
|
8
|
+
result;
|
|
9
|
+
constructor(definition, ingredient, result) {
|
|
5
10
|
super(definition);
|
|
6
|
-
this.
|
|
11
|
+
this.ingredient = ingredient;
|
|
12
|
+
this.result = result;
|
|
7
13
|
}
|
|
8
14
|
getIngredients() {
|
|
9
|
-
return [this.
|
|
15
|
+
return [this.ingredient];
|
|
10
16
|
}
|
|
11
17
|
getResults() {
|
|
12
|
-
return [this.
|
|
18
|
+
return [this.result];
|
|
13
19
|
}
|
|
14
|
-
|
|
15
|
-
return new FluidConversionRecipe(
|
|
16
|
-
...this.definition,
|
|
17
|
-
input: replace(this.definition.input),
|
|
18
|
-
});
|
|
20
|
+
replace(ingredientReplacer, resultReplacer) {
|
|
21
|
+
return new FluidConversionRecipe(this.definition, ingredientReplacer(this.ingredient), resultReplacer(this.result));
|
|
19
22
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
serialize(context) {
|
|
24
|
+
if (!(this.result instanceof FluidIngredient)) {
|
|
25
|
+
throw new IllegalShapeError("fluid conversion output must be a fluid result", this.result);
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
input: context.ingredients.serialize(this.ingredient),
|
|
29
|
+
output: encodeId(this.result.id),
|
|
30
|
+
};
|
|
26
31
|
}
|
|
27
32
|
}
|
|
28
|
-
export
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
export class FluidConversionRecipeParser extends RecipeParser {
|
|
34
|
+
deserialize(definition, context) {
|
|
35
|
+
const ingredient = context.ingredients.create(definition.input);
|
|
36
|
+
const result = context.results.validated(new FluidResult(definition.output, -1));
|
|
37
|
+
return new FluidConversionRecipe(definition, ingredient, result);
|
|
31
38
|
}
|
|
32
39
|
}
|
|
33
40
|
//# sourceMappingURL=conversion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversion.js","sourceRoot":"","sources":["../../../../src/parser/recipe/adAstra/conversion.ts"],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CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;SACjC,CAAC;IACJ,CAAC;CACF;AAED,MAAM,OAAO,2BAA4B,SAAQ,YAGhD;IACC,WAAW,CACT,UAA2C,EAC3C,OAA2B;QAE3B,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAChE,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CACtC,IAAI,WAAW,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CACvC,CAAC;QACF,OAAO,IAAI,qBAAqB,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IACnE,CAAC;CACF"}
|
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
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;
|
|
1
|
+
import { ManyToOneRecipeParser, type ManyToOneRecipeDefinition } from "../manyToOne.js";
|
|
2
|
+
export type HammeringRecipeDefinition = ManyToOneRecipeDefinition;
|
|
3
|
+
export declare class HammeringRecipeParser extends ManyToOneRecipeParser<HammeringRecipeDefinition> {
|
|
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 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
|
-
}
|
|
1
|
+
import { ManyToOneRecipeParser, } from "../manyToOne.js";
|
|
2
|
+
export class HammeringRecipeParser extends ManyToOneRecipeParser {
|
|
26
3
|
}
|
|
27
4
|
//# sourceMappingURL=hammering.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hammering.js","sourceRoot":"","sources":["../../../../src/parser/recipe/adAstra/hammering.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hammering.js","sourceRoot":"","sources":["../../../../src/parser/recipe/adAstra/hammering.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,GAEtB,MAAM,iBAAiB,CAAC;AAIzB,MAAM,OAAO,qBAAsB,SAAQ,qBAAgD;CAAG"}
|
|
@@ -1,24 +1,21 @@
|
|
|
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 { ItemResult, type Result } from "../../../common/result/index.js";
|
|
4
3
|
import type { RecipeDefinition } from "../../../schema/data/recipe.js";
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
id: string;
|
|
8
|
-
count?: number;
|
|
9
|
-
};
|
|
10
|
-
export declare function fromIdResult({ id, ...result }: IdResult): Result;
|
|
11
|
-
export declare function toIdResult(result: Result): IdResult | null;
|
|
4
|
+
import RecipeParser, { Recipe, type RecipeParseContext, type Replacer } from "../index.js";
|
|
5
|
+
import { OneToOneRecipe } from "../oneToOne.js";
|
|
12
6
|
export type InputOutputRecipeDefinition = RecipeDefinition & Readonly<{
|
|
13
|
-
input:
|
|
14
|
-
output:
|
|
7
|
+
input: unknown;
|
|
8
|
+
output: unknown;
|
|
15
9
|
}>;
|
|
16
|
-
export declare class InputOutputRecipe extends Recipe
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
export declare class InputOutputRecipe extends Recipe {
|
|
11
|
+
protected readonly ingredient: Ingredient;
|
|
12
|
+
protected readonly result: ItemResult;
|
|
13
|
+
constructor(definition: RecipeDefinition, ingredient: Ingredient, result: ItemResult);
|
|
14
|
+
getIngredients(): Ingredient[];
|
|
15
|
+
getResults(): ItemResult[];
|
|
16
|
+
replace(ingredientReplacer: Replacer<Ingredient>, resultReplacer: Replacer<Result>): OneToOneRecipe;
|
|
17
|
+
serialize(context: RecipeParseContext): Partial<InputOutputRecipeDefinition>;
|
|
21
18
|
}
|
|
22
|
-
export
|
|
23
|
-
|
|
19
|
+
export declare class InputOutputRecipeParser extends RecipeParser<InputOutputRecipeDefinition, InputOutputRecipe> {
|
|
20
|
+
deserialize(definition: InputOutputRecipeDefinition, context: RecipeParseContext): InputOutputRecipe;
|
|
24
21
|
}
|
|
@@ -1,42 +1,50 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { encodeId, IdSchema } from "../../../common/id.js";
|
|
3
|
+
import { ItemResult } from "../../../common/result/index.js";
|
|
4
|
+
import RecipeParser, { Recipe, } from "../index.js";
|
|
5
|
+
import { OneToOneRecipe } from "../oneToOne.js";
|
|
6
|
+
// TODO this will also be the new item format, can re-use that
|
|
7
|
+
const IdResultSchema = z.object({
|
|
8
|
+
id: IdSchema,
|
|
9
|
+
count: z.number().optional(),
|
|
10
|
+
});
|
|
11
|
+
function deserializeIdResult(ingredients, input) {
|
|
12
|
+
const { id, count } = IdResultSchema.parse(input);
|
|
13
|
+
return ingredients.validated(new ItemResult(id, count));
|
|
7
14
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
id: result.item,
|
|
12
|
-
count: result.count,
|
|
13
|
-
};
|
|
14
|
-
return null;
|
|
15
|
+
function serializeIdResult(result) {
|
|
16
|
+
const { id, count } = result;
|
|
17
|
+
return { id: encodeId(id), count };
|
|
15
18
|
}
|
|
16
19
|
export class InputOutputRecipe extends Recipe {
|
|
20
|
+
ingredient;
|
|
21
|
+
result;
|
|
22
|
+
constructor(definition, ingredient, result) {
|
|
23
|
+
super(definition);
|
|
24
|
+
this.ingredient = ingredient;
|
|
25
|
+
this.result = result;
|
|
26
|
+
}
|
|
17
27
|
getIngredients() {
|
|
18
|
-
return [this.
|
|
28
|
+
return [this.ingredient];
|
|
19
29
|
}
|
|
20
30
|
getResults() {
|
|
21
|
-
return [this.
|
|
31
|
+
return [this.result];
|
|
22
32
|
}
|
|
23
|
-
|
|
24
|
-
return new
|
|
25
|
-
...this.definition,
|
|
26
|
-
input: replace(this.definition.input),
|
|
27
|
-
});
|
|
33
|
+
replace(ingredientReplacer, resultReplacer) {
|
|
34
|
+
return new OneToOneRecipe(this.definition, ingredientReplacer(this.ingredient), resultReplacer(this.result));
|
|
28
35
|
}
|
|
29
|
-
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
output:
|
|
33
|
-
|
|
34
|
-
});
|
|
36
|
+
serialize(context) {
|
|
37
|
+
return {
|
|
38
|
+
input: context.ingredients.serialize(this.ingredient),
|
|
39
|
+
output: serializeIdResult(this.result),
|
|
40
|
+
};
|
|
35
41
|
}
|
|
36
42
|
}
|
|
37
|
-
export
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
export class InputOutputRecipeParser extends RecipeParser {
|
|
44
|
+
deserialize(definition, context) {
|
|
45
|
+
const ingredient = context.ingredients.create(definition.input);
|
|
46
|
+
const result = deserializeIdResult(context.ingredients, definition.output);
|
|
47
|
+
return new InputOutputRecipe(definition, ingredient, result);
|
|
40
48
|
}
|
|
41
49
|
}
|
|
42
50
|
//# sourceMappingURL=inputOutput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputOutput.js","sourceRoot":"","sources":["../../../../src/parser/recipe/adAstra/inputOutput.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"inputOutput.js","sourceRoot":"","sources":["../../../../src/parser/recipe/adAstra/inputOutput.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAG3D,OAAO,EAAE,UAAU,EAAe,MAAM,iCAAiC,CAAC;AAE1E,OAAO,YAAY,EAAE,EACnB,MAAM,GAGP,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,8DAA8D;AAC9D,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,EAAE,EAAE,QAAQ;IACZ,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAAC,CAAC;AAEH,SAAS,mBAAmB,CAC1B,WAAiC,EACjC,KAAc;IAEd,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAClD,OAAO,WAAW,CAAC,SAAS,CAAC,IAAI,UAAU,CAAC,EAAE,EAAE,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;QAC3E,OAAO,IAAI,iBAAiB,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IAC/D,CAAC;CACF"}
|
|
@@ -1,20 +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
|
-
import type { WrappedIngredient } from "./index.js";
|
|
7
|
-
export type NasaWorkbenchRecipeDefinition = RecipeDefinition & Readonly<{
|
|
8
|
-
ingredients: WrappedIngredient[];
|
|
9
|
-
output: Result;
|
|
10
|
-
mana?: number;
|
|
11
|
-
}>;
|
|
12
|
-
export declare class NasaWorkbenchRecipe extends Recipe<NasaWorkbenchRecipeDefinition> {
|
|
13
|
-
getIngredients(): IngredientInput[];
|
|
14
|
-
getResults(): ResultInput[];
|
|
15
|
-
replaceIngredient(replace: Replacer<Ingredient>): Recipe;
|
|
16
|
-
replaceResult(replace: Replacer<Result>): Recipe;
|
|
17
|
-
}
|
|
18
|
-
export default class NasaWorkbenchRecipeParser extends RecipeParser<NasaWorkbenchRecipeDefinition, NasaWorkbenchRecipe> {
|
|
19
|
-
create(definition: NasaWorkbenchRecipeDefinition): NasaWorkbenchRecipe;
|
|
1
|
+
import { ManyToOneRecipeParser, type ManyToOneRecipeDefinition } from "../manyToOne.js";
|
|
2
|
+
export type NasaWorkbenchRecipeDefinition = ManyToOneRecipeDefinition;
|
|
3
|
+
export declare class NasaWorkbenchRecipeParser extends ManyToOneRecipeParser<NasaWorkbenchRecipeDefinition> {
|
|
20
4
|
}
|
|
@@ -1,30 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
export class
|
|
3
|
-
getIngredients() {
|
|
4
|
-
return this.definition.ingredients.map((it) => it.ingredient);
|
|
5
|
-
}
|
|
6
|
-
getResults() {
|
|
7
|
-
return [this.definition.output];
|
|
8
|
-
}
|
|
9
|
-
replaceIngredient(replace) {
|
|
10
|
-
return new NasaWorkbenchRecipe({
|
|
11
|
-
...this.definition,
|
|
12
|
-
ingredients: this.definition.ingredients.map((it) => ({
|
|
13
|
-
...it,
|
|
14
|
-
ingredient: replace(it.ingredient),
|
|
15
|
-
})),
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
replaceResult(replace) {
|
|
19
|
-
return new NasaWorkbenchRecipe({
|
|
20
|
-
...this.definition,
|
|
21
|
-
output: replace(this.definition.output),
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
export default class NasaWorkbenchRecipeParser extends RecipeParser {
|
|
26
|
-
create(definition) {
|
|
27
|
-
return new NasaWorkbenchRecipe(definition);
|
|
28
|
-
}
|
|
1
|
+
import { ManyToOneRecipeParser, } from "../manyToOne.js";
|
|
2
|
+
export class NasaWorkbenchRecipeParser extends ManyToOneRecipeParser {
|
|
29
3
|
}
|
|
30
4
|
//# sourceMappingURL=nasaWorkbench.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nasaWorkbench.js","sourceRoot":"","sources":["../../../../src/parser/recipe/adAstra/nasaWorkbench.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"nasaWorkbench.js","sourceRoot":"","sources":["../../../../src/parser/recipe/adAstra/nasaWorkbench.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,GAEtB,MAAM,iBAAiB,CAAC;AAIzB,MAAM,OAAO,yBAA0B,SAAQ,qBAAoD;CAAG"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import type
|
|
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";
|
|
4
2
|
import type { RecipeDefinition } from "../../../schema/data/recipe.js";
|
|
5
|
-
import type {
|
|
6
|
-
import
|
|
3
|
+
import type { RecipeParseContext, Replacer } from "../index.js";
|
|
4
|
+
import RecipeParser, { Recipe } from "../index.js";
|
|
7
5
|
export type SpaceStationRecipeDefinition = RecipeDefinition & Readonly<{
|
|
8
|
-
ingredients:
|
|
9
|
-
|
|
6
|
+
ingredients: unknown[];
|
|
7
|
+
dimension: string;
|
|
8
|
+
structure: string;
|
|
10
9
|
}>;
|
|
11
|
-
export declare class SpaceStationRecipe extends Recipe
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
export declare class SpaceStationRecipe extends Recipe {
|
|
11
|
+
private readonly ingredients;
|
|
12
|
+
constructor(definition: RecipeDefinition, ingredients: Ingredient[]);
|
|
13
|
+
getIngredients(): Ingredient[];
|
|
14
|
+
getResults(): never[];
|
|
15
|
+
replace(ingredientReplacer: Replacer<Ingredient>): SpaceStationRecipe;
|
|
16
|
+
serialize(context: RecipeParseContext): Partial<SpaceStationRecipeDefinition>;
|
|
16
17
|
}
|
|
17
|
-
export
|
|
18
|
-
|
|
18
|
+
export declare class SpaceStationRecipeParser extends RecipeParser<SpaceStationRecipeDefinition, SpaceStationRecipe> {
|
|
19
|
+
deserialize(definition: SpaceStationRecipeDefinition, context: RecipeParseContext): SpaceStationRecipe;
|
|
19
20
|
}
|
|
@@ -1,27 +1,46 @@
|
|
|
1
|
+
import { omit } from "lodash-es";
|
|
2
|
+
import z from "zod";
|
|
3
|
+
import { ItemIngredient, ItemTagIngredient, } from "../../../common/ingredient/index.js";
|
|
4
|
+
import { IllegalShapeError } from "../../../error.js";
|
|
1
5
|
import RecipeParser, { Recipe } from "../index.js";
|
|
6
|
+
const WrappedIngredientSchema = z.object({
|
|
7
|
+
ingredient: z.record(z.string(), z.unknown()),
|
|
8
|
+
count: z.number().optional(),
|
|
9
|
+
});
|
|
2
10
|
export class SpaceStationRecipe extends Recipe {
|
|
11
|
+
ingredients;
|
|
12
|
+
constructor(definition, ingredients) {
|
|
13
|
+
super(definition);
|
|
14
|
+
this.ingredients = ingredients;
|
|
15
|
+
}
|
|
3
16
|
getIngredients() {
|
|
4
|
-
return this.
|
|
17
|
+
return this.ingredients;
|
|
5
18
|
}
|
|
6
19
|
getResults() {
|
|
7
20
|
return [];
|
|
8
21
|
}
|
|
9
|
-
|
|
10
|
-
return new SpaceStationRecipe(
|
|
11
|
-
...this.definition,
|
|
12
|
-
ingredients: this.definition.ingredients.map((it) => ({
|
|
13
|
-
...it,
|
|
14
|
-
ingredient: replace(it.ingredient),
|
|
15
|
-
})),
|
|
16
|
-
});
|
|
22
|
+
replace(ingredientReplacer) {
|
|
23
|
+
return new SpaceStationRecipe(this.definition, this.ingredients.map(ingredientReplacer));
|
|
17
24
|
}
|
|
18
|
-
|
|
19
|
-
return
|
|
25
|
+
serialize(context) {
|
|
26
|
+
return {
|
|
27
|
+
ingredients: context.ingredients
|
|
28
|
+
.serializeList(this.ingredients)
|
|
29
|
+
.map((it) => {
|
|
30
|
+
if (it instanceof ItemIngredient || it instanceof ItemTagIngredient) {
|
|
31
|
+
return { ingredient: omit(it, "count"), count: it.count };
|
|
32
|
+
}
|
|
33
|
+
throw new IllegalShapeError("space station ingredient needs to be a form of item", it);
|
|
34
|
+
}),
|
|
35
|
+
};
|
|
20
36
|
}
|
|
21
37
|
}
|
|
22
|
-
export
|
|
23
|
-
|
|
24
|
-
|
|
38
|
+
export class SpaceStationRecipeParser extends RecipeParser {
|
|
39
|
+
deserialize(definition, context) {
|
|
40
|
+
const ingredients = context.ingredients.createList(definition.ingredients
|
|
41
|
+
.map((it) => WrappedIngredientSchema.parse(it))
|
|
42
|
+
.map((it) => ({ ...it.ingredient, count: it.count })));
|
|
43
|
+
return new SpaceStationRecipe(definition, ingredients);
|
|
25
44
|
}
|
|
26
45
|
}
|
|
27
46
|
//# sourceMappingURL=spaceStation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spaceStation.js","sourceRoot":"","sources":["../../../../src/parser/recipe/adAstra/spaceStation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"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O,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC;gBAC5D,CAAC;gBAED,MAAM,IAAI,iBAAiB,CACzB,qDAAqD,EACrD,EAAE,CACH,CAAC;YACJ,CAAC,CAAC;SACL,CAAC;IACJ,CAAC;CACF;AAED,MAAM,OAAO,wBAAyB,SAAQ,YAG7C;IACC,WAAW,CACT,UAAwC,EACxC,OAA2B;QAE3B,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,UAAU,CAChD,UAAU,CAAC,WAAW;aACnB,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,uBAAuB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;aAC9C,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CACxD,CAAC;QAEF,OAAO,IAAI,kBAAkB,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IACzD,CAAC;CACF"}
|
|
@@ -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
|
|
4
|
+
import RecipeParser, { Recipe, type RecipeParseContext, type Replacer } from "../index.js";
|
|
6
5
|
export type ApothecaryRecipeDefinition = RecipeDefinition & Readonly<{
|
|
7
|
-
ingredients:
|
|
8
|
-
output:
|
|
9
|
-
reagent:
|
|
6
|
+
ingredients: unknown[];
|
|
7
|
+
output: unknown;
|
|
8
|
+
reagent: unknown;
|
|
10
9
|
}>;
|
|
11
|
-
export declare class ApothecaryRecipe extends Recipe
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
export declare class ApothecaryRecipe extends Recipe {
|
|
11
|
+
protected readonly ingredients: Ingredient[];
|
|
12
|
+
protected readonly result: Result;
|
|
13
|
+
protected readonly reagent: Ingredient;
|
|
14
|
+
constructor(definition: RecipeDefinition, ingredients: Ingredient[], result: Result, reagent: Ingredient);
|
|
15
|
+
getIngredients(): Ingredient[];
|
|
16
|
+
getResults(): Result[];
|
|
17
|
+
replace(ingredientReplacer: Replacer<Ingredient>, resultReplacer: Replacer<Result>): ApothecaryRecipe;
|
|
18
|
+
serialize(context: RecipeParseContext): Partial<ApothecaryRecipeDefinition>;
|
|
16
19
|
}
|
|
17
|
-
export
|
|
18
|
-
|
|
20
|
+
export declare class ApothecaryRecipeParser extends RecipeParser<ApothecaryRecipeDefinition, ApothecaryRecipe> {
|
|
21
|
+
deserialize(definition: ApothecaryRecipeDefinition, context: RecipeParseContext): ApothecaryRecipe;
|
|
19
22
|
}
|