zen-flow 2.4.2 → 2.5.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.
package/README.md CHANGED
@@ -23,7 +23,7 @@ $ npm i zen-flow -D
23
23
 
24
24
  - Easy to use API, written in <b>TypeScript</b>.
25
25
  - <b>Polymorphic</b> and <b>variadic</b>; do more with less code.
26
- - Supports both [MineTweaker3](https://minetweaker3.aizistral.com/wiki/Main_Page) and [ModTweaker](https://web.archive.org/web/20200219174745/http://minetweaker3.powerofbytes.com/wiki/ModTweaker#Currently_Supported_Mods_1.7.10).
26
+ - Supports both [MineTweaker3](https://minetweaker3.aizistral.com/wiki/Main_Page) and [ModTweaker](https://minetweaker3.aizistral.com/wiki/ModTweaker).
27
27
  - <b>Formatted output</b>; makes debugging easier.
28
28
 
29
29
  ## Getting started
package/dist/zenflow.cjs CHANGED
@@ -108,6 +108,7 @@ const formatLiteral = (x) => `"${x}"`;
108
108
  const formatId = (id) => id ?? "null";
109
109
  const formatStack = (stack) => `${stack.id} * ${stack.n}`;
110
110
  const formatIngredient = (ingredient) => isObject(ingredient) ? formatStack(ingredient) : ingredient;
111
+ const formatWeight = (weight) => (id) => `${id}.weight(${weight})`;
111
112
  const formatList = (list) => `[${list.join(", ")}]`;
112
113
  const formatEnchantment = (enchantment) => {
113
114
  const id = `${ENCHANTMENTS[enchantment.type]}${enchantment.short ? " as short" : ""}`;
@@ -283,7 +284,10 @@ const withTooltipShift = (id, tooltip) => `${id}.addShiftTooltip(${formatTooltip
283
284
  const withTag = (tag) => (id) => `${id}.withTag(${tag})`;
284
285
  const withEnchantment = (enchantments) => withTag(`{ ench: ${formatList(toArray(enchantments).map(formatEnchantment))} }`);
285
286
 
286
- const addLaser = (ingredient) => `MiningLaser.addOre(${formatArgs(formatIngredient(ingredient))});`;
287
+ const addLaser = (ingredient, weight) => {
288
+ const out = formatArgs(weight ? formatWeight(weight)(formatIngredient(ingredient)) : formatIngredient(ingredient));
289
+ return `MiningLaser.addOre(${out});`;
290
+ };
287
291
  const removeLaser = (id) => `MiningLaser.removeOre(${id});`;
288
292
  const addFoci = (foci, ids) => ids.map((id) => `MiningLaser.addPreferredOre(${formatArgs(MFR_FOCI[foci], id)});`).join("\n");
289
293
  const removeFoci = (foci, ids) => ids.map((id) => `MiningLaser.removePreferredOre(${formatArgs(MFR_FOCI[foci], id)});`).join("\n");
package/dist/zenflow.d.ts CHANGED
@@ -269,11 +269,12 @@ declare const withEnchantment: (enchantments: Enchantment | Enchantment[]) => (i
269
269
  /**
270
270
  * Requires: `import mods.mfr.MiningLaser;`
271
271
  */
272
- declare const addLaser: (ingredient: Ingredient) => string;
272
+ declare const addLaser: (ingredient: Ingredient, weight?: number | undefined) => string;
273
273
  /**
274
- * - Requires: `import mods.mfr.MiningLaser;`
274
+ * Requires: `import mods.mfr.MiningLaser;`
275
+ *
275
276
  * - Accepts ore dictionary
276
- * @param id - Laser output
277
+ * @param id Ore
277
278
  */
278
279
  declare const removeLaser: (id: string) => string;
279
280
  /**
@@ -282,7 +283,7 @@ declare const removeLaser: (id: string) => string;
282
283
  declare const addFoci: (foci: keyof typeof MFR_FOCI, ids: string[]) => string;
283
284
  /**
284
285
  * Requires: `import mods.mfr.MiningLaser;`
285
- * @param ids - Laser output
286
+ * @param ids Ores
286
287
  */
287
288
  declare const removeFoci: (foci: keyof typeof MFR_FOCI, ids: string[]) => string;
288
289
 
package/dist/zenflow.mjs CHANGED
@@ -104,6 +104,7 @@ const formatLiteral = (x) => `"${x}"`;
104
104
  const formatId = (id) => id ?? "null";
105
105
  const formatStack = (stack) => `${stack.id} * ${stack.n}`;
106
106
  const formatIngredient = (ingredient) => isObject(ingredient) ? formatStack(ingredient) : ingredient;
107
+ const formatWeight = (weight) => (id) => `${id}.weight(${weight})`;
107
108
  const formatList = (list) => `[${list.join(", ")}]`;
108
109
  const formatEnchantment = (enchantment) => {
109
110
  const id = `${ENCHANTMENTS[enchantment.type]}${enchantment.short ? " as short" : ""}`;
@@ -279,7 +280,10 @@ const withTooltipShift = (id, tooltip) => `${id}.addShiftTooltip(${formatTooltip
279
280
  const withTag = (tag) => (id) => `${id}.withTag(${tag})`;
280
281
  const withEnchantment = (enchantments) => withTag(`{ ench: ${formatList(toArray(enchantments).map(formatEnchantment))} }`);
281
282
 
282
- const addLaser = (ingredient) => `MiningLaser.addOre(${formatArgs(formatIngredient(ingredient))});`;
283
+ const addLaser = (ingredient, weight) => {
284
+ const out = formatArgs(weight ? formatWeight(weight)(formatIngredient(ingredient)) : formatIngredient(ingredient));
285
+ return `MiningLaser.addOre(${out});`;
286
+ };
283
287
  const removeLaser = (id) => `MiningLaser.removeOre(${id});`;
284
288
  const addFoci = (foci, ids) => ids.map((id) => `MiningLaser.addPreferredOre(${formatArgs(MFR_FOCI[foci], id)});`).join("\n");
285
289
  const removeFoci = (foci, ids) => ids.map((id) => `MiningLaser.removePreferredOre(${formatArgs(MFR_FOCI[foci], id)});`).join("\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zen-flow",
3
- "version": "2.4.2",
3
+ "version": "2.5.0",
4
4
  "description": "MineTweaker ZenScript made easy.",
5
5
  "main": "dist/zenflow.cjs",
6
6
  "module": "dist/zenflow.mjs",