cyclops-infobook-html 4.0.1 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +23 -2
  2. package/bin/compress-icons.d.ts +2 -0
  3. package/bin/compress-icons.js +47 -0
  4. package/bin/generate-icons.d.ts +2 -0
  5. package/bin/generate-icons.js +68 -0
  6. package/bin/generate-infobook-html.js +16 -8
  7. package/bin/generate-mod-metadata.js +15 -7
  8. package/index.d.ts +2 -0
  9. package/index.js +39 -24
  10. package/lib/icon/IconsCompressor.d.ts +18 -0
  11. package/lib/icon/IconsCompressor.js +81 -0
  12. package/lib/icon/IconsGenerator.d.ts +128 -0
  13. package/lib/icon/IconsGenerator.js +597 -0
  14. package/lib/infobook/FileWriter.d.ts +1 -2
  15. package/lib/infobook/FileWriter.js +21 -6
  16. package/lib/infobook/IFileWriter.d.ts +1 -2
  17. package/lib/infobook/IInfoAppendix.d.ts +1 -1
  18. package/lib/infobook/InfoBookInitializer.js +10 -2
  19. package/lib/infobook/appendix/InfoBookAppendixAd.d.ts +1 -1
  20. package/lib/infobook/appendix/InfoBookAppendixAd.js +13 -2
  21. package/lib/infobook/appendix/InfoBookAppendixHandlerAbstractRecipe.d.ts +1 -1
  22. package/lib/infobook/appendix/InfoBookAppendixHandlerAbstractRecipe.js +13 -4
  23. package/lib/infobook/appendix/InfoBookAppendixHandlerAdvancementRewards.js +14 -5
  24. package/lib/infobook/appendix/InfoBookAppendixHandlerCraftingRecipe.d.ts +1 -1
  25. package/lib/infobook/appendix/InfoBookAppendixHandlerCraftingRecipe.js +39 -28
  26. package/lib/infobook/appendix/InfoBookAppendixHandlerImage.js +13 -4
  27. package/lib/infobook/appendix/InfoBookAppendixHandlerKeybinding.js +12 -3
  28. package/lib/infobook/appendix/InfoBookAppendixHandlerSmeltingRecipe.d.ts +1 -1
  29. package/lib/infobook/appendix/InfoBookAppendixHandlerSmeltingRecipe.js +16 -5
  30. package/lib/infobook/appendix/InfoBookAppendixHandlerTextfield.js +11 -2
  31. package/lib/infobook/appendix/InfoBookAppendixTagIndex.d.ts +1 -1
  32. package/lib/infobook/appendix/InfoBookAppendixTagIndex.js +31 -20
  33. package/lib/modloader/ModLoader.d.ts +2 -3
  34. package/lib/modloader/ModLoader.js +56 -48
  35. package/lib/parse/XmlInfoBookParser.js +2 -2
  36. package/lib/resource/ResourceHandler.d.ts +2 -1
  37. package/lib/resource/ResourceHandler.js +7 -3
  38. package/lib/resource/ResourceLoader.d.ts +5 -5
  39. package/lib/resource/ResourceLoader.js +37 -28
  40. package/lib/serialize/HtmlInfoBookSerializer.d.ts +2 -2
  41. package/lib/serialize/HtmlInfoBookSerializer.js +80 -65
  42. package/package.json +10 -6
@@ -19,5 +19,5 @@ export interface IInfoAppendix {
19
19
  * @param serializer The HTML serializer.
20
20
  * @returns {string} The HTML representation of this appendix.
21
21
  */
22
- toHtml(context: ISerializeContext, fileWriter: IFileWriter, serializer: HtmlInfoBookSerializer): string;
22
+ toHtml(context: ISerializeContext, fileWriter: IFileWriter, serializer: HtmlInfoBookSerializer): Promise<string>;
23
23
  }
@@ -1,7 +1,15 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.InfoBookInitializer = void 0;
4
- const tslib_1 = require("tslib");
5
13
  const XmlInfoBookParser_1 = require("../parse/XmlInfoBookParser");
6
14
  const InfoBookAppendixTagIndex_1 = require("./appendix/InfoBookAppendixTagIndex");
7
15
  /**
@@ -21,7 +29,7 @@ class InfoBookInitializer {
21
29
  this.parser = new XmlInfoBookParser_1.XmlInfoBookParser();
22
30
  }
23
31
  initialize(resourceHandler) {
24
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
32
+ return __awaiter(this, void 0, void 0, function* () {
25
33
  // Initialize the main book
26
34
  const infoBook = yield this.parser.parse(this.sectionsFile, this.modId);
27
35
  // Inject sections
@@ -8,5 +8,5 @@ export declare class InfoBookAppendixAd implements IInfoAppendix {
8
8
  readonly skipWrapper: boolean;
9
9
  private readonly templateTagIndex;
10
10
  constructor();
11
- toHtml(context: ISerializeContext, fileWriter: IFileWriter, serializer: HtmlInfoBookSerializer): string;
11
+ toHtml(context: ISerializeContext, fileWriter: IFileWriter, serializer: HtmlInfoBookSerializer): Promise<string>;
12
12
  }
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.InfoBookAppendixAd = void 0;
4
13
  const pug_1 = require("pug");
@@ -8,10 +17,12 @@ const pug_1 = require("pug");
8
17
  class InfoBookAppendixAd {
9
18
  constructor() {
10
19
  this.skipWrapper = true;
11
- this.templateTagIndex = pug_1.compileFile(__dirname + '/../../../template/appendix/ad.pug');
20
+ this.templateTagIndex = (0, pug_1.compileFile)(__dirname + '/../../../template/appendix/ad.pug');
12
21
  }
13
22
  toHtml(context, fileWriter, serializer) {
14
- return this.templateTagIndex(context.googleAdsense);
23
+ return __awaiter(this, void 0, void 0, function* () {
24
+ return this.templateTagIndex(context.googleAdsense);
25
+ });
15
26
  }
16
27
  }
17
28
  exports.InfoBookAppendixAd = InfoBookAppendixAd;
@@ -14,7 +14,7 @@ export declare abstract class InfoBookAppendixHandlerAbstractRecipe<R extends IR
14
14
  static indexRegistry<R extends IRecipe>(registryRead: IRecipeRegistryRead<R>): IRecipeRegistryIndexed<R>;
15
15
  createAppendix(data: any): IInfoAppendix;
16
16
  protected abstract getRecipeNameUnlocalized(): string;
17
- protected abstract serializeRecipe(recipe: R, context: ISerializeContext, fileWriter: IFileWriter, serializer: HtmlInfoBookSerializer): string;
17
+ protected abstract serializeRecipe(recipe: R, context: ISerializeContext, fileWriter: IFileWriter, serializer: HtmlInfoBookSerializer): Promise<string>;
18
18
  }
19
19
  export interface IRecipeRegistryRead<R extends IRecipe> {
20
20
  recipes: [R];
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.InfoBookAppendixHandlerAbstractRecipe = void 0;
4
13
  const fs = require("fs");
@@ -10,7 +19,7 @@ class InfoBookAppendixHandlerAbstractRecipe {
10
19
  constructor(id, resourceHandler, registriesPath, recipeOverrides) {
11
20
  this.id = id;
12
21
  this.resourceHandler = resourceHandler;
13
- this.registry = InfoBookAppendixHandlerAbstractRecipe.indexRegistry(JSON.parse(fs.readFileSync(path_1.join(registriesPath, id.replace(/:/g, '__') + '.json'), "utf8")));
22
+ this.registry = InfoBookAppendixHandlerAbstractRecipe.indexRegistry(JSON.parse(fs.readFileSync((0, path_1.join)(registriesPath, id.replace(/:/g, '__') + '.json'), "utf8")));
14
23
  if (recipeOverrides) {
15
24
  this.registry = Object.assign(Object.assign({}, this.registry), (recipeOverrides[id] || {}));
16
25
  }
@@ -41,9 +50,9 @@ class InfoBookAppendixHandlerAbstractRecipe {
41
50
  }
42
51
  return {
43
52
  getName: (context) => this.resourceHandler.getTranslation(this.getRecipeNameUnlocalized(), context.language),
44
- toHtml: (context, fileWriter, serializer) => {
45
- return recipes.map((recipe) => this.serializeRecipe(recipe, context, fileWriter, serializer)).join('<hr />');
46
- },
53
+ toHtml: (context, fileWriter, serializer) => __awaiter(this, void 0, void 0, function* () {
54
+ return (yield Promise.all(recipes.map((recipe) => this.serializeRecipe(recipe, context, fileWriter, serializer)))).join('<hr />');
55
+ }),
47
56
  };
48
57
  }
49
58
  }
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.InfoBookAppendixHandlerAdvancementRewards = void 0;
4
13
  const pug_1 = require("pug");
@@ -8,7 +17,7 @@ const pug_1 = require("pug");
8
17
  class InfoBookAppendixHandlerAdvancementRewards {
9
18
  constructor(resourceHandler) {
10
19
  this.resourceHandler = resourceHandler;
11
- this.templateAdvancementRewards = pug_1.compileFile(__dirname + '/../../../template/appendix/advancement_rewards.pug');
20
+ this.templateAdvancementRewards = (0, pug_1.compileFile)(__dirname + '/../../../template/appendix/advancement_rewards.pug');
12
21
  }
13
22
  createAppendix(data) {
14
23
  const advancementsData = [];
@@ -26,17 +35,17 @@ class InfoBookAppendixHandlerAdvancementRewards {
26
35
  }
27
36
  return {
28
37
  getName: (context) => this.resourceHandler.getTranslation('gui.advancements', context.language),
29
- toHtml: (context, fileWriter, serializer) => {
38
+ toHtml: (context, fileWriter, serializer) => __awaiter(this, void 0, void 0, function* () {
30
39
  const advancements = advancementsData
31
40
  .map((advancement) => ({
32
41
  description: this.resourceHandler.getTranslation(advancement.description, context.language),
33
42
  title: this.resourceHandler.getTranslation(advancement.title, context.language),
34
43
  }));
35
- const rewards = rewardsData
36
- .map((reward) => serializer.createItemDisplay(this.resourceHandler, context, fileWriter, reward, true));
44
+ const rewards = yield Promise.all(rewardsData
45
+ .map((reward) => serializer.createItemDisplay(this.resourceHandler, context, fileWriter, reward, true)));
37
46
  const rewardsString = this.resourceHandler.getTranslation(`gui.cyclopscore.rewards`, context.language);
38
47
  return this.templateAdvancementRewards({ advancements, rewards, rewardsString });
39
- },
48
+ }),
40
49
  };
41
50
  }
42
51
  }
@@ -10,7 +10,7 @@ export declare class InfoBookAppendixHandlerCraftingRecipe extends InfoBookAppen
10
10
  private readonly templateCraftingRecipe;
11
11
  constructor(resourceHandler: ResourceHandler, registriesPath: string, recipeOverrides: any);
12
12
  protected getRecipeNameUnlocalized(): string;
13
- protected serializeRecipe(recipe: IRecipeCrafting, context: ISerializeContext, fileWriter: IFileWriter, serializer: HtmlInfoBookSerializer): string;
13
+ protected serializeRecipe(recipe: IRecipeCrafting, context: ISerializeContext, fileWriter: IFileWriter, serializer: HtmlInfoBookSerializer): Promise<string>;
14
14
  }
15
15
  export interface IRecipeCrafting extends IRecipe {
16
16
  id: string;
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.InfoBookAppendixHandlerCraftingRecipe = void 0;
4
13
  const pug_1 = require("pug");
@@ -9,41 +18,43 @@ const InfoBookAppendixHandlerAbstractRecipe_1 = require("./InfoBookAppendixHandl
9
18
  class InfoBookAppendixHandlerCraftingRecipe extends InfoBookAppendixHandlerAbstractRecipe_1.InfoBookAppendixHandlerAbstractRecipe {
10
19
  constructor(resourceHandler, registriesPath, recipeOverrides) {
11
20
  super('minecraft:crafting', resourceHandler, registriesPath, recipeOverrides);
12
- this.templateCraftingRecipe = pug_1.compileFile(__dirname + '/../../../template/appendix/crafting_recipe.pug');
21
+ this.templateCraftingRecipe = (0, pug_1.compileFile)(__dirname + '/../../../template/appendix/crafting_recipe.pug');
13
22
  }
14
23
  getRecipeNameUnlocalized() {
15
24
  return 'block.minecraft.crafting_table';
16
25
  }
17
26
  serializeRecipe(recipe, context, fileWriter, serializer) {
18
- // Prepare input array
19
- const inputs = "|".repeat(9).split("|").map(() => []);
20
- // Define custom dimensions for shapeless recipes
21
- if (!recipe.width || !recipe.height) {
22
- recipe.width = recipe.height = Math.sqrt(recipe.input.length);
23
- }
24
- // Format items in grid
25
- for (let x = 0; x < 3; x++) {
26
- for (let y = 0; y < 3; y++) {
27
- let items;
28
- if (x < recipe.width && y < recipe.height) {
29
- const inputIndex = y * recipe.width + x;
30
- items = recipe.input[inputIndex] || [];
31
- }
32
- else {
33
- items = [];
34
- }
35
- if (!items.length) {
36
- items.push({ item: 'minecraft:air' });
37
- }
38
- const outputIndex = y * 3 + x;
39
- for (const item of items) {
40
- inputs[outputIndex].push(serializer.createItemDisplay(this.resourceHandler, context, fileWriter, item, true));
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ // Prepare input array
29
+ const inputs = "|".repeat(9).split("|").map(() => []);
30
+ // Define custom dimensions for shapeless recipes
31
+ if (!recipe.width || !recipe.height) {
32
+ recipe.width = recipe.height = Math.sqrt(recipe.input.length);
33
+ }
34
+ // Format items in grid
35
+ for (let x = 0; x < 3; x++) {
36
+ for (let y = 0; y < 3; y++) {
37
+ let items;
38
+ if (x < recipe.width && y < recipe.height) {
39
+ const inputIndex = y * recipe.width + x;
40
+ items = recipe.input[inputIndex] || [];
41
+ }
42
+ else {
43
+ items = [];
44
+ }
45
+ if (!items.length) {
46
+ items.push({ item: 'minecraft:air' });
47
+ }
48
+ const outputIndex = y * 3 + x;
49
+ for (const item of items) {
50
+ inputs[outputIndex].push(yield serializer.createItemDisplay(this.resourceHandler, context, fileWriter, item, true));
51
+ }
41
52
  }
42
53
  }
43
- }
44
- const output = serializer.createItemDisplay(this.resourceHandler, context, fileWriter, recipe.output, true);
45
- const appendixIcon = serializer.createItemDisplay(this.resourceHandler, context, fileWriter, { item: 'minecraft:crafting_table' }, false);
46
- return this.templateCraftingRecipe({ inputs, output, appendixIcon });
54
+ const output = yield serializer.createItemDisplay(this.resourceHandler, context, fileWriter, recipe.output, true);
55
+ const appendixIcon = yield serializer.createItemDisplay(this.resourceHandler, context, fileWriter, { item: 'minecraft:crafting_table' }, false);
56
+ return this.templateCraftingRecipe({ inputs, output, appendixIcon });
57
+ });
47
58
  }
48
59
  }
49
60
  exports.InfoBookAppendixHandlerCraftingRecipe = InfoBookAppendixHandlerCraftingRecipe;
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.InfoBookAppendixHandlerImage = void 0;
4
13
  const fs_1 = require("fs");
@@ -12,13 +21,13 @@ class InfoBookAppendixHandlerImage {
12
21
  }
13
22
  createAppendix(data) {
14
23
  const fullPath = this.resourceHandler.expandResourcePath(data._);
15
- const fileName = path_1.basename(data._);
24
+ const fileName = (0, path_1.basename)(data._);
16
25
  const { width, height } = data.$;
17
26
  return {
18
- toHtml: (context, fileWriter) => {
19
- const writtenPath = fileWriter.write(fileName, fs_1.createReadStream(fullPath));
27
+ toHtml: (context, fileWriter) => __awaiter(this, void 0, void 0, function* () {
28
+ const writtenPath = yield fileWriter.write(fileName, () => (0, fs_1.createReadStream)(fullPath));
20
29
  return `<canvas class="appendix-image" style="background: url(${writtenPath}); width: ${width * 2}px; height: ${height * 2}px; background-size: 512px 512px;"></canvas>`;
21
- },
30
+ }),
22
31
  };
23
32
  }
24
33
  }
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.InfoBookAppendixHandlerKeybinding = void 0;
4
13
  const pug_1 = require("pug");
@@ -8,17 +17,17 @@ const pug_1 = require("pug");
8
17
  class InfoBookAppendixHandlerKeybinding {
9
18
  constructor(resourceHandler) {
10
19
  this.resourceHandler = resourceHandler;
11
- this.templateKeybinding = pug_1.compileFile(__dirname + '/../../../template/appendix/keybinding.pug');
20
+ this.templateKeybinding = (0, pug_1.compileFile)(__dirname + '/../../../template/appendix/keybinding.pug');
12
21
  }
13
22
  createAppendix(data) {
14
23
  const id = data._;
15
24
  const key = this.resourceHandler.getKeybinding(id);
16
25
  return {
17
26
  getName: (context) => this.resourceHandler.getTranslation(`infobook.cyclopscore.keybinding`, context.language),
18
- toHtml: (context) => {
27
+ toHtml: (context) => __awaiter(this, void 0, void 0, function* () {
19
28
  const name = this.resourceHandler.getTranslation(id, context.language);
20
29
  return this.templateKeybinding({ name, key });
21
- },
30
+ }),
22
31
  };
23
32
  }
24
33
  }
@@ -10,7 +10,7 @@ export declare class InfoBookAppendixHandlerSmeltingRecipe extends InfoBookAppen
10
10
  private readonly templateFurnaceRecipe;
11
11
  constructor(resourceHandler: ResourceHandler, registriesPath: string, recipeOverrides: any);
12
12
  protected getRecipeNameUnlocalized(): string;
13
- protected serializeRecipe(recipe: IRecipeSmelting, context: ISerializeContext, fileWriter: IFileWriter, serializer: HtmlInfoBookSerializer): string;
13
+ protected serializeRecipe(recipe: IRecipeSmelting, context: ISerializeContext, fileWriter: IFileWriter, serializer: HtmlInfoBookSerializer): Promise<string>;
14
14
  }
15
15
  export interface IRecipeSmelting extends IRecipe {
16
16
  input: IItem[];
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.InfoBookAppendixHandlerSmeltingRecipe = void 0;
4
13
  const pug_1 = require("pug");
@@ -9,16 +18,18 @@ const InfoBookAppendixHandlerAbstractRecipe_1 = require("./InfoBookAppendixHandl
9
18
  class InfoBookAppendixHandlerSmeltingRecipe extends InfoBookAppendixHandlerAbstractRecipe_1.InfoBookAppendixHandlerAbstractRecipe {
10
19
  constructor(resourceHandler, registriesPath, recipeOverrides) {
11
20
  super('minecraft:smelting', resourceHandler, registriesPath, recipeOverrides);
12
- this.templateFurnaceRecipe = pug_1.compileFile(__dirname + '/../../../template/appendix/furnace_recipe.pug');
21
+ this.templateFurnaceRecipe = (0, pug_1.compileFile)(__dirname + '/../../../template/appendix/furnace_recipe.pug');
13
22
  }
14
23
  getRecipeNameUnlocalized() {
15
24
  return 'block.minecraft.furnace';
16
25
  }
17
26
  serializeRecipe(recipe, context, fileWriter, serializer) {
18
- const input = recipe.input.map((item) => serializer.createItemDisplay(this.resourceHandler, context, fileWriter, item, true));
19
- const output = serializer.createItemDisplay(this.resourceHandler, context, fileWriter, recipe.output, true);
20
- const appendixIcon = serializer.createItemDisplay(this.resourceHandler, context, fileWriter, { item: 'minecraft:furnace' }, false);
21
- return this.templateFurnaceRecipe({ input, output, appendixIcon });
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ const input = yield Promise.all(recipe.input.map((item) => serializer.createItemDisplay(this.resourceHandler, context, fileWriter, item, true)));
29
+ const output = yield serializer.createItemDisplay(this.resourceHandler, context, fileWriter, recipe.output, true);
30
+ const appendixIcon = yield serializer.createItemDisplay(this.resourceHandler, context, fileWriter, { item: 'minecraft:furnace' }, false);
31
+ return this.templateFurnaceRecipe({ input, output, appendixIcon });
32
+ });
22
33
  }
23
34
  }
24
35
  exports.InfoBookAppendixHandlerSmeltingRecipe = InfoBookAppendixHandlerSmeltingRecipe;
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.InfoBookAppendixHandlerTextfield = void 0;
4
13
  /**
@@ -14,9 +23,9 @@ class InfoBookAppendixHandlerTextfield {
14
23
  .replace(/\n/g, '<br \>');
15
24
  const scale = data.$.scale || 1;
16
25
  return {
17
- toHtml: (context, fileWriter) => {
26
+ toHtml: (context, fileWriter) => __awaiter(this, void 0, void 0, function* () {
18
27
  return `<div class="appendix-textfield" style="font-size: ${scale}em">${contents}</div>`;
19
- },
28
+ }),
20
29
  };
21
30
  }
22
31
  }
@@ -9,5 +9,5 @@ export declare class InfoBookAppendixTagIndex implements IInfoAppendix {
9
9
  private readonly resourceHandler;
10
10
  private readonly templateTagIndex;
11
11
  constructor(resourceHandler: ResourceHandler);
12
- toHtml(context: ISerializeContext, fileWriter: IFileWriter, serializer: HtmlInfoBookSerializer): string;
12
+ toHtml(context: ISerializeContext, fileWriter: IFileWriter, serializer: HtmlInfoBookSerializer): Promise<string>;
13
13
  }
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.InfoBookAppendixTagIndex = void 0;
4
13
  const pug_1 = require("pug");
@@ -8,29 +17,31 @@ const pug_1 = require("pug");
8
17
  class InfoBookAppendixTagIndex {
9
18
  constructor(resourceHandler) {
10
19
  this.resourceHandler = resourceHandler;
11
- this.templateTagIndex = pug_1.compileFile(__dirname + '/../../../template/appendix/tag_index.pug');
20
+ this.templateTagIndex = (0, pug_1.compileFile)(__dirname + '/../../../template/appendix/tag_index.pug');
12
21
  }
13
22
  toHtml(context, fileWriter, serializer) {
14
- const links = [];
15
- for (const tag in context.sectionIndex.tags) {
16
- const url = context.sectionIndex.tags[tag];
17
- // First try localizing as item, and if that fails, as fluid
18
- let icon;
19
- const item = { item: tag };
20
- let translationKey = this.resourceHandler.getItemTranslationKey(item);
21
- if (translationKey) {
22
- icon = serializer.createItemDisplay(this.resourceHandler, context, fileWriter, item, false);
23
+ return __awaiter(this, void 0, void 0, function* () {
24
+ const links = [];
25
+ for (const tag in context.sectionIndex.tags) {
26
+ const url = context.sectionIndex.tags[tag];
27
+ // First try localizing as item, and if that fails, as fluid
28
+ let icon;
29
+ const item = { item: tag };
30
+ let translationKey = this.resourceHandler.getItemTranslationKey(item);
31
+ if (translationKey) {
32
+ icon = yield serializer.createItemDisplay(this.resourceHandler, context, fileWriter, item, false);
33
+ }
34
+ else {
35
+ const fluid = { fluid: tag };
36
+ translationKey = this.resourceHandler.getFluidTranslationKey(fluid);
37
+ icon = yield serializer.createFluidDisplay(this.resourceHandler, context, fileWriter, fluid, false);
38
+ }
39
+ const name = this.resourceHandler.getTranslation(translationKey, context.language);
40
+ links.push({ url, name, icon });
23
41
  }
24
- else {
25
- const fluid = { fluid: tag };
26
- translationKey = this.resourceHandler.getFluidTranslationKey(fluid);
27
- icon = serializer.createFluidDisplay(this.resourceHandler, context, fileWriter, fluid, false);
28
- }
29
- const name = this.resourceHandler.getTranslation(translationKey, context.language);
30
- links.push({ url, name, icon });
31
- }
32
- links.sort((link1, link2) => link1.name.localeCompare(link2.name));
33
- return this.templateTagIndex({ links });
42
+ links.sort((link1, link2) => link1.name.localeCompare(link2.name));
43
+ return this.templateTagIndex({ links });
44
+ });
34
45
  }
35
46
  }
36
47
  exports.InfoBookAppendixTagIndex = InfoBookAppendixTagIndex;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { ChildProcess } from "child_process";
3
2
  /**
4
3
  * Takes care of installing Forge, installing mods, starting a Forge server, and fetching metadata.
@@ -79,12 +78,12 @@ export interface IModLoaderArgs {
79
78
  loader: ILoader;
80
79
  versionMinecraft: string;
81
80
  }
82
- export declare type ILoader = {
81
+ export type ILoader = {
83
82
  versionForge: string;
84
83
  } | {
85
84
  versionNeoForge: string;
86
85
  };
87
- export declare type IMod = IModMaven | IModCurseforge | IModRaw;
86
+ export type IMod = IModMaven | IModCurseforge | IModRaw;
88
87
  export interface IModMaven {
89
88
  type: 'maven';
90
89
  artifact: string;