zen-flow 2.0.0 → 2.0.3
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 +55 -6
- package/dist/zenflow.cjs +5 -5
- package/dist/zenflow.d.ts +2 -2
- package/dist/zenflow.mjs +5 -5
- package/package.json +1 -1
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>',
|
|
234
|
+
withName('<minecraft:bread>', { text: 'Bread', colour: 'red' });
|
|
188
235
|
|
|
189
236
|
// Bread (bold red text)
|
|
190
|
-
withName('<minecraft:bread>',
|
|
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
|
-
|
|
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>':
|
|
277
|
+
'<minecraft:stick>': 0.5, // 50%
|
|
231
278
|
'<minecraft:bread>': [1, 1, 0.5] // 100%, 100%, 50%
|
|
232
|
-
'<minecraft:stone>': [
|
|
233
|
-
'<minecraft:coal>': [
|
|
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
|
@@ -122,7 +122,7 @@ const formatName = (texts) => {
|
|
|
122
122
|
text.format && NAME_FORMAT[text.format],
|
|
123
123
|
text.text,
|
|
124
124
|
(text.color || text.format) && NAME_FORMAT.reset
|
|
125
|
-
].filter((x) => x).join("");
|
|
125
|
+
].filter((x) => x !== void 0).join("");
|
|
126
126
|
}).join("");
|
|
127
127
|
return `"${formatted}"`;
|
|
128
128
|
};
|
|
@@ -151,7 +151,7 @@ const formatRecipe = (recipe) => {
|
|
|
151
151
|
]`;
|
|
152
152
|
};
|
|
153
153
|
const formatArgs = (...args) => {
|
|
154
|
-
const list = args.filter((x) => x).map((x) => Array.isArray(x) ? formatList(x) : x);
|
|
154
|
+
const list = args.filter((x) => x !== void 0).map((x) => Array.isArray(x) ? formatList(x) : x);
|
|
155
155
|
return list.length > 3 ? `
|
|
156
156
|
${list.join(",\n ")}
|
|
157
157
|
` : list.join(", ");
|
|
@@ -213,8 +213,8 @@ const replaceQED = (ingredient, recipe) => [
|
|
|
213
213
|
const addDict = (dict, ids) => ids.map((id) => `${dict}.add(${id});`).join("\n");
|
|
214
214
|
const removeDict = (dict, ids) => ids.map((id) => `${dict}.remove(${id});`).join("\n");
|
|
215
215
|
const withName = (id, name) => `${id}.displayName = ${formatName(name)};`;
|
|
216
|
-
const withTooltip = (id,
|
|
217
|
-
const withTooltipShift = (id,
|
|
216
|
+
const withTooltip = (id, tooltip) => `${id}.addTooltip(${formatTooltip(tooltip)});`;
|
|
217
|
+
const withTooltipShift = (id, tooltip) => `${id}.addShiftTooltip(${formatTooltip(tooltip)});`;
|
|
218
218
|
const withTag = (tag) => (id) => `${id}.withTag(${tag})`;
|
|
219
219
|
const withEnchantment = (enchantments) => withTag(`{ ench: ${formatList(toArray(enchantments).map(formatEnchantment))} }`);
|
|
220
220
|
|
|
@@ -288,7 +288,7 @@ const addFurnace = (recipe) => {
|
|
|
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
293
|
const replace = (ingredient, recipe) => {
|
|
294
294
|
const id = isObject(ingredient) ? ingredient.id : ingredient;
|
package/dist/zenflow.d.ts
CHANGED
|
@@ -157,8 +157,8 @@ declare const addDict: (dict: string, ids: string[]) => string;
|
|
|
157
157
|
*/
|
|
158
158
|
declare const removeDict: (dict: string, ids: string[]) => string;
|
|
159
159
|
declare const withName: (id: string, name: Text) => string;
|
|
160
|
-
declare const withTooltip: (id: string,
|
|
161
|
-
declare const withTooltipShift: (id: string,
|
|
160
|
+
declare const withTooltip: (id: string, tooltip: Text | Text[]) => string;
|
|
161
|
+
declare const withTooltipShift: (id: string, tooltip: Text | Text[]) => string;
|
|
162
162
|
declare const withTag: (tag: string) => (id: string) => string;
|
|
163
163
|
declare const withEnchantment: (enchantments: Enchantment | Enchantment[]) => (id: string) => string;
|
|
164
164
|
|
package/dist/zenflow.mjs
CHANGED
|
@@ -118,7 +118,7 @@ const formatName = (texts) => {
|
|
|
118
118
|
text.format && NAME_FORMAT[text.format],
|
|
119
119
|
text.text,
|
|
120
120
|
(text.color || text.format) && NAME_FORMAT.reset
|
|
121
|
-
].filter((x) => x).join("");
|
|
121
|
+
].filter((x) => x !== void 0).join("");
|
|
122
122
|
}).join("");
|
|
123
123
|
return `"${formatted}"`;
|
|
124
124
|
};
|
|
@@ -147,7 +147,7 @@ const formatRecipe = (recipe) => {
|
|
|
147
147
|
]`;
|
|
148
148
|
};
|
|
149
149
|
const formatArgs = (...args) => {
|
|
150
|
-
const list = args.filter((x) => x).map((x) => Array.isArray(x) ? formatList(x) : x);
|
|
150
|
+
const list = args.filter((x) => x !== void 0).map((x) => Array.isArray(x) ? formatList(x) : x);
|
|
151
151
|
return list.length > 3 ? `
|
|
152
152
|
${list.join(",\n ")}
|
|
153
153
|
` : list.join(", ");
|
|
@@ -209,8 +209,8 @@ const replaceQED = (ingredient, recipe) => [
|
|
|
209
209
|
const addDict = (dict, ids) => ids.map((id) => `${dict}.add(${id});`).join("\n");
|
|
210
210
|
const removeDict = (dict, ids) => ids.map((id) => `${dict}.remove(${id});`).join("\n");
|
|
211
211
|
const withName = (id, name) => `${id}.displayName = ${formatName(name)};`;
|
|
212
|
-
const withTooltip = (id,
|
|
213
|
-
const withTooltipShift = (id,
|
|
212
|
+
const withTooltip = (id, tooltip) => `${id}.addTooltip(${formatTooltip(tooltip)});`;
|
|
213
|
+
const withTooltipShift = (id, tooltip) => `${id}.addShiftTooltip(${formatTooltip(tooltip)});`;
|
|
214
214
|
const withTag = (tag) => (id) => `${id}.withTag(${tag})`;
|
|
215
215
|
const withEnchantment = (enchantments) => withTag(`{ ench: ${formatList(toArray(enchantments).map(formatEnchantment))} }`);
|
|
216
216
|
|
|
@@ -284,7 +284,7 @@ const addFurnace = (recipe) => {
|
|
|
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
289
|
const replace = (ingredient, recipe) => {
|
|
290
290
|
const id = isObject(ingredient) ? ingredient.id : ingredient;
|