zen-flow 2.8.2 → 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});`;
@@ -255,23 +258,15 @@ const addFermenterFuel = (recipe) => {
255
258
  const removeFermenterFuel = (id) => `mods.forestry.Fermenter.removeFuel(${id});`;
256
259
  const removeMoistener = (id) => `mods.forestry.Moistener.removeRecipe(${id});`;
257
260
  const addSqueezer = (recipe) => {
258
- const out = formatArgs(formatStack(recipe.out), formatIngredient(recipe.bonus), recipe.in.map(formatIngredient), recipe.ticks);
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
@@ -202,9 +202,9 @@ declare type RecipeFermenterFuel = {
202
202
  };
203
203
  declare type RecipeSqueezer = {
204
204
  out: Stack;
205
- in: Ingredient[];
206
- bonus: Ingredient;
205
+ in: Ingredient | Ingredient[];
207
206
  ticks: number;
207
+ bonus: Stack;
208
208
  };
209
209
  declare type RecipeStill = {
210
210
  in: Stack;
@@ -231,6 +231,9 @@ declare const removeFermenter: (id: string) => string;
231
231
  declare const addFermenterFuel: (recipe: RecipeFermenterFuel) => string;
232
232
  declare const removeFermenterFuel: (id: string) => string;
233
233
  declare const removeMoistener: (id: string) => string;
234
+ /**
235
+ * @param recipe.bonus - ModTweaker does not support optional `bonus`
236
+ */
234
237
  declare const addSqueezer: (recipe: RecipeSqueezer) => string;
235
238
  /**
236
239
  * Remove Forestry Squeezer recipe
@@ -238,10 +241,7 @@ declare const addSqueezer: (recipe: RecipeSqueezer) => string;
238
241
  * - Recipe: `string` => Remove all recipes
239
242
  * - Recipe: `object` => Remove specific recipe
240
243
  */
241
- declare const removeSqueezer: (recipe: string | {
242
- in: string[];
243
- out: string;
244
- }) => string;
244
+ declare const removeSqueezer: (id: string | string[], liquid: string) => string;
245
245
  declare const addStill: (recipe: RecipeStill) => string;
246
246
  /**
247
247
  * Remove Forestry Still recipe
@@ -249,10 +249,7 @@ declare const addStill: (recipe: RecipeStill) => string;
249
249
  * - Recipe: `string` => Remove all recipes
250
250
  * - Recipe: `object` => Remove specific recipe
251
251
  */
252
- declare const removeStill: (recipe: string | {
253
- in: string;
254
- out: string;
255
- }) => string;
252
+ declare const removeStill: (id: string, liquid?: string | undefined) => string;
256
253
  declare const addFabricator: (recipe: RecipeFabricator) => string;
257
254
  declare const removeFabricator: (id: string) => string;
258
255
  declare const addFabricatorFuel: (recipe: RecipeFabricatorFuel) => string;
@@ -383,6 +380,11 @@ declare const removeInsolator: (left: Ingredient, right: Ingredient) => string;
383
380
  */
384
381
  declare const addPulverizer: (recipe: RecipePulverizer) => string;
385
382
  declare const removePulverizer: (id: string) => string;
383
+ /**
384
+ * Common values:
385
+ * - Log: `800RF`
386
+ * - Tools: `1600RF`
387
+ */
386
388
  declare const addSawmill: (recipe: RecipeSawmill) => string;
387
389
  declare const removeSawmill: (id: string) => string;
388
390
  /**
@@ -428,7 +430,7 @@ declare type RecipeFurnace = {
428
430
  */
429
431
  declare const add: (item: Ingredient, recipe: Recipe) => string;
430
432
  /**
431
- * Add shaped crafint recipe with mirror
433
+ * Add shaped crafing recipe with mirror
432
434
  */
433
435
  declare const addMirror: (item: Ingredient, recipe: RecipeShaped) => string;
434
436
  /**
@@ -448,12 +450,6 @@ declare const removeShaped: (id: string, recipe?: Partial<{
448
450
  7: string;
449
451
  8: string;
450
452
  9: string;
451
- /**
452
- * Add crafting recipe
453
- *
454
- * - Recipe: `{}` => Shaped recipe
455
- * - Recipe: `[]` => Shapeless recipe
456
- */
457
453
  corner: string;
458
454
  edge: string;
459
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});`;
@@ -251,23 +254,15 @@ const addFermenterFuel = (recipe) => {
251
254
  const removeFermenterFuel = (id) => `mods.forestry.Fermenter.removeFuel(${id});`;
252
255
  const removeMoistener = (id) => `mods.forestry.Moistener.removeRecipe(${id});`;
253
256
  const addSqueezer = (recipe) => {
254
- const out = formatArgs(formatStack(recipe.out), formatIngredient(recipe.bonus), recipe.in.map(formatIngredient), recipe.ticks);
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.2",
3
+ "version": "2.9.0",
4
4
  "description": "MineTweaker ZenScript made easy.",
5
5
  "main": "dist/zenflow.cjs",
6
6
  "module": "dist/zenflow.mjs",