@adeficior/data-modifier-recipes 2.0.0-rc.20260814115618
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/.turbo/turbo-build.log +1 -0
- package/.turbo/turbo-check.log +1 -0
- package/.turbo/turbo-lint.log +1 -0
- package/@types/modules.d.ts +15 -0
- package/@types/registry.d.ts +20 -0
- package/CHANGELOG.md +14 -0
- package/dist/emitter.d.ts +48 -0
- package/dist/emitter.js +116 -0
- package/dist/emitter.js.map +1 -0
- package/dist/hooks.d.ts +6 -0
- package/dist/hooks.js +4 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/loader.d.ts +27 -0
- package/dist/loader.js +141 -0
- package/dist/loader.js.map +1 -0
- package/dist/module.d.ts +15 -0
- package/dist/module.js +38 -0
- package/dist/module.js.map +1 -0
- package/dist/rule.d.ts +15 -0
- package/dist/rule.js +31 -0
- package/dist/rule.js.map +1 -0
- package/dist/schema.d.ts +7 -0
- package/dist/schema.js +14 -0
- package/dist/schema.js.map +1 -0
- package/dist/serializer/abstract.d.ts +17 -0
- package/dist/serializer/abstract.js +19 -0
- package/dist/serializer/abstract.js.map +1 -0
- package/dist/serializer/context.d.ts +12 -0
- package/dist/serializer/context.js +4 -0
- package/dist/serializer/context.js.map +1 -0
- package/dist/serializer/forge/conditional.d.ts +25 -0
- package/dist/serializer/forge/conditional.js +45 -0
- package/dist/serializer/forge/conditional.js.map +1 -0
- package/dist/serializer/holder.d.ts +25 -0
- package/dist/serializer/holder.js +52 -0
- package/dist/serializer/holder.js.map +1 -0
- package/dist/serializer/manyToMany.d.ts +21 -0
- package/dist/serializer/manyToMany.js +37 -0
- package/dist/serializer/manyToMany.js.map +1 -0
- package/dist/serializer/manyToOne.d.ts +21 -0
- package/dist/serializer/manyToOne.js +37 -0
- package/dist/serializer/manyToOne.js.map +1 -0
- package/dist/serializer/modifier.d.ts +6 -0
- package/dist/serializer/modifier.js +3 -0
- package/dist/serializer/modifier.js.map +1 -0
- package/dist/serializer/oneToOne.d.ts +21 -0
- package/dist/serializer/oneToOne.js +37 -0
- package/dist/serializer/oneToOne.js.map +1 -0
- package/dist/serializer/vanilla/shaped.d.ts +22 -0
- package/dist/serializer/vanilla/shaped.js +37 -0
- package/dist/serializer/vanilla/shaped.js.map +1 -0
- package/dist/serializer/vanilla/shapeless.d.ts +4 -0
- package/dist/serializer/vanilla/shapeless.js +4 -0
- package/dist/serializer/vanilla/shapeless.js.map +1 -0
- package/dist/serializer/vanilla/smelting.d.ts +22 -0
- package/dist/serializer/vanilla/smelting.js +37 -0
- package/dist/serializer/vanilla/smelting.js.map +1 -0
- package/dist/serializer/vanilla/smithing.d.ts +25 -0
- package/dist/serializer/vanilla/smithing.js +46 -0
- package/dist/serializer/vanilla/smithing.js.map +1 -0
- package/dist/serializer/vanilla/stonecutting.d.ts +22 -0
- package/dist/serializer/vanilla/stonecutting.js +38 -0
- package/dist/serializer/vanilla/stonecutting.js.map +1 -0
- package/eslint.config.js +8 -0
- package/package.json +42 -0
- package/src/emitter.ts +239 -0
- package/src/hooks.ts +10 -0
- package/src/index.ts +18 -0
- package/src/loader.ts +219 -0
- package/src/module.ts +70 -0
- package/src/rule.ts +45 -0
- package/src/schema.ts +30 -0
- package/src/serializer/abstract.ts +41 -0
- package/src/serializer/context.ts +17 -0
- package/src/serializer/forge/conditional.ts +72 -0
- package/src/serializer/holder.ts +63 -0
- package/src/serializer/manyToMany.ts +62 -0
- package/src/serializer/manyToOne.ts +62 -0
- package/src/serializer/modifier.ts +10 -0
- package/src/serializer/oneToOne.ts +60 -0
- package/src/serializer/vanilla/shaped.ts +65 -0
- package/src/serializer/vanilla/shapeless.ts +8 -0
- package/src/serializer/vanilla/smelting.ts +62 -0
- package/src/serializer/vanilla/smithing.ts +74 -0
- package/src/serializer/vanilla/stonecutting.ts +63 -0
- package/src/testing/index.ts +1 -0
- package/src/testing/setup.ts +85 -0
- package/test/1.20.1/__snapshots__/emitter.test.ts.snap +122 -0
- package/test/1.20.1/__snapshots__/loader.test.ts.snap +215 -0
- package/test/1.20.1/emitter.test.ts +222 -0
- package/test/1.20.1/loader.test.ts +17 -0
- package/test/1.21.1/loader.test.ts +17 -0
- package/test/1.21.1/packFormat.test.ts +52 -0
- package/test/resources/1.20.1/default/custom/data/custom/recipes/conditional.json +25 -0
- package/tsconfig.build.json +14 -0
- package/tsconfig.json +34 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {} from "@adeficior/data-modifier-core";
|
|
2
|
+
import {} from "@adeficior/data-modifier-ingredients";
|
|
3
|
+
import {} from "../schema";
|
|
4
|
+
import {} from "./context";
|
|
5
|
+
import {} from "./modifier";
|
|
6
|
+
export class Recipe {
|
|
7
|
+
additionalTypes() {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export class RecipeParser {
|
|
12
|
+
ingredientModules() {
|
|
13
|
+
return {};
|
|
14
|
+
}
|
|
15
|
+
resultModules() {
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=abstract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abstract.js","sourceRoot":"","sources":["../../src/serializer/abstract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAIN,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAyB,MAAM,WAAW,CAAC;AAClD,OAAO,EAA2B,MAAM,WAAW,CAAC;AACpD,OAAO,EAAuB,MAAM,YAAY,CAAC;AAEjD,MAAM,OAAgB,MAAM;IAO1B,eAAe;QACb,OAAO,EAAE,CAAC;IACZ,CAAC;CAGF;AAED,MAAM,OAAgB,YAAY;IAIhC,iBAAiB;QACf,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,aAAa;QACX,OAAO,EAAE,CAAC;IACZ,CAAC;CAMF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type IngredientSerializer, type ResultSerializer } from "@adeficior/data-modifier-ingredients";
|
|
2
|
+
import { type RecipeDefinition } from "../schema";
|
|
3
|
+
import { type RecipeHolder } from "./holder";
|
|
4
|
+
export type RecipeSerializer = {
|
|
5
|
+
deserialize(definition: RecipeDefinition): RecipeHolder;
|
|
6
|
+
serialize(recipe: RecipeHolder): RecipeDefinition;
|
|
7
|
+
};
|
|
8
|
+
export type RecipeParseContext = {
|
|
9
|
+
results: ResultSerializer;
|
|
10
|
+
ingredients: IngredientSerializer;
|
|
11
|
+
recipes: RecipeSerializer;
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/serializer/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAyB,MAAM,WAAW,CAAC;AAClD,OAAO,EAAqB,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type RecipeDefinition } from "../../schema";
|
|
2
|
+
import { Recipe, RecipeParser } from "../abstract";
|
|
3
|
+
import { type RecipeParseContext } from "../context";
|
|
4
|
+
import { type RecipeHolder } from "../holder";
|
|
5
|
+
import { type RecipeModifier } from "../modifier";
|
|
6
|
+
type WithConditions<T> = {
|
|
7
|
+
conditions: unknown[];
|
|
8
|
+
recipe: T;
|
|
9
|
+
};
|
|
10
|
+
export type ForgeConditionalRecipeDefinition = RecipeDefinition & Readonly<{
|
|
11
|
+
recipes: WithConditions<RecipeDefinition>[];
|
|
12
|
+
}>;
|
|
13
|
+
export declare class ForgeConditionalRecipe extends Recipe {
|
|
14
|
+
private readonly recipes;
|
|
15
|
+
constructor(recipes: WithConditions<RecipeHolder>[]);
|
|
16
|
+
getIngredients(): import("@adeficior/data-modifier-ingredients").Ingredient[];
|
|
17
|
+
getResults(): import("@adeficior/data-modifier-ingredients").Result[];
|
|
18
|
+
modify(modifier: RecipeModifier): ForgeConditionalRecipe;
|
|
19
|
+
serialize(context: RecipeParseContext): Partial<ForgeConditionalRecipeDefinition>;
|
|
20
|
+
additionalTypes(): `${string}:${string}`[];
|
|
21
|
+
}
|
|
22
|
+
export declare class ForgeConditionalRecipeParser extends RecipeParser<ForgeConditionalRecipeDefinition, ForgeConditionalRecipe> {
|
|
23
|
+
deserialize(definition: ForgeConditionalRecipeDefinition, context: RecipeParseContext): ForgeConditionalRecipe;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {} from "../../schema";
|
|
2
|
+
import { Recipe, RecipeParser } from "../abstract";
|
|
3
|
+
import {} from "../context";
|
|
4
|
+
import {} from "../holder";
|
|
5
|
+
import {} from "../modifier";
|
|
6
|
+
export class ForgeConditionalRecipe extends Recipe {
|
|
7
|
+
recipes;
|
|
8
|
+
constructor(recipes) {
|
|
9
|
+
super();
|
|
10
|
+
this.recipes = recipes;
|
|
11
|
+
}
|
|
12
|
+
getIngredients() {
|
|
13
|
+
return this.recipes.flatMap((it) => it.recipe.getIngredients());
|
|
14
|
+
}
|
|
15
|
+
getResults() {
|
|
16
|
+
return this.recipes.flatMap((it) => it.recipe.getResults());
|
|
17
|
+
}
|
|
18
|
+
modify(modifier) {
|
|
19
|
+
return new ForgeConditionalRecipe(this.recipes.map((it) => ({
|
|
20
|
+
...it,
|
|
21
|
+
recipe: it.recipe.modify(modifier),
|
|
22
|
+
})));
|
|
23
|
+
}
|
|
24
|
+
serialize(context) {
|
|
25
|
+
return {
|
|
26
|
+
recipes: this.recipes.map((it) => ({
|
|
27
|
+
...it,
|
|
28
|
+
recipe: context.recipes.serialize(it.recipe),
|
|
29
|
+
})),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
additionalTypes() {
|
|
33
|
+
return this.recipes.flatMap((it) => it.recipe.getTypes());
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export class ForgeConditionalRecipeParser extends RecipeParser {
|
|
37
|
+
deserialize(definition, context) {
|
|
38
|
+
const recipes = definition.recipes.map((it) => ({
|
|
39
|
+
conditions: it.conditions,
|
|
40
|
+
recipe: context.recipes.deserialize(it.recipe),
|
|
41
|
+
}));
|
|
42
|
+
return new ForgeConditionalRecipe(recipes);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=conditional.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conditional.js","sourceRoot":"","sources":["../../../src/serializer/forge/conditional.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAA2B,MAAM,YAAY,CAAC;AACrD,OAAO,EAAqB,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAuB,MAAM,aAAa,CAAC;AAYlD,MAAM,OAAO,sBAAuB,SAAQ,MAAM;IACnB;IAA7B,YAA6B,OAAuC;QAClE,KAAK,EAAE,CAAC;QADmB,YAAO,GAAP,OAAO,CAAgC;IAEpE,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC;IAClE,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;IAC9D,CAAC;IAEQ,MAAM,CAAC,QAAwB;QACtC,OAAO,IAAI,sBAAsB,CAC/B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YACxB,GAAG,EAAE;YACL,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;SACnC,CAAC,CAAC,CACJ,CAAC;IACJ,CAAC;IAEQ,SAAS,CAChB,OAA2B;QAE3B,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;gBACjC,GAAG,EAAE;gBACL,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC;aAC7C,CAAC,CAAC;SACJ,CAAC;IACJ,CAAC;IAEQ,eAAe;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC5D,CAAC;CACF;AAED,MAAM,OAAO,4BAA6B,SAAQ,YAGjD;IACU,WAAW,CAClB,UAA4C,EAC5C,OAA2B;QAE3B,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,CACpC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YACP,UAAU,EAAE,EAAE,CAAC,UAAU;YACzB,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC,MAAM,CAAC;SAC/C,CAAC,CACH,CAAC;QAEF,OAAO,IAAI,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;CACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type NormalizedId } from "@adeficior/data-modifier-core";
|
|
2
|
+
import { type Replacer } from "@adeficior/data-modifier-core/serializer";
|
|
3
|
+
import { type Ingredient, type Result } from "@adeficior/data-modifier-ingredients";
|
|
4
|
+
import { type RecipeDefinition } from "../schema";
|
|
5
|
+
import { type Recipe } from "./abstract";
|
|
6
|
+
import { type RecipeParseContext } from "./context";
|
|
7
|
+
import { type RecipeModifier } from "./modifier";
|
|
8
|
+
export declare class RecipeHolder {
|
|
9
|
+
private readonly definition;
|
|
10
|
+
private readonly recipe;
|
|
11
|
+
readonly serializerType: NormalizedId;
|
|
12
|
+
constructor(definition: RecipeDefinition, recipe: Recipe);
|
|
13
|
+
serialize(context: RecipeParseContext): {
|
|
14
|
+
type: import("@adeficior/data-modifier/generated").RecipeSerializerId;
|
|
15
|
+
conditions?: import("@adeficior/data-modifier-core").ForgeCondition[];
|
|
16
|
+
"neoforge:conditions"?: import("@adeficior/data-modifier-core").ForgeCondition[];
|
|
17
|
+
"fabric:load_conditions"?: import("@adeficior/data-modifier-core").FabricCondition[];
|
|
18
|
+
};
|
|
19
|
+
getIngredients(): Ingredient[];
|
|
20
|
+
getResults(): Result[];
|
|
21
|
+
modify(modifier: RecipeModifier): RecipeHolder;
|
|
22
|
+
replaceIngredient(replace: Replacer<Ingredient>): RecipeHolder;
|
|
23
|
+
replaceResult(replace: Replacer<Result>): RecipeHolder;
|
|
24
|
+
getTypes(): NormalizedId[];
|
|
25
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { encodeId } from "@adeficior/data-modifier-core";
|
|
2
|
+
import {} from "@adeficior/data-modifier-core/serializer";
|
|
3
|
+
import {} from "@adeficior/data-modifier-ingredients";
|
|
4
|
+
import {} from "../schema";
|
|
5
|
+
import {} from "./abstract";
|
|
6
|
+
import {} from "./context";
|
|
7
|
+
import {} from "./modifier";
|
|
8
|
+
function keep() {
|
|
9
|
+
return (it) => it;
|
|
10
|
+
}
|
|
11
|
+
export class RecipeHolder {
|
|
12
|
+
definition;
|
|
13
|
+
recipe;
|
|
14
|
+
serializerType;
|
|
15
|
+
constructor(definition, recipe) {
|
|
16
|
+
this.definition = definition;
|
|
17
|
+
this.recipe = recipe;
|
|
18
|
+
this.serializerType = encodeId(definition.type);
|
|
19
|
+
}
|
|
20
|
+
serialize(context) {
|
|
21
|
+
return {
|
|
22
|
+
...this.definition,
|
|
23
|
+
...this.recipe.serialize(context),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
getIngredients() {
|
|
27
|
+
return this.recipe.getIngredients();
|
|
28
|
+
}
|
|
29
|
+
getResults() {
|
|
30
|
+
return this.recipe.getResults();
|
|
31
|
+
}
|
|
32
|
+
modify(modifier) {
|
|
33
|
+
const modified = this.recipe.modify(modifier);
|
|
34
|
+
return new RecipeHolder(this.definition, modified);
|
|
35
|
+
}
|
|
36
|
+
replaceIngredient(replace) {
|
|
37
|
+
return this.modify({
|
|
38
|
+
ingredient: replace,
|
|
39
|
+
result: keep(),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
replaceResult(replace) {
|
|
43
|
+
return this.modify({
|
|
44
|
+
ingredient: keep(),
|
|
45
|
+
result: replace,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
getTypes() {
|
|
49
|
+
return [this.serializerType, ...this.recipe.additionalTypes()];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=holder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"holder.js","sourceRoot":"","sources":["../../src/serializer/holder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAqB,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAiB,MAAM,0CAA0C,CAAC;AACzE,OAAO,EAGN,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAyB,MAAM,WAAW,CAAC;AAClD,OAAO,EAAe,MAAM,YAAY,CAAC;AACzC,OAAO,EAA2B,MAAM,WAAW,CAAC;AACpD,OAAO,EAAuB,MAAM,YAAY,CAAC;AAEjD,SAAS,IAAI;IACX,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;AACpB,CAAC;AAED,MAAM,OAAO,YAAY;IAIJ;IACA;IAJV,cAAc,CAAe;IAEtC,YACmB,UAA4B,EAC5B,MAAc;QADd,eAAU,GAAV,UAAU,CAAkB;QAC5B,WAAM,GAAN,MAAM,CAAQ;QAE/B,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IAClD,CAAC;IAED,SAAS,CAAC,OAA2B;QACnC,OAAO;YACL,GAAG,IAAI,CAAC,UAAU;YAClB,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC;SAClC,CAAC;IACJ,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;IACtC,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;IAClC,CAAC;IAED,MAAM,CAAC,QAAwB;QAC7B,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC9C,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IACrD,CAAC;IAED,iBAAiB,CAAC,OAA6B;QAC7C,OAAO,IAAI,CAAC,MAAM,CAAC;YACjB,UAAU,EAAE,OAAO;YACnB,MAAM,EAAE,IAAI,EAAE;SACf,CAAC,CAAC;IACL,CAAC;IAED,aAAa,CAAC,OAAyB;QACrC,OAAO,IAAI,CAAC,MAAM,CAAC;YACjB,UAAU,EAAE,IAAI,EAAE;YAClB,MAAM,EAAE,OAAO;SAChB,CAAC,CAAC;IACL,CAAC;IAED,QAAQ;QACN,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC,CAAC;IACjE,CAAC;CACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type Ingredient, type Result } from "@adeficior/data-modifier-ingredients";
|
|
2
|
+
import { type RecipeDefinition } from "../schema";
|
|
3
|
+
import { Recipe, RecipeParser } from "./abstract";
|
|
4
|
+
import { type RecipeParseContext } from "./context";
|
|
5
|
+
import { type RecipeModifier } from "./modifier";
|
|
6
|
+
export type ManyToManyRecipeDefinition = RecipeDefinition & Readonly<{
|
|
7
|
+
ingredients: unknown[];
|
|
8
|
+
results: unknown[];
|
|
9
|
+
}>;
|
|
10
|
+
export declare class ManyToManyRecipe extends Recipe {
|
|
11
|
+
protected readonly ingredients: Ingredient[];
|
|
12
|
+
protected readonly results: Result[];
|
|
13
|
+
constructor(ingredients: Ingredient[], results: Result[]);
|
|
14
|
+
getIngredients(): Ingredient[];
|
|
15
|
+
getResults(): Result[];
|
|
16
|
+
modify(modifier: RecipeModifier): ManyToManyRecipe;
|
|
17
|
+
serialize(context: RecipeParseContext): Partial<ManyToManyRecipeDefinition>;
|
|
18
|
+
}
|
|
19
|
+
export declare class ManyToManyRecipeParser<TDefinition extends ManyToManyRecipeDefinition> extends RecipeParser<TDefinition, ManyToManyRecipe> {
|
|
20
|
+
deserialize(definition: TDefinition, context: RecipeParseContext): ManyToManyRecipe;
|
|
21
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {} from "@adeficior/data-modifier-ingredients";
|
|
2
|
+
import {} from "../schema";
|
|
3
|
+
import { Recipe, RecipeParser } from "./abstract";
|
|
4
|
+
import {} from "./context";
|
|
5
|
+
import {} from "./modifier";
|
|
6
|
+
export class ManyToManyRecipe extends Recipe {
|
|
7
|
+
ingredients;
|
|
8
|
+
results;
|
|
9
|
+
constructor(ingredients, results) {
|
|
10
|
+
super();
|
|
11
|
+
this.ingredients = ingredients;
|
|
12
|
+
this.results = results;
|
|
13
|
+
}
|
|
14
|
+
getIngredients() {
|
|
15
|
+
return this.ingredients;
|
|
16
|
+
}
|
|
17
|
+
getResults() {
|
|
18
|
+
return this.results;
|
|
19
|
+
}
|
|
20
|
+
modify(modifier) {
|
|
21
|
+
return new ManyToManyRecipe(this.ingredients.map(modifier.ingredient), this.results.map(modifier.result));
|
|
22
|
+
}
|
|
23
|
+
serialize(context) {
|
|
24
|
+
return {
|
|
25
|
+
results: context.results.serializeList(this.results),
|
|
26
|
+
ingredients: context.ingredients.serializeList(this.ingredients),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export class ManyToManyRecipeParser extends RecipeParser {
|
|
31
|
+
deserialize(definition, context) {
|
|
32
|
+
const ingredients = context.ingredients.deserializeList(definition.ingredients);
|
|
33
|
+
const results = context.results.deserializeList(definition.results);
|
|
34
|
+
return new ManyToManyRecipe(ingredients, results);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=manyToMany.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manyToMany.js","sourceRoot":"","sources":["../../src/serializer/manyToMany.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAyB,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAA2B,MAAM,WAAW,CAAC;AACpD,OAAO,EAAuB,MAAM,YAAY,CAAC;AAQjD,MAAM,OAAO,gBAAiB,SAAQ,MAAM;IAErB;IACA;IAFrB,YACqB,WAAyB,EACzB,OAAiB;QAEpC,KAAK,EAAE,CAAC;QAHW,gBAAW,GAAX,WAAW,CAAc;QACzB,YAAO,GAAP,OAAO,CAAU;IAGtC,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAEQ,MAAM,CAAC,QAAwB;QACtC,OAAO,IAAI,gBAAgB,CACzB,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,EACzC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAClC,CAAC;IACJ,CAAC;IAEQ,SAAS,CAChB,OAA2B;QAE3B,OAAO;YACL,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC;YACpD,WAAW,EAAE,OAAO,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC;SACjE,CAAC;IACJ,CAAC;CACF;AAED,MAAM,OAAO,sBAEX,SAAQ,YAA2C;IACnD,WAAW,CACT,UAAuB,EACvB,OAA2B;QAE3B,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,eAAe,CACrD,UAAU,CAAC,WAAW,CACvB,CAAC;QACF,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACpE,OAAO,IAAI,gBAAgB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;CACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type Ingredient, type Result } from "@adeficior/data-modifier-ingredients";
|
|
2
|
+
import { type RecipeDefinition } from "../schema";
|
|
3
|
+
import { Recipe, RecipeParser } from "./abstract";
|
|
4
|
+
import { type RecipeParseContext } from "./context";
|
|
5
|
+
import { type RecipeModifier } from "./modifier";
|
|
6
|
+
export type ManyToOneRecipeDefinition = RecipeDefinition & Readonly<{
|
|
7
|
+
ingredients: unknown[];
|
|
8
|
+
result: unknown;
|
|
9
|
+
}>;
|
|
10
|
+
export declare class ManyToOneRecipe extends Recipe {
|
|
11
|
+
protected readonly ingredients: Ingredient[];
|
|
12
|
+
protected readonly result: Result;
|
|
13
|
+
constructor(ingredients: Ingredient[], result: Result);
|
|
14
|
+
getIngredients(): Ingredient[];
|
|
15
|
+
getResults(): Result[];
|
|
16
|
+
modify(modifier: RecipeModifier): ManyToOneRecipe;
|
|
17
|
+
serialize(context: RecipeParseContext): Partial<ManyToOneRecipeDefinition>;
|
|
18
|
+
}
|
|
19
|
+
export declare class ManyToOneRecipeParser<TDefinition extends ManyToOneRecipeDefinition> extends RecipeParser<TDefinition, ManyToOneRecipe> {
|
|
20
|
+
deserialize(definition: TDefinition, context: RecipeParseContext): ManyToOneRecipe;
|
|
21
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {} from "@adeficior/data-modifier-ingredients";
|
|
2
|
+
import {} from "../schema";
|
|
3
|
+
import { Recipe, RecipeParser } from "./abstract";
|
|
4
|
+
import {} from "./context";
|
|
5
|
+
import {} from "./modifier";
|
|
6
|
+
export class ManyToOneRecipe extends Recipe {
|
|
7
|
+
ingredients;
|
|
8
|
+
result;
|
|
9
|
+
constructor(ingredients, result) {
|
|
10
|
+
super();
|
|
11
|
+
this.ingredients = ingredients;
|
|
12
|
+
this.result = result;
|
|
13
|
+
}
|
|
14
|
+
getIngredients() {
|
|
15
|
+
return this.ingredients;
|
|
16
|
+
}
|
|
17
|
+
getResults() {
|
|
18
|
+
return [this.result];
|
|
19
|
+
}
|
|
20
|
+
modify(modifier) {
|
|
21
|
+
return new ManyToOneRecipe(this.ingredients.map(modifier.ingredient), modifier.result(this.result));
|
|
22
|
+
}
|
|
23
|
+
serialize(context) {
|
|
24
|
+
return {
|
|
25
|
+
result: context.results.serialize(this.result),
|
|
26
|
+
ingredients: context.ingredients.serializeList(this.ingredients),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export class ManyToOneRecipeParser extends RecipeParser {
|
|
31
|
+
deserialize(definition, context) {
|
|
32
|
+
const ingredients = context.ingredients.deserializeList(definition.ingredients);
|
|
33
|
+
const result = context.results.deserialize(definition.result);
|
|
34
|
+
return new ManyToOneRecipe(ingredients, result);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=manyToOne.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manyToOne.js","sourceRoot":"","sources":["../../src/serializer/manyToOne.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAyB,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAA2B,MAAM,WAAW,CAAC;AACpD,OAAO,EAAuB,MAAM,YAAY,CAAC;AAQjD,MAAM,OAAO,eAAgB,SAAQ,MAAM;IAEpB;IACA;IAFrB,YACqB,WAAyB,EACzB,MAAc;QAEjC,KAAK,EAAE,CAAC;QAHW,gBAAW,GAAX,WAAW,CAAc;QACzB,WAAM,GAAN,MAAM,CAAQ;IAGnC,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,UAAU;QACR,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC;IAEQ,MAAM,CAAC,QAAwB;QACtC,OAAO,IAAI,eAAe,CACxB,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,EACzC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAC7B,CAAC;IACJ,CAAC;IAEQ,SAAS,CAChB,OAA2B;QAE3B,OAAO;YACL,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC;YAC9C,WAAW,EAAE,OAAO,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC;SACjE,CAAC;IACJ,CAAC;CACF;AAED,MAAM,OAAO,qBAEX,SAAQ,YAA0C;IAClD,WAAW,CACT,UAAuB,EACvB,OAA2B;QAE3B,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,eAAe,CACrD,UAAU,CAAC,WAAW,CACvB,CAAC;QACF,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAC9D,OAAO,IAAI,eAAe,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAClD,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modifier.js","sourceRoot":"","sources":["../../src/serializer/modifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,MAAM,0CAA0C,CAAC;AACzE,OAAO,EAGN,MAAM,sCAAsC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type Ingredient, type Result } from "@adeficior/data-modifier-ingredients";
|
|
2
|
+
import { type RecipeDefinition } from "../schema";
|
|
3
|
+
import { Recipe, RecipeParser } from "./abstract";
|
|
4
|
+
import { type RecipeParseContext } from "./context";
|
|
5
|
+
import { type RecipeModifier } from "./modifier";
|
|
6
|
+
export type OneToOneRecipeDefinition = RecipeDefinition & Readonly<{
|
|
7
|
+
ingredient: unknown;
|
|
8
|
+
result: unknown;
|
|
9
|
+
}>;
|
|
10
|
+
export declare class OneToOneRecipe extends Recipe {
|
|
11
|
+
protected readonly ingredient: Ingredient;
|
|
12
|
+
protected readonly result: Result;
|
|
13
|
+
constructor(ingredient: Ingredient, result: Result);
|
|
14
|
+
getIngredients(): Ingredient[];
|
|
15
|
+
getResults(): Result[];
|
|
16
|
+
modify(modifier: RecipeModifier): OneToOneRecipe;
|
|
17
|
+
serialize(context: RecipeParseContext): Partial<OneToOneRecipeDefinition>;
|
|
18
|
+
}
|
|
19
|
+
export declare class OneToOneRecipeParser<TDefinition extends OneToOneRecipeDefinition> extends RecipeParser<TDefinition, OneToOneRecipe> {
|
|
20
|
+
deserialize(definition: TDefinition, context: RecipeParseContext): OneToOneRecipe;
|
|
21
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {} from "@adeficior/data-modifier-ingredients";
|
|
2
|
+
import {} from "../schema";
|
|
3
|
+
import { Recipe, RecipeParser } from "./abstract";
|
|
4
|
+
import {} from "./context";
|
|
5
|
+
import {} from "./modifier";
|
|
6
|
+
export class OneToOneRecipe extends Recipe {
|
|
7
|
+
ingredient;
|
|
8
|
+
result;
|
|
9
|
+
constructor(ingredient, result) {
|
|
10
|
+
super();
|
|
11
|
+
this.ingredient = ingredient;
|
|
12
|
+
this.result = result;
|
|
13
|
+
}
|
|
14
|
+
getIngredients() {
|
|
15
|
+
return [this.ingredient];
|
|
16
|
+
}
|
|
17
|
+
getResults() {
|
|
18
|
+
return [this.result];
|
|
19
|
+
}
|
|
20
|
+
modify(modifier) {
|
|
21
|
+
return new OneToOneRecipe(modifier.ingredient(this.ingredient), modifier.result(this.result));
|
|
22
|
+
}
|
|
23
|
+
serialize(context) {
|
|
24
|
+
return {
|
|
25
|
+
result: context.results.serialize(this.result),
|
|
26
|
+
ingredient: context.ingredients.serialize(this.ingredient),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export class OneToOneRecipeParser extends RecipeParser {
|
|
31
|
+
deserialize(definition, context) {
|
|
32
|
+
const ingredient = context.ingredients.deserialize(definition.ingredient);
|
|
33
|
+
const result = context.results.deserialize(definition.result);
|
|
34
|
+
return new OneToOneRecipe(ingredient, result);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=oneToOne.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oneToOne.js","sourceRoot":"","sources":["../../src/serializer/oneToOne.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAyB,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAA2B,MAAM,WAAW,CAAC;AACpD,OAAO,EAAuB,MAAM,YAAY,CAAC;AAQjD,MAAM,OAAO,cAAe,SAAQ,MAAM;IAEnB;IACA;IAFrB,YACqB,UAAsB,EACtB,MAAc;QAEjC,KAAK,EAAE,CAAC;QAHW,eAAU,GAAV,UAAU,CAAY;QACtB,WAAM,GAAN,MAAM,CAAQ;IAGnC,CAAC;IAED,cAAc;QACZ,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC3B,CAAC;IAED,UAAU;QACR,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC;IAEQ,MAAM,CAAC,QAAwB;QACtC,OAAO,IAAI,cAAc,CACvB,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,EACpC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAC7B,CAAC;IACJ,CAAC;IAEQ,SAAS,CAChB,OAA2B;QAE3B,OAAO;YACL,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC;YAC9C,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC;SAC3D,CAAC;IACJ,CAAC;CACF;AAED,MAAM,OAAO,oBAEX,SAAQ,YAAyC;IACjD,WAAW,CACT,UAAuB,EACvB,OAA2B;QAE3B,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QAC1E,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAC9D,OAAO,IAAI,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAChD,CAAC;CACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type IngredientMap, type IngredientMapInput, type Result } from "@adeficior/data-modifier-ingredients";
|
|
2
|
+
import { type RecipeDefinition } from "../../schema";
|
|
3
|
+
import { Recipe, RecipeParser } from "../abstract";
|
|
4
|
+
import { type RecipeParseContext } from "../context";
|
|
5
|
+
import { type RecipeModifier } from "../modifier";
|
|
6
|
+
export type ShapedRecipeDefinition = RecipeDefinition & Readonly<{
|
|
7
|
+
key: IngredientMapInput;
|
|
8
|
+
pattern: string[];
|
|
9
|
+
result: unknown;
|
|
10
|
+
}>;
|
|
11
|
+
export declare class ShapedRecipe extends Recipe {
|
|
12
|
+
private readonly ingredients;
|
|
13
|
+
private readonly result;
|
|
14
|
+
constructor(ingredients: IngredientMap, result: Result);
|
|
15
|
+
getIngredients(): import("@adeficior/data-modifier-ingredients").Ingredient[];
|
|
16
|
+
getResults(): Result[];
|
|
17
|
+
modify(modifier: RecipeModifier): ShapedRecipe;
|
|
18
|
+
serialize(context: RecipeParseContext): Partial<ShapedRecipeDefinition>;
|
|
19
|
+
}
|
|
20
|
+
export declare class ShapedParser extends RecipeParser<ShapedRecipeDefinition, ShapedRecipe> {
|
|
21
|
+
deserialize(definition: ShapedRecipeDefinition, context: RecipeParseContext): ShapedRecipe;
|
|
22
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {} from "@adeficior/data-modifier-ingredients";
|
|
2
|
+
import {} from "../../schema";
|
|
3
|
+
import { Recipe, RecipeParser } from "../abstract";
|
|
4
|
+
import {} from "../context";
|
|
5
|
+
import {} from "../modifier";
|
|
6
|
+
export class ShapedRecipe extends Recipe {
|
|
7
|
+
ingredients;
|
|
8
|
+
result;
|
|
9
|
+
constructor(ingredients, result) {
|
|
10
|
+
super();
|
|
11
|
+
this.ingredients = ingredients;
|
|
12
|
+
this.result = result;
|
|
13
|
+
}
|
|
14
|
+
getIngredients() {
|
|
15
|
+
return this.ingredients.list();
|
|
16
|
+
}
|
|
17
|
+
getResults() {
|
|
18
|
+
return [this.result];
|
|
19
|
+
}
|
|
20
|
+
modify(modifier) {
|
|
21
|
+
return new ShapedRecipe(this.ingredients.replace(modifier.ingredient), modifier.result(this.result));
|
|
22
|
+
}
|
|
23
|
+
serialize(context) {
|
|
24
|
+
return {
|
|
25
|
+
key: context.ingredients.serializeIngredientMap(this.ingredients),
|
|
26
|
+
result: context.results.serialize(this.result),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export class ShapedParser extends RecipeParser {
|
|
31
|
+
deserialize(definition, context) {
|
|
32
|
+
const ingredients = context.ingredients.deserializeIngredientMap(definition.key);
|
|
33
|
+
const result = context.results.deserialize(definition.result);
|
|
34
|
+
return new ShapedRecipe(ingredients, result);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=shaped.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shaped.js","sourceRoot":"","sources":["../../../src/serializer/vanilla/shaped.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAyB,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAA2B,MAAM,YAAY,CAAC;AACrD,OAAO,EAAuB,MAAM,aAAa,CAAC;AASlD,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;IAEQ,MAAM,CAAC,QAAwB;QACtC,OAAO,IAAI,YAAY,CACrB,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,EAC7C,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAC7B,CAAC;IACJ,CAAC;IAEQ,SAAS,CAChB,OAA2B;QAE3B,OAAO;YACL,GAAG,EAAE,OAAO,CAAC,WAAW,CAAC,sBAAsB,CAAC,IAAI,CAAC,WAAW,CAAC;YACjE,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,wBAAwB,CAC9D,UAAU,CAAC,GAAG,CACf,CAAC;QACF,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAC9D,OAAO,IAAI,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAC/C,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shapeless.js","sourceRoot":"","sources":["../../../src/serializer/vanilla/shapeless.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,GAEtB,MAAM,cAAc,CAAC;AAItB,MAAM,OAAO,eAAgB,SAAQ,qBAAgD;CAAG"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Ingredient, type Result } from "@adeficior/data-modifier-ingredients";
|
|
2
|
+
import { type RecipeDefinition } from "../../schema";
|
|
3
|
+
import { Recipe, RecipeParser } from "../abstract";
|
|
4
|
+
import { type RecipeParseContext } from "../context";
|
|
5
|
+
import { type RecipeModifier } from "../modifier";
|
|
6
|
+
export type SmeltingRecipeDefinition = RecipeDefinition & Readonly<{
|
|
7
|
+
ingredient: unknown;
|
|
8
|
+
result: unknown;
|
|
9
|
+
experience?: number;
|
|
10
|
+
}>;
|
|
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
|
+
modify(modifier: RecipeModifier): SmeltingRecipe;
|
|
18
|
+
serialize(context: RecipeParseContext): Partial<SmeltingRecipeDefinition>;
|
|
19
|
+
}
|
|
20
|
+
export declare class SmeltingParser extends RecipeParser<SmeltingRecipeDefinition, SmeltingRecipe> {
|
|
21
|
+
deserialize(definition: SmeltingRecipeDefinition, context: RecipeParseContext): SmeltingRecipe;
|
|
22
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {} from "@adeficior/data-modifier-ingredients";
|
|
2
|
+
import {} from "../../schema";
|
|
3
|
+
import { Recipe, RecipeParser } from "../abstract";
|
|
4
|
+
import {} from "../context";
|
|
5
|
+
import {} from "../modifier";
|
|
6
|
+
export class SmeltingRecipe extends Recipe {
|
|
7
|
+
ingredient;
|
|
8
|
+
result;
|
|
9
|
+
constructor(ingredient, result) {
|
|
10
|
+
super();
|
|
11
|
+
this.ingredient = ingredient;
|
|
12
|
+
this.result = result;
|
|
13
|
+
}
|
|
14
|
+
getIngredients() {
|
|
15
|
+
return [this.ingredient];
|
|
16
|
+
}
|
|
17
|
+
getResults() {
|
|
18
|
+
return [this.result];
|
|
19
|
+
}
|
|
20
|
+
modify(modifier) {
|
|
21
|
+
return new SmeltingRecipe(modifier.ingredient(this.ingredient), modifier.result(this.result));
|
|
22
|
+
}
|
|
23
|
+
serialize(context) {
|
|
24
|
+
return {
|
|
25
|
+
ingredient: context.ingredients.serialize(this.ingredient),
|
|
26
|
+
result: context.results.serialize(this.result),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export class SmeltingParser extends RecipeParser {
|
|
31
|
+
deserialize(definition, context) {
|
|
32
|
+
const ingredient = context.ingredients.deserialize(definition.ingredient);
|
|
33
|
+
const result = context.results.deserialize(definition.result);
|
|
34
|
+
return new SmeltingRecipe(ingredient, result);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=smelting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smelting.js","sourceRoot":"","sources":["../../../src/serializer/vanilla/smelting.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAyB,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAA2B,MAAM,YAAY,CAAC;AACrD,OAAO,EAAuB,MAAM,aAAa,CAAC;AASlD,MAAM,OAAO,cAAe,SAAQ,MAAM;IAErB;IACA;IAFnB,YACmB,UAAsB,EACtB,MAAc;QAE/B,KAAK,EAAE,CAAC;QAHS,eAAU,GAAV,UAAU,CAAY;QACtB,WAAM,GAAN,MAAM,CAAQ;IAGjC,CAAC;IAED,cAAc;QACZ,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC3B,CAAC;IAED,UAAU;QACR,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC;IAEQ,MAAM,CAAC,QAAwB;QACtC,OAAO,IAAI,cAAc,CACvB,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,EACpC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAC7B,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,WAAW,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QAC1E,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAC9D,OAAO,IAAI,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAChD,CAAC;CACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type Ingredient, type Result } from "@adeficior/data-modifier-ingredients";
|
|
2
|
+
import { type RecipeDefinition } from "../../schema";
|
|
3
|
+
import { Recipe, RecipeParser } from "../abstract";
|
|
4
|
+
import { type RecipeParseContext } from "../context";
|
|
5
|
+
import { type RecipeModifier } from "../modifier";
|
|
6
|
+
export type SmithingRecipeDefinition = RecipeDefinition & Readonly<{
|
|
7
|
+
base: unknown;
|
|
8
|
+
addition: unknown;
|
|
9
|
+
result?: unknown;
|
|
10
|
+
template?: unknown;
|
|
11
|
+
}>;
|
|
12
|
+
export declare class SmithingRecipe extends Recipe {
|
|
13
|
+
private readonly base;
|
|
14
|
+
private readonly addition;
|
|
15
|
+
private readonly result;
|
|
16
|
+
private readonly template;
|
|
17
|
+
constructor(base: Ingredient, addition: Ingredient, result: Result | undefined, template: Ingredient | undefined);
|
|
18
|
+
getIngredients(): Ingredient[];
|
|
19
|
+
getResults(): Result[];
|
|
20
|
+
modify(modifier: RecipeModifier): SmithingRecipe;
|
|
21
|
+
serialize(context: RecipeParseContext): Partial<SmithingRecipeDefinition>;
|
|
22
|
+
}
|
|
23
|
+
export declare class SmithingParser extends RecipeParser<SmithingRecipeDefinition, SmithingRecipe> {
|
|
24
|
+
deserialize(definition: SmithingRecipeDefinition, context: RecipeParseContext): SmithingRecipe;
|
|
25
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {} from "@adeficior/data-modifier-ingredients";
|
|
2
|
+
import { notNull } from "@adeficior/pack-resolver";
|
|
3
|
+
import {} from "../../schema";
|
|
4
|
+
import { Recipe, RecipeParser } from "../abstract";
|
|
5
|
+
import {} from "../context";
|
|
6
|
+
import {} from "../modifier";
|
|
7
|
+
export class SmithingRecipe extends Recipe {
|
|
8
|
+
base;
|
|
9
|
+
addition;
|
|
10
|
+
result;
|
|
11
|
+
template;
|
|
12
|
+
constructor(base, addition, result, template) {
|
|
13
|
+
super();
|
|
14
|
+
this.base = base;
|
|
15
|
+
this.addition = addition;
|
|
16
|
+
this.result = result;
|
|
17
|
+
this.template = template;
|
|
18
|
+
}
|
|
19
|
+
getIngredients() {
|
|
20
|
+
return [this.base, this.addition, this.template].filter(notNull);
|
|
21
|
+
}
|
|
22
|
+
getResults() {
|
|
23
|
+
return [this.result].filter(notNull);
|
|
24
|
+
}
|
|
25
|
+
modify(modifier) {
|
|
26
|
+
return new SmithingRecipe(modifier.ingredient(this.base), modifier.ingredient(this.addition), this.result && modifier.result(this.result), this.template && modifier.ingredient(this.template));
|
|
27
|
+
}
|
|
28
|
+
serialize(context) {
|
|
29
|
+
return {
|
|
30
|
+
base: context.ingredients.serialize(this.base),
|
|
31
|
+
addition: context.ingredients.serialize(this.addition),
|
|
32
|
+
result: context.results.serializeOptional(this.result),
|
|
33
|
+
template: context.ingredients.serializeOptional(this.template),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export class SmithingParser extends RecipeParser {
|
|
38
|
+
deserialize(definition, context) {
|
|
39
|
+
const base = context.ingredients.deserialize(definition.base);
|
|
40
|
+
const addition = context.ingredients.deserialize(definition.addition);
|
|
41
|
+
const result = context.results.deserializeOptional(definition.result);
|
|
42
|
+
const template = context.ingredients.deserializeOptional(definition.addition);
|
|
43
|
+
return new SmithingRecipe(base, addition, result, template);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=smithing.js.map
|