zen-flow 2.2.0 → 2.3.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](http://minetweaker3.powerofbytes.com/) and [ModTweaker](http://minetweaker3.powerofbytes.com/wiki/ModTweaker).
26
+ - Supports both [MineTweaker3](http://minetweaker3.powerofbytes.com/) and [ModTweaker](https://web.archive.org/web/20200219174745/http://minetweaker3.powerofbytes.com/wiki/ModTweaker#Currently_Supported_Mods_1.7.10).
27
27
  - <b>Formatted output</b>; makes debugging easier.
28
28
 
29
29
  ## Getting started
@@ -87,84 +87,20 @@ Array.from({ length: 11 })
87
87
 
88
88
  ## API
89
89
 
90
- - [Types](#types)
91
- - MineCraft
92
- - [Vanilla](#vanilla)
93
- - [Crafting patterns](#crafting-patterns)
94
- - [Items](#items)
95
- - [Formatting](#formatting)
96
- - Mods
97
- - [Avaritia](#avaritia)
98
- - [ExNihilo](#exnihilo)
99
- - [ExtraUtilities](#extrautilities)
100
- - [MineFactoryReloaded](#minefactoryreloaded)
101
- - [NEI](#nei)
102
- - [ThermalExpansion](#thermalexpansion)
103
-
104
- ## Types
105
-
106
- ```TS
107
- type Stack = {
108
- id: string,
109
- n: number
110
- };
111
-
112
- type Ingredient = string | Stack;
113
-
114
- type RecipeShaped = Partial<{
115
- 1: string
116
- 2: string
117
- 3: string
118
- 4: string
119
- 5: string
120
- 6: string
121
- 7: string
122
- 8: string
123
- 9: string
124
- corner: string
125
- edge: string
126
- ring: string
127
- square: string
128
- center: string
129
- }>;
130
-
131
- type RecipeShapeless = string[];
132
-
133
- type Recipe = RecipeShaped | RecipeShapeless;
134
-
135
- type Enchantment = {
136
- type: keyof typeof ENCHANTMENTS
137
- level?: number | string
138
- short?: boolean
139
- };
140
-
141
- type TextRich = {
142
- text: string
143
- color?: typeof COLORS[number],
144
- format?: typeof FORMATS[number]
145
- };
146
-
147
- type Text = string | TextRich;
148
- ```
149
-
150
- ## Vanilla
151
-
152
- - `add` - Add a crafting table recipe.
153
- - Shaped recipe: `object`
154
- - Shapeless recipe: `Array`
155
- - `addMirror` - Adds a shaped crafting table recipe with mirrored variant.
156
- - `remove` - Removes both shaped and shapeless recipes
157
- - `removeShaped` - Removes only shaped recipes
158
- - `removeShapeless` - Removes only shaped recipes
159
- - `replace` - Replaced crafting recipe
160
- - Shaped recipe: `object`
161
- - Shapeless recipe: `Array`
162
- - `replaceAll` - Replace all recipes
163
- - `replaceMany` - Remove all recipes and add multiple recipes
164
- - `addFurnace` - Adds furnace recipe
165
- - `removeFurnace` - Removes furnace recipe
166
-
167
- ### Crafting patterns
90
+ - [Patterns](#crafting-patterns)
91
+ - [Recipes](#recipes)
92
+ - [Items](#items)
93
+ - [Formatting](#formatting)
94
+ - [Vanilla](#vanilla)
95
+ - [Applied Energistics 2](#appliedenergistics2)
96
+ - [Avaritia](#avaritia)
97
+ - [ExNihilo](#exnihilo)
98
+ - [ExtraUtilities](#extrautilities)
99
+ - [MineFactoryReloaded](#minefactoryreloaded)
100
+ - [NEI](#nei)
101
+ - [ThermalExpansion](#thermalexpansion)
102
+
103
+ ### Patterns
168
104
 
169
105
  Shaped crafting recipes support the following shorthand patterns, in order:
170
106
 
@@ -207,8 +143,9 @@ Shaped crafting recipes support the following shorthand patterns, in order:
207
143
  [7, 8, 9]
208
144
  ]
209
145
  ```
146
+ ### Recipes
210
147
 
211
- ## Items
148
+ #### Items
212
149
 
213
150
  - `addDict` - Add ingredients to ore dictionary
214
151
  - `removeDict` - Remove ingredients from ore dictionary
@@ -223,7 +160,7 @@ Shaped crafting recipes support the following shorthand patterns, in order:
223
160
 
224
161
  <i>* It is currently not possible to remove item tooltips.</i>
225
162
 
226
- ### Formatting
163
+ ##### Formatting
227
164
 
228
165
  `withName`, `withTooltip` and `withTooltipShift` accept formatting strings:
229
166
 
@@ -243,15 +180,38 @@ withName('<minecraft:bread>', [
243
180
  { text: 'with butter', colour: 'yellow', format: 'italic' }
244
181
  ]);
245
182
  ```
183
+ #### Vanilla
184
+
185
+ - `add` - Add a crafting table recipe.
186
+ - Shaped recipe: `object`
187
+ - Shapeless recipe: `Array`
188
+ - `addMirror` - Adds a shaped crafting table recipe with mirrored variant.
189
+ - `remove` - Removes both shaped and shapeless recipes
190
+ - `removeShaped` - Removes only shaped recipes
191
+ - `removeShapeless` - Removes only shaped recipes
192
+ - `replace` - Replaced crafting recipe
193
+ - Shaped recipe: `object`
194
+ - Shapeless recipe: `Array`
195
+ - `replaceAll` - Replace all recipes
196
+ - `replaceMany` - Remove all recipes and add multiple recipes
197
+ - `addFurnace` - Adds furnace recipe
198
+ - `removeFurnace` - Removes furnace recipe
199
+
200
+ #### Applied Energistics 2
201
+
202
+ - `addGrinder` - Add Quartz Grindstone recipe
203
+ - `removeGrinder` - Remove Quartz Grindstone recipe
204
+ - `addInscriber` - Add Inscriber recipe
205
+ - `removeInscriber` - Remove Inscriber recipe
246
206
 
247
- ## Avaritia
207
+ #### Avaritia
248
208
 
249
209
  - `addCompressor` - Add Neutronium Compressor recipe
250
210
  - `removeCompressor` - Remove Neutronium Compressor recipe
251
211
  - `addExtreme` - Add Extreme Crafting recipe
252
212
  - `removeExtreme` - Remove Extreme Crafting recipe
253
213
 
254
- ## ExNihilo
214
+ #### ExNihilo
255
215
 
256
216
  - `addComposter` - Add item that can be composted to dirt
257
217
  - `fill` must be a value between `0` and `1`
@@ -269,7 +229,7 @@ withName('<minecraft:bread>', [
269
229
  - `0.13 => 1 / 0.13 => ~7.69 => 8 (12.5%)`
270
230
  - `removeSieve` - Remove sieve recipe
271
231
 
272
- ### Examples
232
+ ###### Examples
273
233
 
274
234
  ```TypeScript
275
235
  import { exnihilo } from 'zen-flow';
@@ -287,26 +247,26 @@ exnihilo.addSieve('<minecraft:cobblestone>', {
287
247
  });
288
248
  ```
289
249
 
290
- ## ExtraUtilities
250
+ #### ExtraUtilities
291
251
 
292
252
  - `addQED` - Add QED recipe
293
253
  - QED only accepts <b>shaped</b> recipes
294
254
  - `removeQED` - Remove QED recipe
295
255
  - `replaceQED` - Replace QED recipe
296
256
 
297
- ## MineFactoryReloaded
257
+ #### MineFactoryReloaded
298
258
 
299
259
  - `addLaser` - Add ore to the Mining Laser ore table
300
260
  - `removeLaser` - Remove ore from the Mining Laser ore table
301
261
  - `addFoci` - Add ores to the Laser Focus ore table
302
262
  - `removeFoci` - Remove ores from the Laser Focus ore table
303
263
 
304
- ## NEI
264
+ #### NEI
305
265
 
306
266
  - `hide` - Hide item from NEI
307
267
  - `addNEI` - Add item to NEI
308
268
 
309
- ## ThermalExpansion
269
+ #### ThermalExpansion
310
270
 
311
271
  - `addCrucibleThermal` - Add Magma Crucible recipe
312
272
  - `removeCrucibleThermal` - Remove Magma Crucible recipe
package/dist/zenflow.cjs CHANGED
@@ -102,6 +102,7 @@ const clamp = (min, max, n) => Math.max(min, Math.min(max, n));
102
102
  const fill = (n, x) => Array.from({ length: n }).map((_, i) => x ?? i);
103
103
  const toArray = (x) => Array.isArray(x) ? x : [x];
104
104
  const isObject = (x) => typeof x === "object" && !Array.isArray(x);
105
+ const capitalize = (x) => `${x[0].toUpperCase()}${x.slice(1)}`;
105
106
 
106
107
  const formatLiteral = (x) => `"${x}"`;
107
108
  const formatId = (id) => id ?? "null";
@@ -162,6 +163,17 @@ const formatArgs = (...args) => {
162
163
  ` : list.join(", ");
163
164
  };
164
165
 
166
+ const addGrinder = (recipe) => {
167
+ const out = formatArgs(formatIngredient(recipe.in), formatIngredient(recipe.out), recipe.turns, recipe.bonus && formatStack(recipe.bonus.primary), recipe.bonus?.secondary && formatStack(recipe.bonus.secondary));
168
+ return `mods.appeng.Grinder.addRecipe(${out});`;
169
+ };
170
+ const removeGrinder = (id) => `mods.appeng.Grinder.removeRecipe(${id})`;
171
+ const addInscriber = (recipe) => {
172
+ const out = formatArgs([formatIngredient(recipe.in)], recipe.plate.top, recipe.plate.bottom, formatIngredient(recipe.out), capitalize(recipe.type));
173
+ return `mods.appeng.Inscriber.addRecipe(${out});`;
174
+ };
175
+ const removeInscriber = (id) => `mods.appeng.Inscriber.removeRecipe(${id});`;
176
+
165
177
  const addCompressor = (recipe) => `mods.avaritia.Compressor.add(${formatArgs(recipe.out, recipe.in.n, recipe.in.id)});`;
166
178
  const removeCompressor = (id) => `mods.avaritia.Compressor.remove(${id});`;
167
179
  const addExtreme = (ingredient, recipe) => {
@@ -268,7 +280,7 @@ const removeSmelter = (left, right) => {
268
280
  return `mods.thermalexpansion.Smelter.removeRecipe(${out});`;
269
281
  };
270
282
  const addTransposerFill = (recipe) => {
271
- const out = formatArgs(recipe.rf, recipe.in, recipe.out, formatStack(recipe.liquid));
283
+ const out = formatArgs(recipe.rf, formatIngredient(recipe.in), formatIngredient(recipe.out), formatStack(recipe.liquid));
272
284
  return `mods.thermalexpansion.Transposer.addFillRecipe(${out});`;
273
285
  };
274
286
  const removeTransposerFill = (id, liquid) => `mods.thermalexpansion.Transposer.removeFillRecipe(${formatArgs(id, liquid)});`;
@@ -326,7 +338,9 @@ exports.addExtreme = addExtreme;
326
338
  exports.addFoci = addFoci;
327
339
  exports.addFurnace = addFurnace;
328
340
  exports.addFurnaceThermal = addFurnace$1;
341
+ exports.addGrinder = addGrinder;
329
342
  exports.addHammer = addHammer;
343
+ exports.addInscriber = addInscriber;
330
344
  exports.addInsolator = addInsolator;
331
345
  exports.addLaser = addLaser;
332
346
  exports.addMirror = addMirror;
@@ -350,7 +364,9 @@ exports.removeExtreme = removeExtreme;
350
364
  exports.removeFoci = removeFoci;
351
365
  exports.removeFurnace = removeFurnace;
352
366
  exports.removeFurnaceThermal = removeFurnace$1;
367
+ exports.removeGrinder = removeGrinder;
353
368
  exports.removeHammer = removeHammer;
369
+ exports.removeInscriber = removeInscriber;
354
370
  exports.removeInsolator = removeInsolator;
355
371
  exports.removeLaser = removeLaser;
356
372
  exports.removePulverizer = removePulverizer;
package/dist/zenflow.d.ts CHANGED
@@ -78,6 +78,29 @@ declare type TextRich = {
78
78
  };
79
79
  declare type Text = string | TextRich;
80
80
 
81
+ declare type RecipeGrinder = {
82
+ in: Ingredient;
83
+ out: Ingredient;
84
+ turns: number;
85
+ bonus?: {
86
+ primary: Stack;
87
+ secondary?: Stack;
88
+ };
89
+ };
90
+ declare type RecipeInscriber = {
91
+ in: Ingredient;
92
+ plate: {
93
+ top: string;
94
+ bottom?: string;
95
+ };
96
+ out: Ingredient;
97
+ type: 'inscribe' | 'press';
98
+ };
99
+ declare const addGrinder: (recipe: RecipeGrinder) => string;
100
+ declare const removeGrinder: (id: string) => string;
101
+ declare const addInscriber: (recipe: RecipeInscriber) => string;
102
+ declare const removeInscriber: (id: string) => string;
103
+
81
104
  declare type RecipeCompressor = {
82
105
  in: Stack;
83
106
  out: string;
@@ -229,8 +252,8 @@ declare type RecipeSmelter = {
229
252
  };
230
253
  declare type RecipeTransposerFill = {
231
254
  rf: number;
232
- in: string;
233
- out: string;
255
+ in: Ingredient;
256
+ out: Ingredient;
234
257
  liquid: Stack;
235
258
  };
236
259
  declare type RecipeTransposerExtract = {
@@ -376,4 +399,4 @@ declare const replace: (ingredient: Ingredient, recipe: Recipe) => string;
376
399
  declare const replaceAll: (ingredient: Ingredient, recipe: Recipe) => string;
377
400
  declare const replaceMany: (ingredient: Ingredient, recipes: Recipe[]) => string;
378
401
 
379
- export { Enchantment, Ingredient, Recipe, RecipeShaped, RecipeShapeless, Stack, Text, TextRich, add, addComposter, addCompressor, addCrucible$1 as addCrucibleNihilo, addCrucibleSource, addCrucible as addCrucibleThermal, addDict, addExtreme, addFoci, addFurnace, addFurnace$1 as addFurnaceThermal, addHammer, addInsolator, addLaser, addMirror, addNEI, addPulverizer, addQED, addSawmill, addSieve, addSmelter, addTransposerExtract, addTransposerFill, hide, remove, removeComposter, removeCompressor, removeCrucible$1 as removeCrucibleNihilo, removeCrucibleSource, removeCrucible as removeCrucibleThermal, removeDict, removeExtreme, removeFoci, removeFurnace, removeFurnace$1 as removeFurnaceThermal, removeHammer, removeInsolator, removeLaser, removePulverizer, removeQED, removeSawmill, removeShaped, removeShapeless, removeSieve, removeSmelter, removeTransposerExtract, removeTransposerFill, replace, replaceAll, replaceMany, replaceQED, withEnchantment, withName, withTag, withTooltip, withTooltipShift };
402
+ export { Enchantment, Ingredient, Recipe, RecipeShaped, RecipeShapeless, Stack, Text, TextRich, add, addComposter, addCompressor, addCrucible$1 as addCrucibleNihilo, addCrucibleSource, addCrucible as addCrucibleThermal, addDict, addExtreme, addFoci, addFurnace, addFurnace$1 as addFurnaceThermal, addGrinder, addHammer, addInscriber, addInsolator, addLaser, addMirror, addNEI, addPulverizer, addQED, addSawmill, addSieve, addSmelter, addTransposerExtract, addTransposerFill, hide, remove, removeComposter, removeCompressor, removeCrucible$1 as removeCrucibleNihilo, removeCrucibleSource, removeCrucible as removeCrucibleThermal, removeDict, removeExtreme, removeFoci, removeFurnace, removeFurnace$1 as removeFurnaceThermal, removeGrinder, removeHammer, removeInscriber, removeInsolator, removeLaser, removePulverizer, removeQED, removeSawmill, removeShaped, removeShapeless, removeSieve, removeSmelter, removeTransposerExtract, removeTransposerFill, replace, replaceAll, replaceMany, replaceQED, withEnchantment, withName, withTag, withTooltip, withTooltipShift };
package/dist/zenflow.mjs CHANGED
@@ -98,6 +98,7 @@ const clamp = (min, max, n) => Math.max(min, Math.min(max, n));
98
98
  const fill = (n, x) => Array.from({ length: n }).map((_, i) => x ?? i);
99
99
  const toArray = (x) => Array.isArray(x) ? x : [x];
100
100
  const isObject = (x) => typeof x === "object" && !Array.isArray(x);
101
+ const capitalize = (x) => `${x[0].toUpperCase()}${x.slice(1)}`;
101
102
 
102
103
  const formatLiteral = (x) => `"${x}"`;
103
104
  const formatId = (id) => id ?? "null";
@@ -158,6 +159,17 @@ const formatArgs = (...args) => {
158
159
  ` : list.join(", ");
159
160
  };
160
161
 
162
+ const addGrinder = (recipe) => {
163
+ const out = formatArgs(formatIngredient(recipe.in), formatIngredient(recipe.out), recipe.turns, recipe.bonus && formatStack(recipe.bonus.primary), recipe.bonus?.secondary && formatStack(recipe.bonus.secondary));
164
+ return `mods.appeng.Grinder.addRecipe(${out});`;
165
+ };
166
+ const removeGrinder = (id) => `mods.appeng.Grinder.removeRecipe(${id})`;
167
+ const addInscriber = (recipe) => {
168
+ const out = formatArgs([formatIngredient(recipe.in)], recipe.plate.top, recipe.plate.bottom, formatIngredient(recipe.out), capitalize(recipe.type));
169
+ return `mods.appeng.Inscriber.addRecipe(${out});`;
170
+ };
171
+ const removeInscriber = (id) => `mods.appeng.Inscriber.removeRecipe(${id});`;
172
+
161
173
  const addCompressor = (recipe) => `mods.avaritia.Compressor.add(${formatArgs(recipe.out, recipe.in.n, recipe.in.id)});`;
162
174
  const removeCompressor = (id) => `mods.avaritia.Compressor.remove(${id});`;
163
175
  const addExtreme = (ingredient, recipe) => {
@@ -264,7 +276,7 @@ const removeSmelter = (left, right) => {
264
276
  return `mods.thermalexpansion.Smelter.removeRecipe(${out});`;
265
277
  };
266
278
  const addTransposerFill = (recipe) => {
267
- const out = formatArgs(recipe.rf, recipe.in, recipe.out, formatStack(recipe.liquid));
279
+ const out = formatArgs(recipe.rf, formatIngredient(recipe.in), formatIngredient(recipe.out), formatStack(recipe.liquid));
268
280
  return `mods.thermalexpansion.Transposer.addFillRecipe(${out});`;
269
281
  };
270
282
  const removeTransposerFill = (id, liquid) => `mods.thermalexpansion.Transposer.removeFillRecipe(${formatArgs(id, liquid)});`;
@@ -311,4 +323,4 @@ const replaceMany = (ingredient, recipes) => [
311
323
  ...recipes.map((recipe) => add(ingredient, recipe))
312
324
  ].join("\n");
313
325
 
314
- export { add, addComposter, addCompressor, addCrucible$1 as addCrucibleNihilo, addCrucibleSource, addCrucible as addCrucibleThermal, addDict, addExtreme, addFoci, addFurnace, addFurnace$1 as addFurnaceThermal, addHammer, addInsolator, addLaser, addMirror, addNEI, addPulverizer, addQED, addSawmill, addSieve, addSmelter, addTransposerExtract, addTransposerFill, hide, remove, removeComposter, removeCompressor, removeCrucible$1 as removeCrucibleNihilo, removeCrucibleSource, removeCrucible as removeCrucibleThermal, removeDict, removeExtreme, removeFoci, removeFurnace, removeFurnace$1 as removeFurnaceThermal, removeHammer, removeInsolator, removeLaser, removePulverizer, removeQED, removeSawmill, removeShaped, removeShapeless, removeSieve, removeSmelter, removeTransposerExtract, removeTransposerFill, replace, replaceAll, replaceMany, replaceQED, withEnchantment, withName, withTag, withTooltip, withTooltipShift };
326
+ export { add, addComposter, addCompressor, addCrucible$1 as addCrucibleNihilo, addCrucibleSource, addCrucible as addCrucibleThermal, addDict, addExtreme, addFoci, addFurnace, addFurnace$1 as addFurnaceThermal, addGrinder, addHammer, addInscriber, addInsolator, addLaser, addMirror, addNEI, addPulverizer, addQED, addSawmill, addSieve, addSmelter, addTransposerExtract, addTransposerFill, hide, remove, removeComposter, removeCompressor, removeCrucible$1 as removeCrucibleNihilo, removeCrucibleSource, removeCrucible as removeCrucibleThermal, removeDict, removeExtreme, removeFoci, removeFurnace, removeFurnace$1 as removeFurnaceThermal, removeGrinder, removeHammer, removeInscriber, removeInsolator, removeLaser, removePulverizer, removeQED, removeSawmill, removeShaped, removeShapeless, removeSieve, removeSmelter, removeTransposerExtract, removeTransposerFill, replace, replaceAll, replaceMany, replaceQED, withEnchantment, withName, withTag, withTooltip, withTooltipShift };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zen-flow",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "MineTweaker ZenScript made easy.",
5
5
  "main": "dist/zenflow.cjs",
6
6
  "module": "dist/zenflow.mjs",