zen-flow 2.8.3 → 2.9.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/dist/zenflow.cjs CHANGED
@@ -98,11 +98,10 @@ const MFR_FOCI = {
98
98
  black: 15
99
99
  };
100
100
 
101
- const clamp = (min, max, n) => Math.max(min, Math.min(max, n));
102
- const fill = (n, x) => Array.from({ length: n }).map((_, i) => x ?? i);
103
- const toArray = (x) => Array.isArray(x) ? x : [x];
104
101
  const isObject = (x) => typeof x === "object" && !Array.isArray(x);
105
- const capitalize = (x) => `${x[0].toUpperCase()}${x.slice(1)}`;
102
+
103
+ const toArray = (x) => Array.isArray(x) ? x : [x];
104
+ const fill = (n, x) => Array.from({ length: n }).map((_, i) => x ?? i);
106
105
 
107
106
  const formatLiteral = (x) => `"${x}"`;
108
107
  const formatId = (id) => id ?? "null";
@@ -164,6 +163,8 @@ const formatArgs = (...args) => {
164
163
  ` : list.join(", ");
165
164
  };
166
165
 
166
+ const capitalize = (x) => `${x[0].toUpperCase()}${x.slice(1)}`;
167
+
167
168
  const addGrinder = (recipe) => {
168
169
  const formatBonus = (stack) => `${stack.id}, ${stack.n}`;
169
170
  const out = formatArgs(formatIngredient(recipe.in), formatIngredient(recipe.out), recipe.turns, recipe.bonus && formatBonus(recipe.bonus.primary), recipe.bonus?.secondary && formatBonus(recipe.bonus.secondary));
@@ -188,6 +189,8 @@ const addExtreme = (ingredient, recipe) => {
188
189
  };
189
190
  const removeExtreme = (id) => `mods.avaritia.ExtremeCrafting.remove(${id});`;
190
191
 
192
+ const clamp = (min, max, n) => Math.max(min, Math.min(max, n));
193
+
191
194
  const addComposter = (recipe) => {
192
195
  const out = formatArgs(recipe.id, clamp(0, 1, recipe.fill), recipe.hex && `"${recipe.hex}"`);
193
196
  return `mods.exnihilo.Composting.addRecipe(${out});`;
@@ -258,20 +261,12 @@ const addSqueezer = (recipe) => {
258
261
  const out = formatArgs(formatStack(recipe.out), formatStack(recipe.bonus), toArray(recipe.in).map(formatIngredient), recipe.ticks);
259
262
  return `mods.forestry.Squeezer.addRecipe(${out});`;
260
263
  };
261
- const removeSqueezer = (recipe) => {
262
- if (typeof recipe === "string")
263
- return `mods.forestry.Squeezer.removeRecipe(${recipe});`;
264
- return `mods.forestry.Squeezer.removeRecipe(${formatArgs(recipe.out, recipe.in)});`;
265
- };
264
+ const removeSqueezer = (id, liquid) => `mods.forestry.Squeezer.removeRecipe(${formatArgs(liquid, toArray(id))});`;
266
265
  const addStill = (recipe) => {
267
266
  const out = formatArgs(formatStack(recipe.out), formatStack(recipe.in), recipe.ticks);
268
267
  return `mods.forestry.Still.addRecipe(${out});`;
269
268
  };
270
- const removeStill = (recipe) => {
271
- if (typeof recipe === "string")
272
- return `mods.forestry.Still.removeRecipe(${recipe});`;
273
- return `mods.forestry.Still.removeRecipe(${formatArgs(recipe.out, recipe.in)});`;
274
- };
269
+ const removeStill = (id, liquid) => `mods.forestry.Still.removeRecipe(${formatArgs(id, liquid)});`;
275
270
  const addFabricator = (recipe) => {
276
271
  const out = formatArgs(formatIngredient(recipe.out), formatRecipe(recipe.recipe), recipe.mb, recipe.cast);
277
272
  return `mods.forestry.ThermionicFabricator.addCast(${out});`;
package/dist/zenflow.d.ts CHANGED
@@ -232,7 +232,7 @@ declare const addFermenterFuel: (recipe: RecipeFermenterFuel) => string;
232
232
  declare const removeFermenterFuel: (id: string) => string;
233
233
  declare const removeMoistener: (id: string) => string;
234
234
  /**
235
- * @param recipe.bonus - Unfortunately `bonus` is required as optional is not supported by ModTweaker
235
+ * @param recipe.bonus - ModTweaker does not support optional `bonus`
236
236
  */
237
237
  declare const addSqueezer: (recipe: RecipeSqueezer) => string;
238
238
  /**
@@ -241,10 +241,7 @@ declare const addSqueezer: (recipe: RecipeSqueezer) => string;
241
241
  * - Recipe: `string` => Remove all recipes
242
242
  * - Recipe: `object` => Remove specific recipe
243
243
  */
244
- declare const removeSqueezer: (recipe: string | {
245
- in: string[];
246
- out: string;
247
- }) => string;
244
+ declare const removeSqueezer: (id: string | string[], liquid: string) => string;
248
245
  declare const addStill: (recipe: RecipeStill) => string;
249
246
  /**
250
247
  * Remove Forestry Still recipe
@@ -252,10 +249,7 @@ declare const addStill: (recipe: RecipeStill) => string;
252
249
  * - Recipe: `string` => Remove all recipes
253
250
  * - Recipe: `object` => Remove specific recipe
254
251
  */
255
- declare const removeStill: (recipe: string | {
256
- in: string;
257
- out: string;
258
- }) => string;
252
+ declare const removeStill: (id: string, liquid?: string | undefined) => string;
259
253
  declare const addFabricator: (recipe: RecipeFabricator) => string;
260
254
  declare const removeFabricator: (id: string) => string;
261
255
  declare const addFabricatorFuel: (recipe: RecipeFabricatorFuel) => string;
@@ -436,7 +430,7 @@ declare type RecipeFurnace = {
436
430
  */
437
431
  declare const add: (item: Ingredient, recipe: Recipe) => string;
438
432
  /**
439
- * Add shaped crafint recipe with mirror
433
+ * Add shaped crafing recipe with mirror
440
434
  */
441
435
  declare const addMirror: (item: Ingredient, recipe: RecipeShaped) => string;
442
436
  /**
@@ -456,12 +450,6 @@ declare const removeShaped: (id: string, recipe?: Partial<{
456
450
  7: string;
457
451
  8: string;
458
452
  9: string;
459
- /**
460
- * Add crafting recipe
461
- *
462
- * - Recipe: `{}` => Shaped recipe
463
- * - Recipe: `[]` => Shapeless recipe
464
- */
465
453
  corner: string;
466
454
  edge: string;
467
455
  ring: string;
package/dist/zenflow.mjs CHANGED
@@ -94,11 +94,10 @@ const MFR_FOCI = {
94
94
  black: 15
95
95
  };
96
96
 
97
- const clamp = (min, max, n) => Math.max(min, Math.min(max, n));
98
- const fill = (n, x) => Array.from({ length: n }).map((_, i) => x ?? i);
99
- const toArray = (x) => Array.isArray(x) ? x : [x];
100
97
  const isObject = (x) => typeof x === "object" && !Array.isArray(x);
101
- const capitalize = (x) => `${x[0].toUpperCase()}${x.slice(1)}`;
98
+
99
+ const toArray = (x) => Array.isArray(x) ? x : [x];
100
+ const fill = (n, x) => Array.from({ length: n }).map((_, i) => x ?? i);
102
101
 
103
102
  const formatLiteral = (x) => `"${x}"`;
104
103
  const formatId = (id) => id ?? "null";
@@ -160,6 +159,8 @@ const formatArgs = (...args) => {
160
159
  ` : list.join(", ");
161
160
  };
162
161
 
162
+ const capitalize = (x) => `${x[0].toUpperCase()}${x.slice(1)}`;
163
+
163
164
  const addGrinder = (recipe) => {
164
165
  const formatBonus = (stack) => `${stack.id}, ${stack.n}`;
165
166
  const out = formatArgs(formatIngredient(recipe.in), formatIngredient(recipe.out), recipe.turns, recipe.bonus && formatBonus(recipe.bonus.primary), recipe.bonus?.secondary && formatBonus(recipe.bonus.secondary));
@@ -184,6 +185,8 @@ const addExtreme = (ingredient, recipe) => {
184
185
  };
185
186
  const removeExtreme = (id) => `mods.avaritia.ExtremeCrafting.remove(${id});`;
186
187
 
188
+ const clamp = (min, max, n) => Math.max(min, Math.min(max, n));
189
+
187
190
  const addComposter = (recipe) => {
188
191
  const out = formatArgs(recipe.id, clamp(0, 1, recipe.fill), recipe.hex && `"${recipe.hex}"`);
189
192
  return `mods.exnihilo.Composting.addRecipe(${out});`;
@@ -254,20 +257,12 @@ const addSqueezer = (recipe) => {
254
257
  const out = formatArgs(formatStack(recipe.out), formatStack(recipe.bonus), toArray(recipe.in).map(formatIngredient), recipe.ticks);
255
258
  return `mods.forestry.Squeezer.addRecipe(${out});`;
256
259
  };
257
- const removeSqueezer = (recipe) => {
258
- if (typeof recipe === "string")
259
- return `mods.forestry.Squeezer.removeRecipe(${recipe});`;
260
- return `mods.forestry.Squeezer.removeRecipe(${formatArgs(recipe.out, recipe.in)});`;
261
- };
260
+ const removeSqueezer = (id, liquid) => `mods.forestry.Squeezer.removeRecipe(${formatArgs(liquid, toArray(id))});`;
262
261
  const addStill = (recipe) => {
263
262
  const out = formatArgs(formatStack(recipe.out), formatStack(recipe.in), recipe.ticks);
264
263
  return `mods.forestry.Still.addRecipe(${out});`;
265
264
  };
266
- const removeStill = (recipe) => {
267
- if (typeof recipe === "string")
268
- return `mods.forestry.Still.removeRecipe(${recipe});`;
269
- return `mods.forestry.Still.removeRecipe(${formatArgs(recipe.out, recipe.in)});`;
270
- };
265
+ const removeStill = (id, liquid) => `mods.forestry.Still.removeRecipe(${formatArgs(id, liquid)});`;
271
266
  const addFabricator = (recipe) => {
272
267
  const out = formatArgs(formatIngredient(recipe.out), formatRecipe(recipe.recipe), recipe.mb, recipe.cast);
273
268
  return `mods.forestry.ThermionicFabricator.addCast(${out});`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zen-flow",
3
- "version": "2.8.3",
3
+ "version": "2.9.0",
4
4
  "description": "MineTweaker ZenScript made easy.",
5
5
  "main": "dist/zenflow.cjs",
6
6
  "module": "dist/zenflow.mjs",