zen-flow 1.15.0 → 2.0.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,6 +87,7 @@ Array.from({ length: 11 })
87
87
 
88
88
  ## API
89
89
 
90
+ - Types(#types)
90
91
  - MineCraft
91
92
  - [Vanilla](#vanilla)
92
93
  - [Crafting patterns](#craftingpatterns)
@@ -100,6 +101,52 @@ Array.from({ length: 11 })
100
101
  - [NEI](#nei)
101
102
  - [ThermalExpansion](#thermalexpansion)
102
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
+
103
150
  ## Vanilla
104
151
 
105
152
  - `add` - Add a crafting table recipe.
@@ -184,15 +231,15 @@ Shaped crafting recipes support the following shorthand patterns, in order:
184
231
  withName('<minecraft:bread>', 'Bread');
185
232
 
186
233
  // Bread (with red text)
187
- withName('<minecraft:bread>', ['Bread', { colour: 'red' }]);
234
+ withName('<minecraft:bread>', { text: 'Bread', colour: 'red' });
188
235
 
189
236
  // Bread (bold red text)
190
- withName('<minecraft:bread>', ['Bread', { colour: 'red', format: 'bold' }]);
237
+ withName('<minecraft:bread>', { text: 'Bread', colour: 'red', format: 'bold' });
191
238
 
192
239
  // Bread (normal text) with butter (yellow italic text)
193
240
  withName('<minecraft:bread>', [
194
241
  'Bread',
195
- ['with butter', { colour: 'yellow', format: 'italic' }]
242
+ { text: 'with butter', colour: 'yellow', format: 'italic' }
196
243
  ]);
197
244
  ```
198
245
 
@@ -227,10 +274,10 @@ withName('<minecraft:bread>', [
227
274
  import { exnihilo } from 'zen-flow';
228
275
 
229
276
  exnilo.addHammer('<minecraft:cobblestone>', {
230
- '<minecraft:stick>': [0.5], // 50%
277
+ '<minecraft:stick>': 0.5, // 50%
231
278
  '<minecraft:bread>': [1, 1, 0.5] // 100%, 100%, 50%
232
- '<minecraft:stone>': [[1, 2], [0.5, 1]] // 100% with 2x modifier, 50% with 1x modifier
233
- '<minecraft:coal>': [[1, 2], 1] // 100% with 2x modifier, 100%
279
+ '<minecraft:stone>': [{ chance: 1, modifier: 2 }, { chance: 0.5, modifier: 1 }] // 100% with 2x modifier, 50% with 1x modifier
280
+ '<minecraft:coal>': [{ chance: 1, modifier: 2 }, 1] // 100% with 2x modifier, 100%
234
281
  });
235
282
 
236
283
  exnihilo.addSieve('<minecraft:cobblestone>', {
@@ -276,3 +323,5 @@ exnihilo.addSieve('<minecraft:cobblestone>', {
276
323
  - `removeTransposerFill` - Remove Fluid Transposer fill recipe
277
324
  - `addTransposerExtract` - Add Fluid Transposer extract recipe
278
325
  - `removeTransposerExtract` - Remove Fluid Transposer extract recipe
326
+
327
+ <i>* All bonus properties take a number between 1 and 100</i>
package/dist/zenflow.cjs CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const createCode = (code) => `\\u00A7${code}`;
6
6
  const createFormat = (type) => (tooltip) => `format.${type}(${tooltip})`;
7
- const NAME_COLOUR = {
7
+ const NAME_COLOR = {
8
8
  black: createCode("0"),
9
9
  darkBlue: createCode("1"),
10
10
  darkGreen: createCode("2"),
@@ -22,7 +22,15 @@ const NAME_COLOUR = {
22
22
  yellow: createCode("e"),
23
23
  white: createCode("f")
24
24
  };
25
- const TOOLTIP_COLOUR = {
25
+ const NAME_FORMAT = {
26
+ obfuscated: createCode("k"),
27
+ bold: createCode("l"),
28
+ strikethrough: createCode("m"),
29
+ underline: createCode("n"),
30
+ italic: createCode("o"),
31
+ reset: createCode("r")
32
+ };
33
+ const TOOLTIP_COLOR = {
26
34
  black: createFormat("black"),
27
35
  darkBlue: createFormat("darkBlue"),
28
36
  darkGreen: createFormat("darkGreen"),
@@ -40,14 +48,6 @@ const TOOLTIP_COLOUR = {
40
48
  yellow: createFormat("yellow"),
41
49
  white: createFormat("white")
42
50
  };
43
- const NAME_FORMAT = {
44
- obfuscated: createCode("k"),
45
- bold: createCode("l"),
46
- strikethrough: createCode("m"),
47
- underline: createCode("n"),
48
- italic: createCode("o"),
49
- reset: createCode("r")
50
- };
51
51
  const TOOLTIP_FORMAT = {
52
52
  obfuscated: createFormat("obfuscated"),
53
53
  bold: createFormat("bold"),
@@ -98,41 +98,41 @@ const MFR_FOCI = {
98
98
  black: 15
99
99
  };
100
100
 
101
- const isItem = (x) => Array.isArray(x) && x.length === 2 && typeof x[0] === "string" && typeof x[1] === "number";
102
- const isRecipeShaped = (x) => !Array.isArray(x) && typeof x === "object";
103
- const isTextFormat = (x) => Array.isArray(x) && x.length === 2 && (x[1].colour || x[1].format);
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
+ const isObject = (x) => typeof x === "object" && !Array.isArray(x);
104
105
 
105
- const formatItem = (item) => `${item[0]} * ${item[1]}`;
106
+ const formatLiteral = (x) => `"${x}"`;
107
+ const formatId = (id) => id ?? "null";
108
+ const formatStack = (stack) => `${stack.id} * ${stack.n}`;
109
+ const formatIngredient = (ingredient) => isObject(ingredient) ? formatStack(ingredient) : ingredient;
106
110
  const formatList = (list) => `[${list.join(", ")}]`;
107
- const formatIngredient = (ingredient) => ingredient ?? "null";
108
111
  const formatEnchantment = (enchantment) => {
109
112
  const id = `${ENCHANTMENTS[enchantment.type]}${enchantment.short ? " as short" : ""}`;
110
113
  const lvl = `${enchantment.level ?? 1}${enchantment.level ? " as short" : ""}`;
111
114
  return `{ id: ${id}, lvl: ${lvl} }`;
112
115
  };
113
116
  const formatName = (texts) => {
114
- const format = (text) => [
115
- text[1].colour && NAME_COLOUR[text[1].colour],
116
- text[1].format && NAME_FORMAT[text[1].format],
117
- text[0],
118
- (text[1].colour || text[1].format) && NAME_FORMAT.reset
119
- ].filter((x) => x).join("");
120
- if (typeof texts === "string")
121
- return `"${texts}"`;
122
- if (isTextFormat(texts))
123
- return `"${format(texts)}"`;
124
- const formatted = texts.map((text) => typeof text === "string" ? text : format(text)).join("");
117
+ const formatted = toArray(texts).map((text) => {
118
+ if (typeof text === "string")
119
+ return text;
120
+ return [
121
+ text.color && NAME_COLOR[text.color],
122
+ text.format && NAME_FORMAT[text.format],
123
+ text.text,
124
+ (text.color || text.format) && NAME_FORMAT.reset
125
+ ].filter((x) => x !== void 0).join("");
126
+ }).join("");
125
127
  return `"${formatted}"`;
126
128
  };
127
- const formatTooltip = (texts) => {
128
- const format = (text, options) => TOOLTIP_COLOUR[options?.colour ?? "gray"](options?.format ? TOOLTIP_FORMAT[options.format](`"${text}"`) : `"${text}"`);
129
- if (!Array.isArray(texts))
130
- return format(texts);
131
- if (isTextFormat(texts))
132
- return format(...texts);
133
- return texts.map(formatTooltip).join(" + ");
134
- };
135
- const formatRecipeShaped = (recipe) => {
129
+ const formatTooltip = (texts) => toArray(texts).map((text) => {
130
+ if (typeof text === "string")
131
+ return formatLiteral(text);
132
+ const format = text.format ? TOOLTIP_FORMAT[text.format](formatLiteral(text.text)) : formatLiteral(text.text);
133
+ return TOOLTIP_COLOR[text.color ?? "gray"](format);
134
+ }).join(" + ");
135
+ const formatRecipe = (recipe) => {
136
136
  const matrix = [[
137
137
  recipe.square || recipe.ring || recipe.corner || recipe[1],
138
138
  recipe.square || recipe.ring || recipe.edge || recipe[2],
@@ -145,165 +145,165 @@ const formatRecipeShaped = (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(formatIngredient)));
148
+ ]].map((row) => formatList(row.map(formatId)));
149
149
  return `[
150
150
  ${matrix.join(",\n ")}
151
151
  ]`;
152
152
  };
153
153
  const formatArgs = (...args) => {
154
- const list = args.filter((arg) => arg !== void 0).map((arg) => {
155
- if (typeof arg === "number")
156
- return `${arg}`;
157
- if (isRecipeShaped(arg))
158
- return formatRecipeShaped(arg);
159
- if (isItem(arg))
160
- return formatItem(arg);
161
- if (Array.isArray(arg))
162
- return formatList(arg);
163
- return arg;
164
- });
154
+ const list = args.filter((x) => x !== void 0).map((x) => Array.isArray(x) ? formatList(x) : x);
165
155
  return list.length > 3 ? `
166
156
  ${list.join(",\n ")}
167
157
  ` : list.join(", ");
168
158
  };
169
159
 
170
- const addCompressor = (recipe) => `mods.avaritia.Compressor.add(${formatArgs(recipe.out, recipe.in[1], recipe.in[0])});`;
171
- const removeCompressor = (ingredient) => `mods.avaritia.Compressor.remove(${ingredient});`;
172
- const addExtreme = (item, recipe) => {
173
- const out = formatArgs(item, recipe.map((row) => formatArgs(row.map(formatIngredient))));
160
+ const addCompressor = (recipe) => `mods.avaritia.Compressor.add(${formatArgs(recipe.out, recipe.in.n, recipe.in.id)});`;
161
+ const removeCompressor = (id) => `mods.avaritia.Compressor.remove(${id});`;
162
+ const addExtreme = (ingredient, recipe) => {
163
+ const out = formatArgs(formatIngredient(ingredient), recipe.map((row) => formatList(row.map(formatId))));
174
164
  return `mods.avaritia.ExtremeCrafting.addShaped(${out});`;
175
165
  };
176
- const removeExtreme = (ingredient) => `mods.avaritia.ExtremeCrafting.remove(${ingredient});`;
177
-
178
- const clamp = (min, max, n) => Math.max(min, Math.min(max, n));
179
- const fill = (n, x) => Array.from({ length: n }).map((_, i) => x ?? i);
166
+ const removeExtreme = (id) => `mods.avaritia.ExtremeCrafting.remove(${id});`;
180
167
 
181
168
  const addComposter = (recipe) => {
182
- const out = formatArgs(recipe[0], clamp(0, 1, recipe[1]), recipe[2] && `"${recipe[2]}"`);
169
+ const out = formatArgs(recipe.id, clamp(0, 1, recipe.fill), recipe.hex && `"${recipe.hex}"`);
183
170
  return `mods.exnihilo.Composting.addRecipe(${out});`;
184
171
  };
185
- const removeComposter = (ingredient) => `mods.exnihilo.Composting.removeRecipe(${ingredient});`;
186
- const addCrucible$1 = (recipe) => `mods.exnihilo.Crucible.addRecipe(${formatArgs(...recipe)});`;
187
- const removeCrucible$1 = (liquid) => `mods.exnihilo.Crucible.removeRecipe(${liquid});`;
172
+ const removeComposter = (id) => `mods.exnihilo.Composting.removeRecipe(${id});`;
173
+ const addCrucible$1 = (recipe) => {
174
+ const out = formatArgs(recipe.id, formatStack(recipe.liquid));
175
+ return `mods.exnihilo.Crucible.addRecipe(${out});`;
176
+ };
177
+ const removeCrucible$1 = (id) => `mods.exnihilo.Crucible.removeRecipe(${id});`;
188
178
  const addCrucibleSource = (recipe) => {
189
- const out = formatArgs(recipe[0], clamp(0, 1, recipe[1]));
179
+ const out = formatArgs(recipe.id, clamp(0, 1, recipe.n));
190
180
  return `mods.exnihilo.Crucible.addHeatSource(${out});`;
191
181
  };
192
- const removeCrucibleSource = (ingredient) => `mods.exnihilo.Crucible.removeHeatSource(${ingredient});`;
193
- const addHammer = (ingredient, recipe) => {
194
- const items = Object.entries(recipe).map((entry) => entry[1].map((chance) => ({
195
- ingredient: entry[0],
196
- chance: clamp(0, 1, Array.isArray(chance) ? chance[0] : chance),
197
- modifier: Array.isArray(chance) ? chance[1] : 1
182
+ const removeCrucibleSource = (id) => `mods.exnihilo.Crucible.removeHeatSource(${id});`;
183
+ const addHammer = (id, recipe) => {
184
+ const items = Object.entries(recipe).map((entry) => toArray(entry[1]).map((chance) => ({
185
+ id: entry[0],
186
+ chance: clamp(0, 1, isObject(chance) ? chance.chance : chance),
187
+ modifier: isObject(chance) ? chance.modifier : 1
198
188
  }))).flat();
199
- const out = formatArgs(ingredient, items.map((item) => item.ingredient), items.map((item) => item.chance), items.map((item) => item.modifier));
189
+ const out = formatArgs(id, items.map((item) => item.id), items.map((item) => item.chance), items.map((item) => item.modifier));
200
190
  return `mods.exnihilo.Hammer.addRecipe(${out});`;
201
191
  };
202
- const removeHammer = (ingredient) => `mods.exnihilo.Hammer.removeRecipe(${ingredient});`;
203
- const addSieve = (ingredient, recipe) => {
192
+ const removeHammer = (id) => `mods.exnihilo.Hammer.removeRecipe(${id});`;
193
+ const addSieve = (id, recipe) => {
204
194
  const items = Object.entries(recipe).map((entry) => fill(Math.ceil(entry[1])).map((i) => ({
205
- ingredient: entry[0],
195
+ id: entry[0],
206
196
  chance: entry[1] - i < 1 ? Math.round(1 / (entry[1] - i)) : 1
207
197
  }))).flat();
208
- const out = formatArgs(ingredient, items.map((item) => item.ingredient), items.map((item) => item.chance));
198
+ const out = formatArgs(id, items.map((item) => item.id), items.map((item) => item.chance));
209
199
  return `mods.exnihilo.Sieve.addRecipe(${out});`;
210
200
  };
211
- const removeSieve = (ingredient) => `mods.exnihilo.Sieve.removeRecipe(${ingredient});`;
201
+ const removeSieve = (id) => `mods.exnihilo.Sieve.removeRecipe(${id});`;
212
202
 
213
- const addQED = (item, recipe) => `mods.extraUtils.QED.addShapedRecipe(${formatArgs(item, recipe)});`;
214
- const removeQED = (ingredient) => `mods.extraUtils.QED.removeRecipe(${ingredient});`;
215
- const replaceQED = (item, recipe) => [
216
- removeQED(Array.isArray(item) ? item[0] : item),
217
- addQED(item, recipe)
203
+ const addQED = (ingredient, recipe) => {
204
+ const out = formatArgs(formatIngredient(ingredient), formatRecipe(recipe));
205
+ return `mods.extraUtils.QED.addShapedRecipe(${out});`;
206
+ };
207
+ const removeQED = (id) => `mods.extraUtils.QED.removeRecipe(${id});`;
208
+ const replaceQED = (ingredient, recipe) => [
209
+ removeQED(Array.isArray(ingredient) ? ingredient[0] : ingredient),
210
+ addQED(ingredient, recipe)
218
211
  ].join("\n");
219
212
 
220
- const addDict = (dict, ingredients) => ingredients.map((ingredient) => `${dict}.add(${ingredient});`).join("\n");
221
- const removeDict = (dict, ingredients) => ingredients.map((ingredient) => `${dict}.remove(${ingredient});`).join("\n");
222
- const withName = (ingredient, name) => `${ingredient}.displayName = ${formatName(name)};`;
223
- const withTooltip = (ingredient, tooltip) => `${ingredient}.addTooltip(${formatTooltip(tooltip)});`;
224
- const withTooltipShift = (ingredient, tooltip) => `${ingredient}.addShiftTooltip(${formatTooltip(tooltip)});`;
225
- const withTag = (tag) => (ingredient) => `${ingredient}.withTag(${tag})`;
226
- const withEnchantments = (enchantment) => {
227
- const enchantments = Array.isArray(enchantment) ? enchantment : [enchantment];
228
- return withTag(`{ ench: ${formatList(enchantments.map(formatEnchantment))} }`);
229
- };
213
+ const addDict = (dict, ids) => ids.map((id) => `${dict}.add(${id});`).join("\n");
214
+ const removeDict = (dict, ids) => ids.map((id) => `${dict}.remove(${id});`).join("\n");
215
+ const withName = (id, name) => `${id}.displayName = ${formatName(name)};`;
216
+ const withTooltip = (id, tooltips) => toArray(tooltips).map((tooltip) => `${id}.addTooltip(${formatTooltip(tooltip)});`).join("\n");
217
+ const withTooltipShift = (id, tooltips) => toArray(tooltips).map((tooltip) => `${id}.addShiftTooltip(${formatTooltip(tooltip)});`).join("\n");
218
+ const withTag = (tag) => (id) => `${id}.withTag(${tag})`;
219
+ const withEnchantment = (enchantments) => withTag(`{ ench: ${formatList(toArray(enchantments).map(formatEnchantment))} }`);
230
220
 
231
- const addLaser = (item) => `MiningLaser.addOre(${formatArgs(item)});`;
232
- const removeLaser = (ingredient) => `MiningLaser.removeOre(${ingredient});`;
233
- const addFoci = (lens, ingredients) => ingredients.map((ingredient) => `MiningLaser.addPreferredOre(${formatArgs(MFR_FOCI[lens], ingredient)});`).join("\n");
234
- const removeFoci = (lens, ingredients) => ingredients.map((ingredient) => `MiningLaser.removePreferredOre(${formatArgs(MFR_FOCI[lens], ingredient)});`).join("\n");
221
+ const addLaser = (ingredient) => `MiningLaser.addOre(${formatArgs(formatIngredient(ingredient))});`;
222
+ const removeLaser = (id) => `MiningLaser.removeOre(${id});`;
223
+ const addFoci = (foci, ids) => ids.map((id) => `MiningLaser.addPreferredOre(${formatArgs(MFR_FOCI[foci], id)});`).join("\n");
224
+ const removeFoci = (foci, ids) => ids.map((id) => `MiningLaser.removePreferredOre(${formatArgs(MFR_FOCI[foci], id)});`).join("\n");
235
225
 
236
- const hide = (ingredient) => `NEI.hide(${ingredient});`;
237
- const addNEI = (ingredient) => `NEI.addEntry(${ingredient});`;
226
+ const hide = (id) => `NEI.hide(${id});`;
227
+ const addNEI = (id) => `NEI.addEntry(${id});`;
238
228
 
239
229
  const addCrucible = (recipe) => {
240
- const out = formatArgs(recipe.rf, recipe.in, recipe.liquid);
230
+ const out = formatArgs(recipe.rf, recipe.in, formatStack(recipe.liquid));
241
231
  return `mods.thermalexpansion.Crucible.addRecipe(${out});`;
242
232
  };
243
- const removeCrucible = (ingredient) => `mods.thermalexpansion.Crucible.removeRecipe(${ingredient});`;
233
+ const removeCrucible = (id) => `mods.thermalexpansion.Crucible.removeRecipe(${id});`;
244
234
  const addFurnace$1 = (recipe) => {
245
- const out = formatArgs(recipe.rf, recipe.in, recipe.out);
235
+ const out = formatArgs(recipe.rf, recipe.in, formatIngredient(recipe.out));
246
236
  return `mods.thermalexpansion.Furnace.addRecipe(${out});`;
247
237
  };
248
- const removeFurnace$1 = (ingredient) => `mods.thermalexpansion.Furnace.removeRecipe(${ingredient});`;
238
+ const removeFurnace$1 = (id) => `mods.thermalexpansion.Furnace.removeRecipe(${id});`;
249
239
  const addInsolator = (recipe) => {
250
- const out = formatArgs(recipe.rf, recipe.left, recipe.right, recipe.out, recipe.bonus && recipe.bonus[0], recipe.bonus && recipe.bonus[1]);
240
+ const out = formatArgs(recipe.rf, formatIngredient(recipe.left), formatIngredient(recipe.right), formatIngredient(recipe.out), recipe.bonus && recipe.bonus.id, recipe.bonus && recipe.bonus.n);
251
241
  return `mods.thermalexpansion.Insolator.addRecipe(${out});`;
252
242
  };
253
- const removeInsolator = (left, right) => `mods.thermalexpansion.Insolator.removeRecipe(${formatArgs(left, right)});`;
243
+ const removeInsolator = (left, right) => {
244
+ const out = formatArgs(formatIngredient(left), formatIngredient(right));
245
+ return `mods.thermalexpansion.Insolator.removeRecipe(${out});`;
246
+ };
254
247
  const addPulverizer = (recipe) => {
255
- const out = formatArgs(recipe.rf, recipe.in, recipe.out, recipe.bonus && recipe.bonus[0], recipe.bonus && recipe.bonus[1]);
248
+ const out = formatArgs(recipe.rf, recipe.in, formatIngredient(recipe.out), recipe.bonus && recipe.bonus.id, recipe.bonus && recipe.bonus.n);
256
249
  return `mods.thermalexpansion.Pulverizer.addRecipe(${out});`;
257
250
  };
258
- const removePulverizer = (ingredient) => `mods.thermalexpansion.Pulverizer.removeRecipe(${ingredient});`;
251
+ const removePulverizer = (id) => `mods.thermalexpansion.Pulverizer.removeRecipe(${id});`;
259
252
  const addSawmill = (recipe) => {
260
- const out = formatArgs(recipe.rf, recipe.in, recipe.out, recipe.bonus && recipe.bonus[0], recipe.bonus && recipe.bonus[1]);
253
+ const out = formatArgs(recipe.rf, recipe.in, formatIngredient(recipe.out), recipe.bonus && recipe.bonus.id, recipe.bonus && recipe.bonus.n);
261
254
  return `mods.thermalexpansion.Sawmill.addRecipe(${out});`;
262
255
  };
263
- const removeSawmill = (ingredient) => `mods.thermalexpansion.Sawmill.removeRecipe(${ingredient});`;
256
+ const removeSawmill = (id) => `mods.thermalexpansion.Sawmill.removeRecipe(${id});`;
264
257
  const addSmelter = (recipe) => {
265
- const out = formatArgs(recipe.rf, recipe.right, recipe.left, recipe.out, recipe.bonus && recipe.bonus[0], recipe.bonus && recipe.bonus[1]);
258
+ const out = formatArgs(recipe.rf, formatIngredient(recipe.right), formatIngredient(recipe.left), formatIngredient(recipe.out), recipe.bonus && recipe.bonus.id, recipe.bonus && recipe.bonus.n);
266
259
  return `mods.thermalexpansion.Smelter.addRecipe(${out});`;
267
260
  };
268
- const removeSmelter = (left, right) => `mods.thermalexpansion.Smelter.removeRecipe(${formatArgs(left, right)});`;
261
+ const removeSmelter = (left, right) => {
262
+ const out = formatArgs(formatIngredient(left), formatIngredient(right));
263
+ return `mods.thermalexpansion.Smelter.removeRecipe(${out});`;
264
+ };
269
265
  const addTransposerFill = (recipe) => {
270
- const out = formatArgs(recipe.rf, recipe.in, recipe.out, recipe.liquid);
266
+ const out = formatArgs(recipe.rf, recipe.in, recipe.out, formatStack(recipe.liquid));
271
267
  return `mods.thermalexpansion.Transposer.addFillRecipe(${out});`;
272
268
  };
273
- const removeTransposerFill = (ingredient, liquid) => `mods.thermalexpansion.Transposer.removeFillRecipe(${formatArgs(ingredient, liquid)});`;
269
+ const removeTransposerFill = (id, liquid) => `mods.thermalexpansion.Transposer.removeFillRecipe(${formatArgs(id, liquid)});`;
274
270
  const addTransposerExtract = (recipe) => {
275
- const out = formatArgs(recipe.rf, recipe.in, recipe.liquid, recipe.bonus && recipe.bonus[0], recipe.bonus && recipe.bonus[1]);
271
+ const out = formatArgs(recipe.rf, recipe.in, formatStack(recipe.liquid), recipe.bonus && recipe.bonus.id, recipe.bonus && recipe.bonus.n);
276
272
  return `mods.thermalexpansion.Transposer.addExtractRecipe(${out});`;
277
273
  };
278
- const removeTransposerExtract = (ingredient) => `mods.thermalexpansion.Transposer.removeExtractRecipe(${ingredient});`;
274
+ const removeTransposerExtract = (id) => `mods.thermalexpansion.Transposer.removeExtractRecipe(${id});`;
279
275
 
280
276
  const add = (item, recipe) => {
281
277
  const type = Array.isArray(recipe) ? "Shapeless" : "Shaped";
282
- return `recipes.add${type}(${formatArgs(item, recipe)});`;
278
+ const out = formatArgs(formatIngredient(item), Array.isArray(recipe) ? formatList(recipe) : formatRecipe(recipe));
279
+ return `recipes.add${type}(${out});`;
280
+ };
281
+ const remove = (id) => `recipes.remove(${id});`;
282
+ const removeShaped = (id) => `recipes.removeShaped(${id});`;
283
+ const removeShapeless = (id) => `recipes.removeShapeless(${id});`;
284
+ const addFurnace = (recipe) => {
285
+ const out = formatArgs(formatIngredient(recipe.out), recipe.in);
286
+ return `furnace.addRecipe(${out});`;
283
287
  };
284
- const remove = (ingredient) => `recipes.remove(${ingredient});`;
285
- const removeShaped = (ingredient) => `recipes.removeShaped(${ingredient});`;
286
- const removeShapeless = (ingredient) => `recipes.removeShapeless(${ingredient});`;
287
- const addFurnace = (recipe) => `furnace.addRecipe(${formatArgs(recipe.out, recipe.in)});`;
288
288
  const removeFurnace = (recipe) => {
289
289
  if (typeof recipe === "string")
290
290
  return `furnace.remove(<*>, ${recipe});`;
291
- return `furnace.remove(${formatArgs(recipe.out, recipe.in)})`;
291
+ return `furnace.remove(${formatArgs(recipe.out, recipe.in)});`;
292
292
  };
293
- const replace = (item, recipe) => {
294
- const ingredient = Array.isArray(item) ? item[0] : item;
293
+ const replace = (ingredient, recipe) => {
294
+ const id = isObject(ingredient) ? ingredient.id : ingredient;
295
295
  return [
296
- Array.isArray(recipe) ? removeShapeless(ingredient) : removeShaped(ingredient),
297
- add(item, recipe)
296
+ Array.isArray(recipe) ? removeShapeless(id) : removeShaped(id),
297
+ add(ingredient, recipe)
298
298
  ].join("\n");
299
299
  };
300
- const replaceAll = (item, recipe) => [
301
- remove(Array.isArray(item) ? item[0] : item),
302
- add(item, recipe)
300
+ const replaceAll = (ingredient, recipe) => [
301
+ remove(isObject(ingredient) ? ingredient.id : ingredient),
302
+ add(ingredient, recipe)
303
303
  ].join("\n");
304
- const replaceMany = (item, recipes) => [
305
- remove(Array.isArray(item) ? item[0] : item),
306
- ...recipes.map((recipe) => add(item, recipe))
304
+ const replaceMany = (ingredient, recipes) => [
305
+ remove(isObject(ingredient) ? ingredient.id : ingredient),
306
+ ...recipes.map((recipe) => add(ingredient, recipe))
307
307
  ].join("\n");
308
308
 
309
309
  exports.add = add;
@@ -356,7 +356,7 @@ exports.replace = replace;
356
356
  exports.replaceAll = replaceAll;
357
357
  exports.replaceMany = replaceMany;
358
358
  exports.replaceQED = replaceQED;
359
- exports.withEnchantments = withEnchantments;
359
+ exports.withEnchantment = withEnchantment;
360
360
  exports.withName = withName;
361
361
  exports.withTag = withTag;
362
362
  exports.withTooltip = withTooltip;
package/dist/zenflow.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- declare const COLOURS: readonly ["black", "darkBlue", "darkGreen", "darkAqua", "darkRed", "darkRed", "darkPurple", "gold", "gray", "darkGray", "blue", "green", "aqua", "red", "lightPurple", "yellow", "white"];
1
+ declare const COLORS: readonly ["black", "darkBlue", "darkGreen", "darkAqua", "darkRed", "darkRed", "darkPurple", "gold", "gray", "darkGray", "blue", "green", "aqua", "red", "lightPurple", "yellow", "white"];
2
2
  declare const FORMATS: readonly ["obfuscated", "bold", "strikethrough", "underline", "italic"];
3
3
  declare const ENCHANTMENTS: {
4
4
  readonly protection: 0;
@@ -43,9 +43,11 @@ declare const MFR_FOCI: {
43
43
  readonly black: 15;
44
44
  };
45
45
 
46
- declare type Ingredients = [ingredient: string, n: number];
47
- declare type Item = string | Ingredients;
48
- declare type Bonus = [item: Item, chance: number];
46
+ declare type Stack = {
47
+ id: string;
48
+ n: number;
49
+ };
50
+ declare type Ingredient = string | Stack;
49
51
  declare type RecipeShaped = Partial<{
50
52
  1: string;
51
53
  2: string;
@@ -66,18 +68,18 @@ declare type RecipeShapeless = string[];
66
68
  declare type Recipe = RecipeShaped | RecipeShapeless;
67
69
  declare type Enchantment = {
68
70
  type: keyof typeof ENCHANTMENTS;
69
- level?: number;
71
+ level?: number | string;
70
72
  short?: boolean;
71
73
  };
72
- declare type TextFormatOptions = {
73
- colour: typeof COLOURS[number];
74
- format: typeof FORMATS[number];
74
+ declare type TextRich = {
75
+ text: string;
76
+ color?: typeof COLORS[number];
77
+ format?: typeof FORMATS[number];
75
78
  };
76
- declare type TextFormat = [text: string, options: Partial<TextFormatOptions>];
77
- declare type Text = string | TextFormat;
79
+ declare type Text = string | TextRich;
78
80
 
79
81
  declare type RecipeCompressor = {
80
- in: Item;
82
+ in: Stack;
81
83
  out: string;
82
84
  };
83
85
  declare type RecipeExtreme = [
@@ -93,135 +95,149 @@ declare type RecipeExtreme = [
93
95
  ];
94
96
  declare const addCompressor: (recipe: RecipeCompressor) => string;
95
97
  /**
96
- * @param ingredient Compressor output
98
+ * @param id Compressor output
97
99
  */
98
- declare const removeCompressor: (ingredient: string) => string;
99
- declare const addExtreme: (item: Item, recipe: RecipeExtreme) => string;
100
+ declare const removeCompressor: (id: string) => string;
101
+ declare const addExtreme: (ingredient: Ingredient, recipe: RecipeExtreme) => string;
100
102
  /**
101
- * @param ingredient Extreme Crafting output
103
+ * @param id Extreme Crafting output
102
104
  */
103
- declare const removeExtreme: (ingredient: string) => string;
105
+ declare const removeExtreme: (id: string) => string;
104
106
 
105
- declare type RecipeComposter = [
106
- ingredient: string,
107
- fill: number,
108
- hex?: string
109
- ];
110
- declare type RecipeCrucible$1 = [
111
- ingredient: string,
112
- liquid: Item
113
- ];
114
- declare type RecipeCrucibleHeat = [
115
- ingredient: string,
116
- heat: number
117
- ];
118
- declare type RecipeHammer = Record<string, Array<number | [n: number, mod: number]>>;
107
+ declare type RecipeComposter = {
108
+ id: string;
109
+ fill: number;
110
+ hex?: string;
111
+ };
112
+ declare type RecipeCrucible$1 = {
113
+ id: string;
114
+ liquid: Stack;
115
+ };
116
+ declare type RecipeHammer = Record<string, Array<number | {
117
+ chance: number;
118
+ modifier: number;
119
+ }>>;
119
120
  declare type RecipeSieve = Record<string, number>;
120
121
  /**
121
122
  * - Fill must be between `0` and `1`
122
123
  */
123
124
  declare const addComposter: (recipe: RecipeComposter) => string;
124
- declare const removeComposter: (ingredient: string) => string;
125
+ declare const removeComposter: (id: string) => string;
125
126
  declare const addCrucible$1: (recipe: RecipeCrucible$1) => string;
126
- declare const removeCrucible$1: (liquid: string) => string;
127
+ declare const removeCrucible$1: (id: string) => string;
127
128
  /**
128
- * - Heat must be between `0` and `1`
129
+ * - `n` must be between `0` and `1`
129
130
  */
130
- declare const addCrucibleSource: (recipe: RecipeCrucibleHeat) => string;
131
- declare const removeCrucibleSource: (ingredient: string) => string;
131
+ declare const addCrucibleSource: (recipe: Stack) => string;
132
+ declare const removeCrucibleSource: (id: string) => string;
132
133
  /**
133
134
  * - Chance must be between `0` and `1`
134
135
  */
135
- declare const addHammer: (ingredient: string, recipe: RecipeHammer) => string;
136
- declare const removeHammer: (ingredient: string) => string;
136
+ declare const addHammer: (id: string, recipe: RecipeHammer) => string;
137
+ declare const removeHammer: (id: string) => string;
137
138
  /**
138
139
  * - Chance must be bigger than `0`
139
140
  */
140
- declare const addSieve: (ingredient: string, recipe: RecipeSieve) => string;
141
- declare const removeSieve: (ingredient: string) => string;
141
+ declare const addSieve: (id: string, recipe: RecipeSieve) => string;
142
+ declare const removeSieve: (id: string) => string;
142
143
 
143
- declare const addQED: (item: Item, recipe: RecipeShaped) => string;
144
+ declare const addQED: (ingredient: Ingredient, recipe: RecipeShaped) => string;
144
145
  /**
145
- * @param ingredient QED output
146
+ * @param id QED output
146
147
  */
147
- declare const removeQED: (ingredient: string) => string;
148
- declare const replaceQED: (item: Item, recipe: RecipeShaped) => string;
148
+ declare const removeQED: (id: string) => string;
149
+ declare const replaceQED: (ingredient: Ingredient, recipe: RecipeShaped) => string;
149
150
 
150
151
  /**
151
152
  * @param dict Valid ore dictionary value: http://minetweaker3.powerofbytes.com/wiki/Tutorial:Ore_Dictionary
152
153
  */
153
- declare const addDict: (dict: string, ingredients: string[]) => string;
154
+ declare const addDict: (dict: string, ids: string[]) => string;
154
155
  /**
155
156
  * @param dict Valid ore dictionary value: http://minetweaker3.powerofbytes.com/wiki/Tutorial:Ore_Dictionary
156
157
  */
157
- declare const removeDict: (dict: string, ingredients: string[]) => string;
158
- declare const withName: (ingredient: string, name: Text | Text[]) => string;
159
- declare const withTooltip: (ingredient: string, tooltip: Text | Text[]) => string;
160
- declare const withTooltipShift: (ingredient: string, tooltip: Text | Text[]) => string;
161
- declare const withTag: (tag: string) => (ingredient: string) => string;
162
- declare const withEnchantments: (enchantment: Enchantment | Enchantment[]) => (ingredient: string) => string;
158
+ declare const removeDict: (dict: string, ids: string[]) => string;
159
+ declare const withName: (id: string, name: Text) => string;
160
+ declare const withTooltip: (id: string, tooltips: Text | Text[]) => string;
161
+ declare const withTooltipShift: (id: string, tooltips: Text | Text[]) => string;
162
+ declare const withTag: (tag: string) => (id: string) => string;
163
+ declare const withEnchantment: (enchantments: Enchantment | Enchantment[]) => (id: string) => string;
163
164
 
164
- declare const addLaser: (item: Item) => string;
165
165
  /**
166
- * @param ingredient - Laser output
166
+ * Requires: `import mods.mfr.MiningLaser;`
167
167
  */
168
- declare const removeLaser: (ingredient: string) => string;
169
- declare const addFoci: (lens: keyof typeof MFR_FOCI, ingredients: string[]) => string;
168
+ declare const addLaser: (ingredient: Ingredient) => string;
170
169
  /**
171
- * @param ingredient - Laser output
172
- */
173
- declare const removeFoci: (lens: keyof typeof MFR_FOCI, ingredients: string[]) => string;
170
+ * - Requires: `import mods.mfr.MiningLaser;`
171
+ * - Accepts ore dictionary
172
+ * @param id - Laser output
173
+ */
174
+ declare const removeLaser: (id: string) => string;
175
+ /**
176
+ * Requires: `import mods.mfr.MiningLaser;`
177
+ */
178
+ declare const addFoci: (foci: keyof typeof MFR_FOCI, ids: string[]) => string;
179
+ /**
180
+ * Requires: `import mods.mfr.MiningLaser;`
181
+ * @param ids - Laser output
182
+ */
183
+ declare const removeFoci: (foci: keyof typeof MFR_FOCI, ids: string[]) => string;
174
184
 
175
- declare const hide: (ingredient: string) => string;
176
- declare const addNEI: (ingredient: string) => string;
185
+ /**
186
+ * Requires: `import mods.nei.NEI;`
187
+ */
188
+ declare const hide: (id: string) => string;
189
+ /**
190
+ * Requires: `import mods.nei.NEI;`
191
+ */
192
+ declare const addNEI: (id: string) => string;
177
193
 
178
194
  declare type RecipeCrucible = {
179
195
  rf: number;
180
196
  in: string;
181
- liquid: Ingredients;
197
+ liquid: Stack;
182
198
  };
183
199
  declare type RecipeFurnace$1 = {
184
200
  rf: number;
185
201
  in: string;
186
- out: Item;
202
+ out: Ingredient;
187
203
  };
188
204
  declare type RecipeInsolator = {
189
205
  rf: number;
190
- left: Item;
191
- right: Item;
192
- out: Item;
193
- bonus?: Bonus;
206
+ left: Ingredient;
207
+ right: Ingredient;
208
+ out: Ingredient;
209
+ bonus?: Stack;
194
210
  };
195
211
  declare type RecipePulverizer = {
196
212
  rf: number;
197
213
  in: string;
198
- out: Item;
199
- bonus?: Bonus;
214
+ out: Ingredient;
215
+ bonus?: Stack;
200
216
  };
201
217
  declare type RecipeSawmill = {
202
218
  rf: number;
203
219
  in: string;
204
- out: Item;
205
- bonus?: Bonus;
220
+ out: Ingredient;
221
+ bonus?: Stack;
206
222
  };
207
223
  declare type RecipeSmelter = {
208
224
  rf: number;
209
- left: Item;
210
- right: Item;
211
- out: Item;
212
- bonus?: Bonus;
225
+ left: Ingredient;
226
+ right: Ingredient;
227
+ out: Ingredient;
228
+ bonus?: Stack;
213
229
  };
214
230
  declare type RecipeTransposerFill = {
215
231
  rf: number;
216
232
  in: string;
217
233
  out: string;
218
- liquid: Ingredients;
234
+ liquid: Stack;
219
235
  };
220
236
  declare type RecipeTransposerExtract = {
221
237
  rf: number;
222
238
  in: string;
223
- liquid: Ingredients;
224
- bonus?: Bonus;
239
+ liquid: Stack;
240
+ bonus?: Stack;
225
241
  };
226
242
  /**
227
243
  * Common values:
@@ -230,7 +246,7 @@ declare type RecipeTransposerExtract = {
230
246
  * - Rocks: `80.000RF ~ 320.000RF, 1000mB`
231
247
  */
232
248
  declare const addCrucible: (recipe: RecipeCrucible) => string;
233
- declare const removeCrucible: (ingredient: string) => string;
249
+ declare const removeCrucible: (id: string) => string;
234
250
  /**
235
251
  * Common values:
236
252
  * - Food: `800RF`
@@ -238,14 +254,14 @@ declare const removeCrucible: (ingredient: string) => string;
238
254
  * - Blocks: `1600RF`
239
255
  */
240
256
  declare const addFurnace$1: (recipe: RecipeFurnace$1) => string;
241
- declare const removeFurnace$1: (ingredient: string) => string;
257
+ declare const removeFurnace$1: (id: string) => string;
242
258
  /**
243
259
  * Common values:
244
260
  * - Phyto-gro: `7200RF`
245
261
  * - Rich phyto-gro: `9600RF`
246
262
  */
247
263
  declare const addInsolator: (recipe: RecipeInsolator) => string;
248
- declare const removeInsolator: (left: Item, right: Item) => string;
264
+ declare const removeInsolator: (left: Ingredient, right: Ingredient) => string;
249
265
  /**
250
266
  * Common values:
251
267
  * - Plants: `1600RF`
@@ -255,9 +271,9 @@ declare const removeInsolator: (left: Item, right: Item) => string;
255
271
  * - Ores: `3200RF`
256
272
  */
257
273
  declare const addPulverizer: (recipe: RecipePulverizer) => string;
258
- declare const removePulverizer: (ingredient: string) => string;
274
+ declare const removePulverizer: (id: string) => string;
259
275
  declare const addSawmill: (recipe: RecipeSawmill) => string;
260
- declare const removeSawmill: (ingredient: string) => string;
276
+ declare const removeSawmill: (id: string) => string;
261
277
  /**
262
278
  * Common values (RF):
263
279
  * - Dust: `200RF ~ 1600RF`
@@ -268,7 +284,7 @@ declare const removeSawmill: (ingredient: string) => string;
268
284
  * - Slag: `7200RF`
269
285
  */
270
286
  declare const addSmelter: (recipe: RecipeSmelter) => string;
271
- declare const removeSmelter: (left: Item, right: Item) => string;
287
+ declare const removeSmelter: (left: Ingredient, right: Ingredient) => string;
272
288
  /**
273
289
  * Common values
274
290
  * - Duct: `800RF, 200mB`
@@ -279,18 +295,18 @@ declare const removeSmelter: (left: Item, right: Item) => string;
279
295
  * - Frame: `16.000RF, 4000mB`
280
296
  */
281
297
  declare const addTransposerFill: (recipe: RecipeTransposerFill) => string;
282
- declare const removeTransposerFill: (ingredient: string, liquid: string) => string;
298
+ declare const removeTransposerFill: (id: string, liquid: string) => string;
283
299
  /**
284
300
  * Common values
285
301
  * - Bucket: `800RF, 1000mB`
286
302
  * - Bottle: `1600RF, 1000mB`
287
303
  */
288
304
  declare const addTransposerExtract: (recipe: RecipeTransposerExtract) => string;
289
- declare const removeTransposerExtract: (ingredient: string) => string;
305
+ declare const removeTransposerExtract: (id: string) => string;
290
306
 
291
307
  declare type RecipeFurnace = {
292
308
  in: string;
293
- out: Item;
309
+ out: Ingredient;
294
310
  };
295
311
  /**
296
312
  * Add crafting recipe
@@ -298,19 +314,19 @@ declare type RecipeFurnace = {
298
314
  * - Recipe: `{}` => Shaped recipe
299
315
  * - Recipe: `[]` => Shapeless recipe
300
316
  */
301
- declare const add: (item: Item, recipe: Recipe) => string;
317
+ declare const add: (item: Ingredient, recipe: Recipe) => string;
302
318
  /**
303
319
  * Remove all crafting recipes (shaped & shapeless)
304
320
  */
305
- declare const remove: (ingredient: string) => string;
321
+ declare const remove: (id: string) => string;
306
322
  /**
307
323
  * Remove all shaped crafting recipes
308
324
  */
309
- declare const removeShaped: (ingredient: string) => string;
325
+ declare const removeShaped: (id: string) => string;
310
326
  /**
311
327
  * Remove all shapeless crafting recipes
312
328
  */
313
- declare const removeShapeless: (ingredient: string) => string;
329
+ declare const removeShapeless: (id: string) => string;
314
330
  declare const addFurnace: (recipe: RecipeFurnace) => string;
315
331
  /**
316
332
  * Remove furnace recipe
@@ -328,11 +344,11 @@ declare const removeFurnace: (recipe: string | {
328
344
  * - Recipe: `{}` => Replaces all shaped recipes
329
345
  * - Recipe: `[]` => Replaces all shapeless recipes
330
346
  */
331
- declare const replace: (item: Item, recipe: Recipe) => string;
347
+ declare const replace: (ingredient: Ingredient, recipe: Recipe) => string;
332
348
  /**
333
349
  * Replace all crafting recipe
334
350
  */
335
- declare const replaceAll: (item: Item, recipe: Recipe) => string;
336
- declare const replaceMany: (item: Item, recipes: Recipe[]) => string;
351
+ declare const replaceAll: (ingredient: Ingredient, recipe: Recipe) => string;
352
+ declare const replaceMany: (ingredient: Ingredient, recipes: Recipe[]) => string;
337
353
 
338
- export { Bonus, Enchantment, Ingredients, Item, Recipe, RecipeShaped, RecipeShapeless, Text, TextFormat, TextFormatOptions, add, addComposter, addCompressor, addCrucible$1 as addCrucibleNihilo, addCrucibleSource, addCrucible as addCrucibleThermal, addDict, addExtreme, addFoci, addFurnace, addFurnace$1 as addFurnaceThermal, addHammer, addInsolator, addLaser, 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, withEnchantments, withName, withTag, withTooltip, withTooltipShift };
354
+ 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, 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 };
package/dist/zenflow.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  const createCode = (code) => `\\u00A7${code}`;
2
2
  const createFormat = (type) => (tooltip) => `format.${type}(${tooltip})`;
3
- const NAME_COLOUR = {
3
+ const NAME_COLOR = {
4
4
  black: createCode("0"),
5
5
  darkBlue: createCode("1"),
6
6
  darkGreen: createCode("2"),
@@ -18,7 +18,15 @@ const NAME_COLOUR = {
18
18
  yellow: createCode("e"),
19
19
  white: createCode("f")
20
20
  };
21
- const TOOLTIP_COLOUR = {
21
+ const NAME_FORMAT = {
22
+ obfuscated: createCode("k"),
23
+ bold: createCode("l"),
24
+ strikethrough: createCode("m"),
25
+ underline: createCode("n"),
26
+ italic: createCode("o"),
27
+ reset: createCode("r")
28
+ };
29
+ const TOOLTIP_COLOR = {
22
30
  black: createFormat("black"),
23
31
  darkBlue: createFormat("darkBlue"),
24
32
  darkGreen: createFormat("darkGreen"),
@@ -36,14 +44,6 @@ const TOOLTIP_COLOUR = {
36
44
  yellow: createFormat("yellow"),
37
45
  white: createFormat("white")
38
46
  };
39
- const NAME_FORMAT = {
40
- obfuscated: createCode("k"),
41
- bold: createCode("l"),
42
- strikethrough: createCode("m"),
43
- underline: createCode("n"),
44
- italic: createCode("o"),
45
- reset: createCode("r")
46
- };
47
47
  const TOOLTIP_FORMAT = {
48
48
  obfuscated: createFormat("obfuscated"),
49
49
  bold: createFormat("bold"),
@@ -94,41 +94,41 @@ const MFR_FOCI = {
94
94
  black: 15
95
95
  };
96
96
 
97
- const isItem = (x) => Array.isArray(x) && x.length === 2 && typeof x[0] === "string" && typeof x[1] === "number";
98
- const isRecipeShaped = (x) => !Array.isArray(x) && typeof x === "object";
99
- const isTextFormat = (x) => Array.isArray(x) && x.length === 2 && (x[1].colour || x[1].format);
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
+ const isObject = (x) => typeof x === "object" && !Array.isArray(x);
100
101
 
101
- const formatItem = (item) => `${item[0]} * ${item[1]}`;
102
+ const formatLiteral = (x) => `"${x}"`;
103
+ const formatId = (id) => id ?? "null";
104
+ const formatStack = (stack) => `${stack.id} * ${stack.n}`;
105
+ const formatIngredient = (ingredient) => isObject(ingredient) ? formatStack(ingredient) : ingredient;
102
106
  const formatList = (list) => `[${list.join(", ")}]`;
103
- const formatIngredient = (ingredient) => ingredient ?? "null";
104
107
  const formatEnchantment = (enchantment) => {
105
108
  const id = `${ENCHANTMENTS[enchantment.type]}${enchantment.short ? " as short" : ""}`;
106
109
  const lvl = `${enchantment.level ?? 1}${enchantment.level ? " as short" : ""}`;
107
110
  return `{ id: ${id}, lvl: ${lvl} }`;
108
111
  };
109
112
  const formatName = (texts) => {
110
- const format = (text) => [
111
- text[1].colour && NAME_COLOUR[text[1].colour],
112
- text[1].format && NAME_FORMAT[text[1].format],
113
- text[0],
114
- (text[1].colour || text[1].format) && NAME_FORMAT.reset
115
- ].filter((x) => x).join("");
116
- if (typeof texts === "string")
117
- return `"${texts}"`;
118
- if (isTextFormat(texts))
119
- return `"${format(texts)}"`;
120
- const formatted = texts.map((text) => typeof text === "string" ? text : format(text)).join("");
113
+ const formatted = toArray(texts).map((text) => {
114
+ if (typeof text === "string")
115
+ return text;
116
+ return [
117
+ text.color && NAME_COLOR[text.color],
118
+ text.format && NAME_FORMAT[text.format],
119
+ text.text,
120
+ (text.color || text.format) && NAME_FORMAT.reset
121
+ ].filter((x) => x !== void 0).join("");
122
+ }).join("");
121
123
  return `"${formatted}"`;
122
124
  };
123
- const formatTooltip = (texts) => {
124
- const format = (text, options) => TOOLTIP_COLOUR[options?.colour ?? "gray"](options?.format ? TOOLTIP_FORMAT[options.format](`"${text}"`) : `"${text}"`);
125
- if (!Array.isArray(texts))
126
- return format(texts);
127
- if (isTextFormat(texts))
128
- return format(...texts);
129
- return texts.map(formatTooltip).join(" + ");
130
- };
131
- const formatRecipeShaped = (recipe) => {
125
+ const formatTooltip = (texts) => toArray(texts).map((text) => {
126
+ if (typeof text === "string")
127
+ return formatLiteral(text);
128
+ const format = text.format ? TOOLTIP_FORMAT[text.format](formatLiteral(text.text)) : formatLiteral(text.text);
129
+ return TOOLTIP_COLOR[text.color ?? "gray"](format);
130
+ }).join(" + ");
131
+ const formatRecipe = (recipe) => {
132
132
  const matrix = [[
133
133
  recipe.square || recipe.ring || recipe.corner || recipe[1],
134
134
  recipe.square || recipe.ring || recipe.edge || recipe[2],
@@ -141,165 +141,165 @@ const formatRecipeShaped = (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(formatIngredient)));
144
+ ]].map((row) => formatList(row.map(formatId)));
145
145
  return `[
146
146
  ${matrix.join(",\n ")}
147
147
  ]`;
148
148
  };
149
149
  const formatArgs = (...args) => {
150
- const list = args.filter((arg) => arg !== void 0).map((arg) => {
151
- if (typeof arg === "number")
152
- return `${arg}`;
153
- if (isRecipeShaped(arg))
154
- return formatRecipeShaped(arg);
155
- if (isItem(arg))
156
- return formatItem(arg);
157
- if (Array.isArray(arg))
158
- return formatList(arg);
159
- return arg;
160
- });
150
+ const list = args.filter((x) => x !== void 0).map((x) => Array.isArray(x) ? formatList(x) : x);
161
151
  return list.length > 3 ? `
162
152
  ${list.join(",\n ")}
163
153
  ` : list.join(", ");
164
154
  };
165
155
 
166
- const addCompressor = (recipe) => `mods.avaritia.Compressor.add(${formatArgs(recipe.out, recipe.in[1], recipe.in[0])});`;
167
- const removeCompressor = (ingredient) => `mods.avaritia.Compressor.remove(${ingredient});`;
168
- const addExtreme = (item, recipe) => {
169
- const out = formatArgs(item, recipe.map((row) => formatArgs(row.map(formatIngredient))));
156
+ const addCompressor = (recipe) => `mods.avaritia.Compressor.add(${formatArgs(recipe.out, recipe.in.n, recipe.in.id)});`;
157
+ const removeCompressor = (id) => `mods.avaritia.Compressor.remove(${id});`;
158
+ const addExtreme = (ingredient, recipe) => {
159
+ const out = formatArgs(formatIngredient(ingredient), recipe.map((row) => formatList(row.map(formatId))));
170
160
  return `mods.avaritia.ExtremeCrafting.addShaped(${out});`;
171
161
  };
172
- const removeExtreme = (ingredient) => `mods.avaritia.ExtremeCrafting.remove(${ingredient});`;
173
-
174
- const clamp = (min, max, n) => Math.max(min, Math.min(max, n));
175
- const fill = (n, x) => Array.from({ length: n }).map((_, i) => x ?? i);
162
+ const removeExtreme = (id) => `mods.avaritia.ExtremeCrafting.remove(${id});`;
176
163
 
177
164
  const addComposter = (recipe) => {
178
- const out = formatArgs(recipe[0], clamp(0, 1, recipe[1]), recipe[2] && `"${recipe[2]}"`);
165
+ const out = formatArgs(recipe.id, clamp(0, 1, recipe.fill), recipe.hex && `"${recipe.hex}"`);
179
166
  return `mods.exnihilo.Composting.addRecipe(${out});`;
180
167
  };
181
- const removeComposter = (ingredient) => `mods.exnihilo.Composting.removeRecipe(${ingredient});`;
182
- const addCrucible$1 = (recipe) => `mods.exnihilo.Crucible.addRecipe(${formatArgs(...recipe)});`;
183
- const removeCrucible$1 = (liquid) => `mods.exnihilo.Crucible.removeRecipe(${liquid});`;
168
+ const removeComposter = (id) => `mods.exnihilo.Composting.removeRecipe(${id});`;
169
+ const addCrucible$1 = (recipe) => {
170
+ const out = formatArgs(recipe.id, formatStack(recipe.liquid));
171
+ return `mods.exnihilo.Crucible.addRecipe(${out});`;
172
+ };
173
+ const removeCrucible$1 = (id) => `mods.exnihilo.Crucible.removeRecipe(${id});`;
184
174
  const addCrucibleSource = (recipe) => {
185
- const out = formatArgs(recipe[0], clamp(0, 1, recipe[1]));
175
+ const out = formatArgs(recipe.id, clamp(0, 1, recipe.n));
186
176
  return `mods.exnihilo.Crucible.addHeatSource(${out});`;
187
177
  };
188
- const removeCrucibleSource = (ingredient) => `mods.exnihilo.Crucible.removeHeatSource(${ingredient});`;
189
- const addHammer = (ingredient, recipe) => {
190
- const items = Object.entries(recipe).map((entry) => entry[1].map((chance) => ({
191
- ingredient: entry[0],
192
- chance: clamp(0, 1, Array.isArray(chance) ? chance[0] : chance),
193
- modifier: Array.isArray(chance) ? chance[1] : 1
178
+ const removeCrucibleSource = (id) => `mods.exnihilo.Crucible.removeHeatSource(${id});`;
179
+ const addHammer = (id, recipe) => {
180
+ const items = Object.entries(recipe).map((entry) => toArray(entry[1]).map((chance) => ({
181
+ id: entry[0],
182
+ chance: clamp(0, 1, isObject(chance) ? chance.chance : chance),
183
+ modifier: isObject(chance) ? chance.modifier : 1
194
184
  }))).flat();
195
- const out = formatArgs(ingredient, items.map((item) => item.ingredient), items.map((item) => item.chance), items.map((item) => item.modifier));
185
+ const out = formatArgs(id, items.map((item) => item.id), items.map((item) => item.chance), items.map((item) => item.modifier));
196
186
  return `mods.exnihilo.Hammer.addRecipe(${out});`;
197
187
  };
198
- const removeHammer = (ingredient) => `mods.exnihilo.Hammer.removeRecipe(${ingredient});`;
199
- const addSieve = (ingredient, recipe) => {
188
+ const removeHammer = (id) => `mods.exnihilo.Hammer.removeRecipe(${id});`;
189
+ const addSieve = (id, recipe) => {
200
190
  const items = Object.entries(recipe).map((entry) => fill(Math.ceil(entry[1])).map((i) => ({
201
- ingredient: entry[0],
191
+ id: entry[0],
202
192
  chance: entry[1] - i < 1 ? Math.round(1 / (entry[1] - i)) : 1
203
193
  }))).flat();
204
- const out = formatArgs(ingredient, items.map((item) => item.ingredient), items.map((item) => item.chance));
194
+ const out = formatArgs(id, items.map((item) => item.id), items.map((item) => item.chance));
205
195
  return `mods.exnihilo.Sieve.addRecipe(${out});`;
206
196
  };
207
- const removeSieve = (ingredient) => `mods.exnihilo.Sieve.removeRecipe(${ingredient});`;
197
+ const removeSieve = (id) => `mods.exnihilo.Sieve.removeRecipe(${id});`;
208
198
 
209
- const addQED = (item, recipe) => `mods.extraUtils.QED.addShapedRecipe(${formatArgs(item, recipe)});`;
210
- const removeQED = (ingredient) => `mods.extraUtils.QED.removeRecipe(${ingredient});`;
211
- const replaceQED = (item, recipe) => [
212
- removeQED(Array.isArray(item) ? item[0] : item),
213
- addQED(item, recipe)
199
+ const addQED = (ingredient, recipe) => {
200
+ const out = formatArgs(formatIngredient(ingredient), formatRecipe(recipe));
201
+ return `mods.extraUtils.QED.addShapedRecipe(${out});`;
202
+ };
203
+ const removeQED = (id) => `mods.extraUtils.QED.removeRecipe(${id});`;
204
+ const replaceQED = (ingredient, recipe) => [
205
+ removeQED(Array.isArray(ingredient) ? ingredient[0] : ingredient),
206
+ addQED(ingredient, recipe)
214
207
  ].join("\n");
215
208
 
216
- const addDict = (dict, ingredients) => ingredients.map((ingredient) => `${dict}.add(${ingredient});`).join("\n");
217
- const removeDict = (dict, ingredients) => ingredients.map((ingredient) => `${dict}.remove(${ingredient});`).join("\n");
218
- const withName = (ingredient, name) => `${ingredient}.displayName = ${formatName(name)};`;
219
- const withTooltip = (ingredient, tooltip) => `${ingredient}.addTooltip(${formatTooltip(tooltip)});`;
220
- const withTooltipShift = (ingredient, tooltip) => `${ingredient}.addShiftTooltip(${formatTooltip(tooltip)});`;
221
- const withTag = (tag) => (ingredient) => `${ingredient}.withTag(${tag})`;
222
- const withEnchantments = (enchantment) => {
223
- const enchantments = Array.isArray(enchantment) ? enchantment : [enchantment];
224
- return withTag(`{ ench: ${formatList(enchantments.map(formatEnchantment))} }`);
225
- };
209
+ const addDict = (dict, ids) => ids.map((id) => `${dict}.add(${id});`).join("\n");
210
+ const removeDict = (dict, ids) => ids.map((id) => `${dict}.remove(${id});`).join("\n");
211
+ const withName = (id, name) => `${id}.displayName = ${formatName(name)};`;
212
+ const withTooltip = (id, tooltips) => toArray(tooltips).map((tooltip) => `${id}.addTooltip(${formatTooltip(tooltip)});`).join("\n");
213
+ const withTooltipShift = (id, tooltips) => toArray(tooltips).map((tooltip) => `${id}.addShiftTooltip(${formatTooltip(tooltip)});`).join("\n");
214
+ const withTag = (tag) => (id) => `${id}.withTag(${tag})`;
215
+ const withEnchantment = (enchantments) => withTag(`{ ench: ${formatList(toArray(enchantments).map(formatEnchantment))} }`);
226
216
 
227
- const addLaser = (item) => `MiningLaser.addOre(${formatArgs(item)});`;
228
- const removeLaser = (ingredient) => `MiningLaser.removeOre(${ingredient});`;
229
- const addFoci = (lens, ingredients) => ingredients.map((ingredient) => `MiningLaser.addPreferredOre(${formatArgs(MFR_FOCI[lens], ingredient)});`).join("\n");
230
- const removeFoci = (lens, ingredients) => ingredients.map((ingredient) => `MiningLaser.removePreferredOre(${formatArgs(MFR_FOCI[lens], ingredient)});`).join("\n");
217
+ const addLaser = (ingredient) => `MiningLaser.addOre(${formatArgs(formatIngredient(ingredient))});`;
218
+ const removeLaser = (id) => `MiningLaser.removeOre(${id});`;
219
+ const addFoci = (foci, ids) => ids.map((id) => `MiningLaser.addPreferredOre(${formatArgs(MFR_FOCI[foci], id)});`).join("\n");
220
+ const removeFoci = (foci, ids) => ids.map((id) => `MiningLaser.removePreferredOre(${formatArgs(MFR_FOCI[foci], id)});`).join("\n");
231
221
 
232
- const hide = (ingredient) => `NEI.hide(${ingredient});`;
233
- const addNEI = (ingredient) => `NEI.addEntry(${ingredient});`;
222
+ const hide = (id) => `NEI.hide(${id});`;
223
+ const addNEI = (id) => `NEI.addEntry(${id});`;
234
224
 
235
225
  const addCrucible = (recipe) => {
236
- const out = formatArgs(recipe.rf, recipe.in, recipe.liquid);
226
+ const out = formatArgs(recipe.rf, recipe.in, formatStack(recipe.liquid));
237
227
  return `mods.thermalexpansion.Crucible.addRecipe(${out});`;
238
228
  };
239
- const removeCrucible = (ingredient) => `mods.thermalexpansion.Crucible.removeRecipe(${ingredient});`;
229
+ const removeCrucible = (id) => `mods.thermalexpansion.Crucible.removeRecipe(${id});`;
240
230
  const addFurnace$1 = (recipe) => {
241
- const out = formatArgs(recipe.rf, recipe.in, recipe.out);
231
+ const out = formatArgs(recipe.rf, recipe.in, formatIngredient(recipe.out));
242
232
  return `mods.thermalexpansion.Furnace.addRecipe(${out});`;
243
233
  };
244
- const removeFurnace$1 = (ingredient) => `mods.thermalexpansion.Furnace.removeRecipe(${ingredient});`;
234
+ const removeFurnace$1 = (id) => `mods.thermalexpansion.Furnace.removeRecipe(${id});`;
245
235
  const addInsolator = (recipe) => {
246
- const out = formatArgs(recipe.rf, recipe.left, recipe.right, recipe.out, recipe.bonus && recipe.bonus[0], recipe.bonus && recipe.bonus[1]);
236
+ const out = formatArgs(recipe.rf, formatIngredient(recipe.left), formatIngredient(recipe.right), formatIngredient(recipe.out), recipe.bonus && recipe.bonus.id, recipe.bonus && recipe.bonus.n);
247
237
  return `mods.thermalexpansion.Insolator.addRecipe(${out});`;
248
238
  };
249
- const removeInsolator = (left, right) => `mods.thermalexpansion.Insolator.removeRecipe(${formatArgs(left, right)});`;
239
+ const removeInsolator = (left, right) => {
240
+ const out = formatArgs(formatIngredient(left), formatIngredient(right));
241
+ return `mods.thermalexpansion.Insolator.removeRecipe(${out});`;
242
+ };
250
243
  const addPulverizer = (recipe) => {
251
- const out = formatArgs(recipe.rf, recipe.in, recipe.out, recipe.bonus && recipe.bonus[0], recipe.bonus && recipe.bonus[1]);
244
+ const out = formatArgs(recipe.rf, recipe.in, formatIngredient(recipe.out), recipe.bonus && recipe.bonus.id, recipe.bonus && recipe.bonus.n);
252
245
  return `mods.thermalexpansion.Pulverizer.addRecipe(${out});`;
253
246
  };
254
- const removePulverizer = (ingredient) => `mods.thermalexpansion.Pulverizer.removeRecipe(${ingredient});`;
247
+ const removePulverizer = (id) => `mods.thermalexpansion.Pulverizer.removeRecipe(${id});`;
255
248
  const addSawmill = (recipe) => {
256
- const out = formatArgs(recipe.rf, recipe.in, recipe.out, recipe.bonus && recipe.bonus[0], recipe.bonus && recipe.bonus[1]);
249
+ const out = formatArgs(recipe.rf, recipe.in, formatIngredient(recipe.out), recipe.bonus && recipe.bonus.id, recipe.bonus && recipe.bonus.n);
257
250
  return `mods.thermalexpansion.Sawmill.addRecipe(${out});`;
258
251
  };
259
- const removeSawmill = (ingredient) => `mods.thermalexpansion.Sawmill.removeRecipe(${ingredient});`;
252
+ const removeSawmill = (id) => `mods.thermalexpansion.Sawmill.removeRecipe(${id});`;
260
253
  const addSmelter = (recipe) => {
261
- const out = formatArgs(recipe.rf, recipe.right, recipe.left, recipe.out, recipe.bonus && recipe.bonus[0], recipe.bonus && recipe.bonus[1]);
254
+ const out = formatArgs(recipe.rf, formatIngredient(recipe.right), formatIngredient(recipe.left), formatIngredient(recipe.out), recipe.bonus && recipe.bonus.id, recipe.bonus && recipe.bonus.n);
262
255
  return `mods.thermalexpansion.Smelter.addRecipe(${out});`;
263
256
  };
264
- const removeSmelter = (left, right) => `mods.thermalexpansion.Smelter.removeRecipe(${formatArgs(left, right)});`;
257
+ const removeSmelter = (left, right) => {
258
+ const out = formatArgs(formatIngredient(left), formatIngredient(right));
259
+ return `mods.thermalexpansion.Smelter.removeRecipe(${out});`;
260
+ };
265
261
  const addTransposerFill = (recipe) => {
266
- const out = formatArgs(recipe.rf, recipe.in, recipe.out, recipe.liquid);
262
+ const out = formatArgs(recipe.rf, recipe.in, recipe.out, formatStack(recipe.liquid));
267
263
  return `mods.thermalexpansion.Transposer.addFillRecipe(${out});`;
268
264
  };
269
- const removeTransposerFill = (ingredient, liquid) => `mods.thermalexpansion.Transposer.removeFillRecipe(${formatArgs(ingredient, liquid)});`;
265
+ const removeTransposerFill = (id, liquid) => `mods.thermalexpansion.Transposer.removeFillRecipe(${formatArgs(id, liquid)});`;
270
266
  const addTransposerExtract = (recipe) => {
271
- const out = formatArgs(recipe.rf, recipe.in, recipe.liquid, recipe.bonus && recipe.bonus[0], recipe.bonus && recipe.bonus[1]);
267
+ const out = formatArgs(recipe.rf, recipe.in, formatStack(recipe.liquid), recipe.bonus && recipe.bonus.id, recipe.bonus && recipe.bonus.n);
272
268
  return `mods.thermalexpansion.Transposer.addExtractRecipe(${out});`;
273
269
  };
274
- const removeTransposerExtract = (ingredient) => `mods.thermalexpansion.Transposer.removeExtractRecipe(${ingredient});`;
270
+ const removeTransposerExtract = (id) => `mods.thermalexpansion.Transposer.removeExtractRecipe(${id});`;
275
271
 
276
272
  const add = (item, recipe) => {
277
273
  const type = Array.isArray(recipe) ? "Shapeless" : "Shaped";
278
- return `recipes.add${type}(${formatArgs(item, recipe)});`;
274
+ const out = formatArgs(formatIngredient(item), Array.isArray(recipe) ? formatList(recipe) : formatRecipe(recipe));
275
+ return `recipes.add${type}(${out});`;
276
+ };
277
+ const remove = (id) => `recipes.remove(${id});`;
278
+ const removeShaped = (id) => `recipes.removeShaped(${id});`;
279
+ const removeShapeless = (id) => `recipes.removeShapeless(${id});`;
280
+ const addFurnace = (recipe) => {
281
+ const out = formatArgs(formatIngredient(recipe.out), recipe.in);
282
+ return `furnace.addRecipe(${out});`;
279
283
  };
280
- const remove = (ingredient) => `recipes.remove(${ingredient});`;
281
- const removeShaped = (ingredient) => `recipes.removeShaped(${ingredient});`;
282
- const removeShapeless = (ingredient) => `recipes.removeShapeless(${ingredient});`;
283
- const addFurnace = (recipe) => `furnace.addRecipe(${formatArgs(recipe.out, recipe.in)});`;
284
284
  const removeFurnace = (recipe) => {
285
285
  if (typeof recipe === "string")
286
286
  return `furnace.remove(<*>, ${recipe});`;
287
- return `furnace.remove(${formatArgs(recipe.out, recipe.in)})`;
287
+ return `furnace.remove(${formatArgs(recipe.out, recipe.in)});`;
288
288
  };
289
- const replace = (item, recipe) => {
290
- const ingredient = Array.isArray(item) ? item[0] : item;
289
+ const replace = (ingredient, recipe) => {
290
+ const id = isObject(ingredient) ? ingredient.id : ingredient;
291
291
  return [
292
- Array.isArray(recipe) ? removeShapeless(ingredient) : removeShaped(ingredient),
293
- add(item, recipe)
292
+ Array.isArray(recipe) ? removeShapeless(id) : removeShaped(id),
293
+ add(ingredient, recipe)
294
294
  ].join("\n");
295
295
  };
296
- const replaceAll = (item, recipe) => [
297
- remove(Array.isArray(item) ? item[0] : item),
298
- add(item, recipe)
296
+ const replaceAll = (ingredient, recipe) => [
297
+ remove(isObject(ingredient) ? ingredient.id : ingredient),
298
+ add(ingredient, recipe)
299
299
  ].join("\n");
300
- const replaceMany = (item, recipes) => [
301
- remove(Array.isArray(item) ? item[0] : item),
302
- ...recipes.map((recipe) => add(item, recipe))
300
+ const replaceMany = (ingredient, recipes) => [
301
+ remove(isObject(ingredient) ? ingredient.id : ingredient),
302
+ ...recipes.map((recipe) => add(ingredient, recipe))
303
303
  ].join("\n");
304
304
 
305
- export { add, addComposter, addCompressor, addCrucible$1 as addCrucibleNihilo, addCrucibleSource, addCrucible as addCrucibleThermal, addDict, addExtreme, addFoci, addFurnace, addFurnace$1 as addFurnaceThermal, addHammer, addInsolator, addLaser, 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, withEnchantments, withName, withTag, withTooltip, withTooltipShift };
305
+ export { add, addComposter, addCompressor, addCrucible$1 as addCrucibleNihilo, addCrucibleSource, addCrucible as addCrucibleThermal, addDict, addExtreme, addFoci, addFurnace, addFurnace$1 as addFurnaceThermal, addHammer, addInsolator, addLaser, 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zen-flow",
3
- "version": "1.15.0",
3
+ "version": "2.0.2",
4
4
  "description": "MineTweaker ZenScript made easy.",
5
5
  "main": "dist/zenflow.cjs",
6
6
  "module": "dist/zenflow.mjs",