zen-flow 2.0.3 → 2.1.2

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
@@ -87,7 +87,7 @@ Array.from({ length: 11 })
87
87
 
88
88
  ## API
89
89
 
90
- - Types(#types)
90
+ - [Types](#types)
91
91
  - MineCraft
92
92
  - [Vanilla](#vanilla)
93
93
  - [Crafting patterns](#craftingpatterns)
@@ -324,4 +324,4 @@ exnihilo.addSieve('<minecraft:cobblestone>', {
324
324
  - `addTransposerExtract` - Add Fluid Transposer extract recipe
325
325
  - `removeTransposerExtract` - Remove Fluid Transposer extract recipe
326
326
 
327
- <i>* All bonus properties take a number between 1 and 100</i>
327
+ <i>* All bonus properties take a number between 1 and 100</i>
package/dist/zenflow.cjs CHANGED
@@ -145,9 +145,14 @@ const formatRecipe = (recipe) => {
145
145
  recipe.ring || recipe.corner || recipe[7],
146
146
  recipe.ring || recipe.edge || recipe[8],
147
147
  recipe.ring || recipe.corner || recipe[9]
148
- ]].map((row) => formatList(row.map(formatId)));
148
+ ]];
149
+ if (!matrix[0][2] && !matrix[1][2] && matrix[2].every((x) => !x)) {
150
+ matrix[0].splice(-1);
151
+ matrix[1].splice(-1);
152
+ matrix.splice(-1);
153
+ }
149
154
  return `[
150
- ${matrix.join(",\n ")}
155
+ ${matrix.map((row) => formatList(row.map(formatId))).join(",\n ")}
151
156
  ]`;
152
157
  };
153
158
  const formatArgs = (...args) => {
@@ -279,8 +284,8 @@ const add = (item, recipe) => {
279
284
  return `recipes.add${type}(${out});`;
280
285
  };
281
286
  const remove = (id) => `recipes.remove(${id});`;
282
- const removeShaped = (id) => `recipes.removeShaped(${id});`;
283
- const removeShapeless = (id) => `recipes.removeShapeless(${id});`;
287
+ const removeShaped = (id, recipe) => `recipes.removeShaped(${id}${recipe ? `, ${formatRecipe(recipe)}` : ""});`;
288
+ const removeShapeless = (id, recipe) => `recipes.removeShapeless(${id}${recipe ? `, ${formatList(recipe)}` : ""});`;
284
289
  const addFurnace = (recipe) => {
285
290
  const out = formatArgs(formatIngredient(recipe.out), recipe.in);
286
291
  return `furnace.addRecipe(${out});`;
package/dist/zenflow.d.ts CHANGED
@@ -322,11 +322,32 @@ declare const remove: (id: string) => string;
322
322
  /**
323
323
  * Remove all shaped crafting recipes
324
324
  */
325
- declare const removeShaped: (id: string) => string;
325
+ declare const removeShaped: (id: string, recipe?: Partial<{
326
+ 1: string;
327
+ 2: string;
328
+ 3: string;
329
+ 4: string;
330
+ 5: string;
331
+ 6: string;
332
+ 7: string;
333
+ 8: string;
334
+ /**
335
+ * Add crafting recipe
336
+ *
337
+ * - Recipe: `{}` => Shaped recipe
338
+ * - Recipe: `[]` => Shapeless recipe
339
+ */
340
+ 9: string;
341
+ corner: string;
342
+ edge: string;
343
+ ring: string;
344
+ square: string;
345
+ center: string;
346
+ }> | undefined) => string;
326
347
  /**
327
348
  * Remove all shapeless crafting recipes
328
349
  */
329
- declare const removeShapeless: (id: string) => string;
350
+ declare const removeShapeless: (id: string, recipe?: RecipeShapeless | undefined) => string;
330
351
  declare const addFurnace: (recipe: RecipeFurnace) => string;
331
352
  /**
332
353
  * Remove furnace recipe
package/dist/zenflow.mjs CHANGED
@@ -141,9 +141,14 @@ const formatRecipe = (recipe) => {
141
141
  recipe.ring || recipe.corner || recipe[7],
142
142
  recipe.ring || recipe.edge || recipe[8],
143
143
  recipe.ring || recipe.corner || recipe[9]
144
- ]].map((row) => formatList(row.map(formatId)));
144
+ ]];
145
+ if (!matrix[0][2] && !matrix[1][2] && matrix[2].every((x) => !x)) {
146
+ matrix[0].splice(-1);
147
+ matrix[1].splice(-1);
148
+ matrix.splice(-1);
149
+ }
145
150
  return `[
146
- ${matrix.join(",\n ")}
151
+ ${matrix.map((row) => formatList(row.map(formatId))).join(",\n ")}
147
152
  ]`;
148
153
  };
149
154
  const formatArgs = (...args) => {
@@ -275,8 +280,8 @@ const add = (item, recipe) => {
275
280
  return `recipes.add${type}(${out});`;
276
281
  };
277
282
  const remove = (id) => `recipes.remove(${id});`;
278
- const removeShaped = (id) => `recipes.removeShaped(${id});`;
279
- const removeShapeless = (id) => `recipes.removeShapeless(${id});`;
283
+ const removeShaped = (id, recipe) => `recipes.removeShaped(${id}${recipe ? `, ${formatRecipe(recipe)}` : ""});`;
284
+ const removeShapeless = (id, recipe) => `recipes.removeShapeless(${id}${recipe ? `, ${formatList(recipe)}` : ""});`;
280
285
  const addFurnace = (recipe) => {
281
286
  const out = formatArgs(formatIngredient(recipe.out), recipe.in);
282
287
  return `furnace.addRecipe(${out});`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zen-flow",
3
- "version": "2.0.3",
3
+ "version": "2.1.2",
4
4
  "description": "MineTweaker ZenScript made easy.",
5
5
  "main": "dist/zenflow.cjs",
6
6
  "module": "dist/zenflow.mjs",