zen-flow 4.0.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/zenflow.cjs CHANGED
@@ -1,9 +1,10 @@
1
1
  'use strict';
2
2
 
3
+ var util = require('node:util');
4
+
3
5
  const isObject = (x) => typeof x === "object" && !Array.isArray(x);
4
6
 
5
7
  const formatFloat = (n) => `${n}F`;
6
- const formatShort = (n) => `${n} as short`;
7
8
  const formatLiteral = (x) => `"${x}"`;
8
9
  const formatId = (id) => typeof id === "string" ? id : "null";
9
10
  const formatWeight = (id, weight) => `${id}.weight(${weight})`;
@@ -56,6 +57,75 @@ const formatRecipeShaped = (recipe) => {
56
57
  }
57
58
  return formatArray(matrix.map((row) => formatArray(row.map(formatId), 3)), 2);
58
59
  };
60
+ const createCode = (code) => `\\u00A7${code}`;
61
+ const NAME_COLOR = {
62
+ black: createCode("0"),
63
+ darkBlue: createCode("1"),
64
+ darkGreen: createCode("2"),
65
+ darkAqua: createCode("3"),
66
+ darkRed: createCode("4"),
67
+ darkPurple: createCode("5"),
68
+ gold: createCode("6"),
69
+ gray: createCode("7"),
70
+ darkGray: createCode("8"),
71
+ blue: createCode("9"),
72
+ green: createCode("a"),
73
+ aqua: createCode("b"),
74
+ red: createCode("c"),
75
+ lightPurple: createCode("d"),
76
+ yellow: createCode("e"),
77
+ white: createCode("f")
78
+ };
79
+ const NAME_STYLE = {
80
+ obfuscated: createCode("k"),
81
+ bold: createCode("l"),
82
+ strikethrough: createCode("m"),
83
+ underline: createCode("n"),
84
+ italic: createCode("o"),
85
+ reset: createCode("r")
86
+ };
87
+ const createFormat = (type) => (tooltip) => `format.${type}(${tooltip})`;
88
+ const TOOLTIP_COLOR = {
89
+ black: createFormat("black"),
90
+ darkBlue: createFormat("darkBlue"),
91
+ darkGreen: createFormat("darkGreen"),
92
+ darkAqua: createFormat("darkAqua"),
93
+ darkRed: createFormat("darkRed"),
94
+ darkPurple: createFormat("darkPurple"),
95
+ gold: createFormat("gold"),
96
+ gray: createFormat("gray"),
97
+ darkGray: createFormat("darkGray"),
98
+ blue: createFormat("blue"),
99
+ green: createFormat("green"),
100
+ aqua: createFormat("aqua"),
101
+ red: createFormat("red"),
102
+ lightPurple: createFormat("lightPurple"),
103
+ yellow: createFormat("yellow"),
104
+ white: createFormat("white")
105
+ };
106
+ const TOOLTIP_STYLE = {
107
+ obfuscated: createFormat("obfuscated"),
108
+ bold: createFormat("bold"),
109
+ strikethrough: createFormat("strikethrough"),
110
+ underline: createFormat("underline"),
111
+ italic: createFormat("italic")
112
+ };
113
+ const formatName = (...texts) => formatLiteral(texts.map((text) => {
114
+ if (typeof text === "string") return text;
115
+ return [
116
+ text.color && NAME_COLOR[text.color],
117
+ text.style && NAME_STYLE[text.style],
118
+ text.text,
119
+ (text.color ?? text.style) && NAME_STYLE.reset
120
+ ].filter((x) => x !== void 0).join("");
121
+ }).join(""));
122
+ const formatTooltip = (...tooltip) => tooltip.map((text) => {
123
+ if (typeof text === "string") return formatLiteral(text);
124
+ let out = formatLiteral(text.text);
125
+ if (text.style) out = TOOLTIP_STYLE[text.style](out);
126
+ if (text.color) out = TOOLTIP_COLOR[text.color](out);
127
+ return out;
128
+ }).join(" + ");
59
129
 
60
130
  const capitalize = (x) => `${x[0].toUpperCase()}${x.slice(1)}`;
61
131
 
@@ -143,7 +213,7 @@ const createLiquid = (id, recipe) => {
143
213
  recipe.luminosity,
144
214
  recipe.temperature,
145
215
  recipe.viscosity,
146
- recipe.colour,
216
+ recipe.color,
147
217
  !!recipe.setFire,
148
218
  recipe.castingMaterial,
149
219
  typeof recipe.texture?.still === "string" && formatLiteral(recipe.texture.still),
@@ -163,7 +233,7 @@ const createMaterial = (id, recipe) => {
163
233
  recipe.mining.speed,
164
234
  recipe.damage,
165
235
  recipe.reinforced,
166
- recipe.colour,
236
+ recipe.color,
167
237
  recipe.value,
168
238
  recipe.handleModifier,
169
239
  recipe.stonebound,
@@ -184,7 +254,7 @@ const addComposter = (id, recipe) => {
184
254
  const out = formatArgs(
185
255
  id,
186
256
  clamp(0, 1, recipe.n),
187
- typeof recipe.colour === "string" && formatLiteral(recipe.colour)
257
+ typeof recipe.color === "string" && formatLiteral(recipe.color)
188
258
  );
189
259
  return `mods.exnihilo.Composting.addRecipe(${out});`;
190
260
  };
@@ -325,111 +395,6 @@ const addFabricatorGlass = (id, recipe) => {
325
395
  };
326
396
  const removeFabricatorGlass = (id) => `mods.forestry.ThermionicFabricator.removeSmelting(${id});`;
327
397
 
328
- const withTag = (tag) => (id) => `${id}.withTag(${tag})`;
329
- const ENCHANTMENTS = {
330
- protection: 0,
331
- fireResistance: 1,
332
- featherFalling: 2,
333
- blastProtection: 3,
334
- projectileProtection: 4,
335
- respiration: 5,
336
- aquaAffinity: 6,
337
- thorns: 7,
338
- sharpness: 16,
339
- smite: 17,
340
- baneOfAntrophods: 18,
341
- knockback: 19,
342
- fireAspect: 20,
343
- looting: 21,
344
- efficiency: 32,
345
- silkTouch: 33,
346
- unbreaking: 34,
347
- fortune: 35,
348
- power: 48,
349
- punch: 49,
350
- flame: 50,
351
- infinity: 51
352
- };
353
- const formatEnchantment = (enchantment) => {
354
- const id = formatShort(ENCHANTMENTS[enchantment.type]);
355
- const lvl = formatShort(enchantment.level);
356
- return `{ id: ${id}, lvl: ${lvl} }`;
357
- };
358
- const withEnchantment = (enchantments) => withTag(`{ ench: ${formatArray(enchantments.map(formatEnchantment), 3)} }`);
359
- const createCode = (code) => `\\u00A7${code}`;
360
- const NAME_COLOR = {
361
- black: createCode("0"),
362
- darkBlue: createCode("1"),
363
- darkGreen: createCode("2"),
364
- darkAqua: createCode("3"),
365
- darkRed: createCode("4"),
366
- darkPurple: createCode("5"),
367
- gold: createCode("6"),
368
- gray: createCode("7"),
369
- darkGray: createCode("8"),
370
- blue: createCode("9"),
371
- green: createCode("a"),
372
- aqua: createCode("b"),
373
- red: createCode("c"),
374
- lightPurple: createCode("d"),
375
- yellow: createCode("e"),
376
- white: createCode("f")
377
- };
378
- const NAME_FORMAT = {
379
- obfuscated: createCode("k"),
380
- bold: createCode("l"),
381
- strikethrough: createCode("m"),
382
- underline: createCode("n"),
383
- italic: createCode("o"),
384
- reset: createCode("r")
385
- };
386
- const createFormat = (type) => (tooltip) => `format.${type}(${tooltip})`;
387
- const TOOLTIP_COLOR = {
388
- black: createFormat("black"),
389
- darkBlue: createFormat("darkBlue"),
390
- darkGreen: createFormat("darkGreen"),
391
- darkAqua: createFormat("darkAqua"),
392
- darkRed: createFormat("darkRed"),
393
- darkPurple: createFormat("darkPurple"),
394
- gold: createFormat("gold"),
395
- gray: createFormat("gray"),
396
- darkGray: createFormat("darkGray"),
397
- blue: createFormat("blue"),
398
- green: createFormat("green"),
399
- aqua: createFormat("aqua"),
400
- red: createFormat("red"),
401
- lightPurple: createFormat("lightPurple"),
402
- yellow: createFormat("yellow"),
403
- white: createFormat("white")
404
- };
405
- const TOOLTIP_FORMAT = {
406
- obfuscated: createFormat("obfuscated"),
407
- bold: createFormat("bold"),
408
- strikethrough: createFormat("strikethrough"),
409
- underline: createFormat("underline"),
410
- italic: createFormat("italic")
411
- };
412
- const formatName = (...texts) => {
413
- const formatted = texts.map((text) => {
414
- if (typeof text === "string") return text;
415
- return [
416
- text.color && NAME_COLOR[text.color],
417
- text.format && NAME_FORMAT[text.format],
418
- text.text,
419
- (text.color ?? text.format) && NAME_FORMAT.reset
420
- ].filter((x) => x !== void 0).join("");
421
- }).join("");
422
- return `"${formatted}"`;
423
- };
424
- const withName = (id, name) => `${id}.displayName = ${formatName(name)};`;
425
- const formatTooltip = (...texts) => texts.map((text) => {
426
- if (typeof text === "string") return TOOLTIP_COLOR.gray(formatLiteral(text));
427
- const format = text.format ? TOOLTIP_FORMAT[text.format](formatLiteral(text.text)) : formatLiteral(text.text);
428
- return TOOLTIP_COLOR[text.color ?? "gray"](format);
429
- }).join(" + ");
430
- const withTooltip = (id, ...tooltips) => tooltips.map((tooltip) => `${id}.addTooltip(${formatTooltip(tooltip)});`).join("\n");
431
- const withTooltipShift = (id, ...tooltips) => tooltips.map((tooltip) => `${id}.addShiftTooltip(${formatTooltip(tooltip)});`).join("\n");
432
-
433
398
  const addChestLoot = (id, recipe) => {
434
399
  const out = formatArgs(
435
400
  formatLiteral(recipe.chest),
@@ -554,11 +519,43 @@ const hide = (id) => `mods.nei.NEI.hide(${id});`;
554
519
  const show = (id) => `mods.nei.NEI.addEntry(${id});`;
555
520
  const rename = (id, name) => `mods.nei.NEI.overrideName(${formatArgs(id, formatLiteral(name))});`;
556
521
 
557
- const addOreDict = (id, dict) => `${dict}.add(${id});`;
558
- const removeOreDict = (id, dict) => `${dict}.remove(${id});`;
522
+ const addOreDict = (dict) => (id) => `${dict}.add(${id});`;
523
+ const removeOreDict = (dict) => (id) => `${dict}.remove(${id});`;
559
524
  const joinOreDict = (a, b) => `${a}.addAll(${b});`;
560
525
  const mirrorOreDict = (a, b) => `${a}.mirror(${b});`;
561
526
 
527
+ const withName = (name) => (id) => `${id}.displayName = ${formatName(name)};`;
528
+ const withTag = (tag) => (id) => {
529
+ return `${id}.withTag(${util.inspect(tag)})`;
530
+ };
531
+ const ENCHANTMENTS = {
532
+ protection: 0,
533
+ fireProtection: 1,
534
+ featherFalling: 2,
535
+ blastProtection: 3,
536
+ projectileProtection: 4,
537
+ respiration: 5,
538
+ aquaAffinity: 6,
539
+ thorns: 7,
540
+ sharpness: 16,
541
+ smite: 17,
542
+ baneOfAntrophods: 18,
543
+ knockback: 19,
544
+ fireAspect: 20,
545
+ looting: 21,
546
+ efficiency: 32,
547
+ silkTouch: 33,
548
+ unbreaking: 34,
549
+ fortune: 35,
550
+ power: 48,
551
+ punch: 49,
552
+ flame: 50,
553
+ infinity: 51
554
+ };
555
+ const withEnchantment = (...enchantments) => withTag({ ench: enchantments });
556
+ const withTooltip = (...tooltip) => (id) => `${id}.addTooltip(${formatTooltip(...tooltip)});`;
557
+ const withTooltipShift = (...tooltip) => (id) => `${id}.addShiftTooltip(${formatTooltip(...tooltip)});`;
558
+
562
559
  const formatBonus = (bonus) => bonus ? [
563
560
  bonus.id,
564
561
  Math.round(bonus.chance * 100)
@@ -777,7 +774,7 @@ const setMaterialStats = (material, recipe) => {
777
774
  recipe.level.reinforced,
778
775
  recipe.level.stonebound,
779
776
  formatLiteral(recipe.style),
780
- recipe.colour
777
+ recipe.color
781
778
  );
782
779
  return `mods.tconstruct.ToolStats.setStats(${out});`;
783
780
  };
@@ -885,6 +882,7 @@ const setArrowAccuracy = (material, accuracy) => {
885
882
  return `mods.tconstruct.TooLStats.setArrowAccuracy(${out});`;
886
883
  };
887
884
 
885
+ exports.ENCHANTMENTS = ENCHANTMENTS;
888
886
  exports.MATERIALS = MATERIALS;
889
887
  exports.MODIFIERS = MODIFIERS;
890
888
  exports.add = add;
package/dist/zenflow.d.ts CHANGED
@@ -30,6 +30,15 @@ type RecipeShaped = Partial<{
30
30
  type RecipeShapeless = string[];
31
31
  type Recipe = RecipeShaped | RecipeShapeless;
32
32
 
33
+ type TextRich = {
34
+ text: string;
35
+ color?: typeof COLORS[number];
36
+ style?: typeof STYLES[number];
37
+ };
38
+ type Text = string | TextRich;
39
+ declare const COLORS: readonly ["black", "darkBlue", "darkGreen", "darkAqua", "darkRed", "darkRed", "darkPurple", "gold", "gray", "darkGray", "blue", "green", "aqua", "red", "lightPurple", "yellow", "white"];
40
+ declare const STYLES: readonly ["obfuscated", "bold", "strikethrough", "underline", "italic"];
41
+
33
42
  type RecipeGrinder = {
34
43
  in: string;
35
44
  turns: number;
@@ -155,7 +164,7 @@ type RecipeLiquid = {
155
164
  luminosity: number;
156
165
  temperature: number;
157
166
  viscosity: number;
158
- colour: string;
167
+ color: string;
159
168
  setFire?: boolean;
160
169
  castingMaterial?: number;
161
170
  texture?: {
@@ -183,7 +192,7 @@ type RecipeMaterial = {
183
192
  };
184
193
  damage: number;
185
194
  reinforced: number;
186
- colour: string;
195
+ color: string;
187
196
  value: number;
188
197
  handleModifier: number;
189
198
  stonebound: number;
@@ -212,7 +221,7 @@ declare const createMaterial: (id: string, recipe: RecipeMaterial) => string;
212
221
 
213
222
  type RecipeComposter = {
214
223
  n: number;
215
- colour?: string;
224
+ color?: string;
216
225
  };
217
226
  /**
218
227
  * Add [Composter](https://ftb.fandom.com/wiki/Barrel_(Ex_Nihilo)) recipe
@@ -463,48 +472,6 @@ declare const addFabricatorGlass: (id: string, recipe: RecipeFabricatorGlass) =>
463
472
  */
464
473
  declare const removeFabricatorGlass: (id: string) => string;
465
474
 
466
- declare const withTag: (tag: string) => (id: string) => string;
467
- declare const ENCHANTMENTS: {
468
- readonly protection: 0;
469
- readonly fireResistance: 1;
470
- readonly featherFalling: 2;
471
- readonly blastProtection: 3;
472
- readonly projectileProtection: 4;
473
- readonly respiration: 5;
474
- readonly aquaAffinity: 6;
475
- readonly thorns: 7;
476
- readonly sharpness: 16;
477
- readonly smite: 17;
478
- readonly baneOfAntrophods: 18;
479
- readonly knockback: 19;
480
- readonly fireAspect: 20;
481
- readonly looting: 21;
482
- readonly efficiency: 32;
483
- readonly silkTouch: 33;
484
- readonly unbreaking: 34;
485
- readonly fortune: 35;
486
- readonly power: 48;
487
- readonly punch: 49;
488
- readonly flame: 50;
489
- readonly infinity: 51;
490
- };
491
- type Enchantment = {
492
- type: keyof typeof ENCHANTMENTS;
493
- level: number;
494
- };
495
- declare const withEnchantment: (enchantments: Enchantment[]) => (id: string) => string;
496
- declare const COLORS: readonly ["black", "darkBlue", "darkGreen", "darkAqua", "darkRed", "darkRed", "darkPurple", "gold", "gray", "darkGray", "blue", "green", "aqua", "red", "lightPurple", "yellow", "white"];
497
- declare const FORMATS: readonly ["obfuscated", "bold", "strikethrough", "underline", "italic"];
498
- type TextRich = {
499
- text: string;
500
- color?: typeof COLORS[number];
501
- format?: typeof FORMATS[number];
502
- };
503
- type Text = string | TextRich;
504
- declare const withName: (id: string, name: Text) => string;
505
- declare const withTooltip: (id: string, ...tooltips: Text[]) => string;
506
- declare const withTooltipShift: (id: string, ...tooltips: Text[]) => string;
507
-
508
475
  type RecipeChestLoot = {
509
476
  chest: string;
510
477
  n?: number;
@@ -867,13 +834,13 @@ declare const rename: (id: string, name: string) => string;
867
834
  *
868
835
  * @see https://minetweaker3.aizistral.com/wiki/Tutorial:Ore_Dictionary
869
836
  */
870
- declare const addOreDict: (id: string, dict: string) => string;
837
+ declare const addOreDict: (dict: string) => (id: string) => string;
871
838
  /**
872
839
  * Remove item from valid ore dictionary
873
840
  *
874
841
  * @see https://minetweaker3.aizistral.com/wiki/Tutorial:Ore_Dictionary
875
842
  */
876
- declare const removeOreDict: (id: string, dict: string) => string;
843
+ declare const removeOreDict: (dict: string) => (id: string) => string;
877
844
  /**
878
845
  * Add all entries from `b` into `a`
879
846
  *
@@ -887,6 +854,40 @@ declare const joinOreDict: (a: string, b: string) => string;
887
854
  */
888
855
  declare const mirrorOreDict: (a: string, b: string) => string;
889
856
 
857
+ declare const withName: (name: Text) => (id: string) => string;
858
+ declare const withTag: (tag: Record<string, unknown>) => (id: string) => string;
859
+ declare const ENCHANTMENTS: {
860
+ readonly protection: 0;
861
+ readonly fireProtection: 1;
862
+ readonly featherFalling: 2;
863
+ readonly blastProtection: 3;
864
+ readonly projectileProtection: 4;
865
+ readonly respiration: 5;
866
+ readonly aquaAffinity: 6;
867
+ readonly thorns: 7;
868
+ readonly sharpness: 16;
869
+ readonly smite: 17;
870
+ readonly baneOfAntrophods: 18;
871
+ readonly knockback: 19;
872
+ readonly fireAspect: 20;
873
+ readonly looting: 21;
874
+ readonly efficiency: 32;
875
+ readonly silkTouch: 33;
876
+ readonly unbreaking: 34;
877
+ readonly fortune: 35;
878
+ readonly power: 48;
879
+ readonly punch: 49;
880
+ readonly flame: 50;
881
+ readonly infinity: 51;
882
+ };
883
+ type Enchantment = {
884
+ id: number;
885
+ lvl: number;
886
+ };
887
+ declare const withEnchantment: (...enchantments: Enchantment[]) => (id: string) => string;
888
+ declare const withTooltip: (...tooltip: Text[]) => (id: string) => string;
889
+ declare const withTooltipShift: (...tooltip: Text[]) => (id: string) => string;
890
+
890
891
  type RecipeMagmaCrucible = {
891
892
  rf: number;
892
893
  input: string;
@@ -1334,7 +1335,7 @@ declare const removeRepairMaterial: (id: string, material?: string) => string;
1334
1335
  type RecipeToolStats = {
1335
1336
  name: string;
1336
1337
  style: string;
1337
- colour: string;
1338
+ color: string;
1338
1339
  durability: number;
1339
1340
  speed: number;
1340
1341
  damage: number;
@@ -1531,4 +1532,4 @@ declare const setArrowBreakChance: (material: string, breakChance: number) => st
1531
1532
  */
1532
1533
  declare const setArrowAccuracy: (material: string, accuracy: number) => string;
1533
1534
 
1534
- export { type Bonus, type Cast, type Enchantment, type Ingredient, MATERIALS, MODIFIERS, type Recipe, type RecipeArrowStats, type RecipeBlock, type RecipeBowStats, type RecipeCarpenter, type RecipeCastingBasin, type RecipeCastingTable, type RecipeCentrifuge, type RecipeChestLoot, type RecipeComposter, type RecipeCompressor, type RecipeDryingRack, type RecipeExtreme, type RecipeFabricator, type RecipeFabricatorGlass, type RecipeFermenter, type RecipeFermenterFuel, type RecipeFurnace, type RecipeGrinder, type RecipeHammer, type RecipeHarvester, type RecipeInductionSmelter, type RecipeInscriber, type RecipeInsolator, type RecipeItem, type RecipeLaser, type RecipeLiquid, type RecipeMagmaCrucible, type RecipeMaterial, type RecipeMoistener, type RecipePulverizer, type RecipeRedstoneFurnace, type RecipeRepairMaterial, type RecipeSawmill, type RecipeShaped, type RecipeShapeless, type RecipeSieve, type RecipeSmelteryFluid, type RecipeSmelteryFuel, type RecipeSqueezer, type RecipeStill, type RecipeToolStats, type RecipeTransposerExtract, type RecipeTransposerFill, type Stack, type Text, type TextRich, add, addBiomeRubberTree, addBlacklistAutospawner, addCarpenter, addCastingBasin, addCastingTable, addCentrifuge, addChestLoot, addComposter, addCompressor, addCrucible, addCrucibleFuel, addDryingRack, addExtreme, addFabricator, addFabricatorGlass, addFermenter, addFermenterFuel, addFurnace, addFurnaceFuel, addGrinder, addHammer, addHarvester, addInductionSmelter, addInscriber, addInsolator, addLaser, addLaserFoci, addLaserOre, addMagmaCrucible, addMirror, addMoistener, addOreDict, addPlanter, addPulverizer, addQED, addRedstoneFurnace, addRepairMaterial, addSawmill, addSeed, addShaped, addShapeless, addSieve, addSludgeBoiler, addSmelteryAlloy, addSmelteryFluid, addSmelteryFuel, addSqueezer, addStill, addTransposerExtract, addTransposerFill, createBlock, createItem, createLiquid, createMaterial, hide, joinOreDict, mirrorOreDict, remove, removeBiomeRubberTree, removeBlacklistAutospawner, removeCarpenter, removeCastingBasin, removeCastingTable, removeCentrifuge, removeChestLoot, removeComposter, removeCompressor, removeCrucible, removeCrucibleFuel, removeDryingRack, removeExtreme, removeFabricator, removeFabricatorGlass, removeFermenter, removeFermenterFuel, removeFurnace, removeFurnaceFuel, removeGrinder, removeHammer, removeInductionSmelter, removeInscriber, removeInsolator, removeLaserFoci, removeLaserOre, removeMagmaCrucible, removeModifier, removeMoistener, removeOreDict, removePulverizer, removeQED, removeRedstoneFurnace, removeRepairMaterial, removeSawmill, removeSeed, removeShaped, removeShapeless, removeSieve, removeSludgeBoiler, removeSmelteryAlloy, removeSmelteryFluid, removeSmelteryFuel, removeSqueezer, removeStill, removeTransposerExtract, removeTransposerFill, rename, setArrowAccuracy, setArrowBreakChance, setArrowMass, setArrowStats, setBowMaterialDrawspeed, setBowMaterialDurability, setBowMaterialFlightSpeed, setBowMaterialStats, setMaterialAbility, setMaterialDamage, setMaterialDurability, setMaterialHandleModifier, setMaterialLevelStonebound, setMaterialMiningLevel, setMaterialName, setMaterialReinforcedLevel, setMaterialSpeed, setMaterialStats, setMaterialStyle, show, withEnchantment, withName, withTag, withTooltip, withTooltipShift };
1535
+ export { type Bonus, type Cast, ENCHANTMENTS, type Enchantment, type Ingredient, MATERIALS, MODIFIERS, type Recipe, type RecipeArrowStats, type RecipeBlock, type RecipeBowStats, type RecipeCarpenter, type RecipeCastingBasin, type RecipeCastingTable, type RecipeCentrifuge, type RecipeChestLoot, type RecipeComposter, type RecipeCompressor, type RecipeDryingRack, type RecipeExtreme, type RecipeFabricator, type RecipeFabricatorGlass, type RecipeFermenter, type RecipeFermenterFuel, type RecipeFurnace, type RecipeGrinder, type RecipeHammer, type RecipeHarvester, type RecipeInductionSmelter, type RecipeInscriber, type RecipeInsolator, type RecipeItem, type RecipeLaser, type RecipeLiquid, type RecipeMagmaCrucible, type RecipeMaterial, type RecipeMoistener, type RecipePulverizer, type RecipeRedstoneFurnace, type RecipeRepairMaterial, type RecipeSawmill, type RecipeShaped, type RecipeShapeless, type RecipeSieve, type RecipeSmelteryFluid, type RecipeSmelteryFuel, type RecipeSqueezer, type RecipeStill, type RecipeToolStats, type RecipeTransposerExtract, type RecipeTransposerFill, type Stack, type Text, type TextRich, add, addBiomeRubberTree, addBlacklistAutospawner, addCarpenter, addCastingBasin, addCastingTable, addCentrifuge, addChestLoot, addComposter, addCompressor, addCrucible, addCrucibleFuel, addDryingRack, addExtreme, addFabricator, addFabricatorGlass, addFermenter, addFermenterFuel, addFurnace, addFurnaceFuel, addGrinder, addHammer, addHarvester, addInductionSmelter, addInscriber, addInsolator, addLaser, addLaserFoci, addLaserOre, addMagmaCrucible, addMirror, addMoistener, addOreDict, addPlanter, addPulverizer, addQED, addRedstoneFurnace, addRepairMaterial, addSawmill, addSeed, addShaped, addShapeless, addSieve, addSludgeBoiler, addSmelteryAlloy, addSmelteryFluid, addSmelteryFuel, addSqueezer, addStill, addTransposerExtract, addTransposerFill, createBlock, createItem, createLiquid, createMaterial, hide, joinOreDict, mirrorOreDict, remove, removeBiomeRubberTree, removeBlacklistAutospawner, removeCarpenter, removeCastingBasin, removeCastingTable, removeCentrifuge, removeChestLoot, removeComposter, removeCompressor, removeCrucible, removeCrucibleFuel, removeDryingRack, removeExtreme, removeFabricator, removeFabricatorGlass, removeFermenter, removeFermenterFuel, removeFurnace, removeFurnaceFuel, removeGrinder, removeHammer, removeInductionSmelter, removeInscriber, removeInsolator, removeLaserFoci, removeLaserOre, removeMagmaCrucible, removeModifier, removeMoistener, removeOreDict, removePulverizer, removeQED, removeRedstoneFurnace, removeRepairMaterial, removeSawmill, removeSeed, removeShaped, removeShapeless, removeSieve, removeSludgeBoiler, removeSmelteryAlloy, removeSmelteryFluid, removeSmelteryFuel, removeSqueezer, removeStill, removeTransposerExtract, removeTransposerFill, rename, setArrowAccuracy, setArrowBreakChance, setArrowMass, setArrowStats, setBowMaterialDrawspeed, setBowMaterialDurability, setBowMaterialFlightSpeed, setBowMaterialStats, setMaterialAbility, setMaterialDamage, setMaterialDurability, setMaterialHandleModifier, setMaterialLevelStonebound, setMaterialMiningLevel, setMaterialName, setMaterialReinforcedLevel, setMaterialSpeed, setMaterialStats, setMaterialStyle, show, withEnchantment, withName, withTag, withTooltip, withTooltipShift };
package/dist/zenflow.mjs CHANGED
@@ -1,7 +1,8 @@
1
+ import util from 'node:util';
2
+
1
3
  const isObject = (x) => typeof x === "object" && !Array.isArray(x);
2
4
 
3
5
  const formatFloat = (n) => `${n}F`;
4
- const formatShort = (n) => `${n} as short`;
5
6
  const formatLiteral = (x) => `"${x}"`;
6
7
  const formatId = (id) => typeof id === "string" ? id : "null";
7
8
  const formatWeight = (id, weight) => `${id}.weight(${weight})`;
@@ -54,6 +55,75 @@ const formatRecipeShaped = (recipe) => {
54
55
  }
55
56
  return formatArray(matrix.map((row) => formatArray(row.map(formatId), 3)), 2);
56
57
  };
58
+ const createCode = (code) => `\\u00A7${code}`;
59
+ const NAME_COLOR = {
60
+ black: createCode("0"),
61
+ darkBlue: createCode("1"),
62
+ darkGreen: createCode("2"),
63
+ darkAqua: createCode("3"),
64
+ darkRed: createCode("4"),
65
+ darkPurple: createCode("5"),
66
+ gold: createCode("6"),
67
+ gray: createCode("7"),
68
+ darkGray: createCode("8"),
69
+ blue: createCode("9"),
70
+ green: createCode("a"),
71
+ aqua: createCode("b"),
72
+ red: createCode("c"),
73
+ lightPurple: createCode("d"),
74
+ yellow: createCode("e"),
75
+ white: createCode("f")
76
+ };
77
+ const NAME_STYLE = {
78
+ obfuscated: createCode("k"),
79
+ bold: createCode("l"),
80
+ strikethrough: createCode("m"),
81
+ underline: createCode("n"),
82
+ italic: createCode("o"),
83
+ reset: createCode("r")
84
+ };
85
+ const createFormat = (type) => (tooltip) => `format.${type}(${tooltip})`;
86
+ const TOOLTIP_COLOR = {
87
+ black: createFormat("black"),
88
+ darkBlue: createFormat("darkBlue"),
89
+ darkGreen: createFormat("darkGreen"),
90
+ darkAqua: createFormat("darkAqua"),
91
+ darkRed: createFormat("darkRed"),
92
+ darkPurple: createFormat("darkPurple"),
93
+ gold: createFormat("gold"),
94
+ gray: createFormat("gray"),
95
+ darkGray: createFormat("darkGray"),
96
+ blue: createFormat("blue"),
97
+ green: createFormat("green"),
98
+ aqua: createFormat("aqua"),
99
+ red: createFormat("red"),
100
+ lightPurple: createFormat("lightPurple"),
101
+ yellow: createFormat("yellow"),
102
+ white: createFormat("white")
103
+ };
104
+ const TOOLTIP_STYLE = {
105
+ obfuscated: createFormat("obfuscated"),
106
+ bold: createFormat("bold"),
107
+ strikethrough: createFormat("strikethrough"),
108
+ underline: createFormat("underline"),
109
+ italic: createFormat("italic")
110
+ };
111
+ const formatName = (...texts) => formatLiteral(texts.map((text) => {
112
+ if (typeof text === "string") return text;
113
+ return [
114
+ text.color && NAME_COLOR[text.color],
115
+ text.style && NAME_STYLE[text.style],
116
+ text.text,
117
+ (text.color ?? text.style) && NAME_STYLE.reset
118
+ ].filter((x) => x !== void 0).join("");
119
+ }).join(""));
120
+ const formatTooltip = (...tooltip) => tooltip.map((text) => {
121
+ if (typeof text === "string") return formatLiteral(text);
122
+ let out = formatLiteral(text.text);
123
+ if (text.style) out = TOOLTIP_STYLE[text.style](out);
124
+ if (text.color) out = TOOLTIP_COLOR[text.color](out);
125
+ return out;
126
+ }).join(" + ");
57
127
 
58
128
  const capitalize = (x) => `${x[0].toUpperCase()}${x.slice(1)}`;
59
129
 
@@ -141,7 +211,7 @@ const createLiquid = (id, recipe) => {
141
211
  recipe.luminosity,
142
212
  recipe.temperature,
143
213
  recipe.viscosity,
144
- recipe.colour,
214
+ recipe.color,
145
215
  !!recipe.setFire,
146
216
  recipe.castingMaterial,
147
217
  typeof recipe.texture?.still === "string" && formatLiteral(recipe.texture.still),
@@ -161,7 +231,7 @@ const createMaterial = (id, recipe) => {
161
231
  recipe.mining.speed,
162
232
  recipe.damage,
163
233
  recipe.reinforced,
164
- recipe.colour,
234
+ recipe.color,
165
235
  recipe.value,
166
236
  recipe.handleModifier,
167
237
  recipe.stonebound,
@@ -182,7 +252,7 @@ const addComposter = (id, recipe) => {
182
252
  const out = formatArgs(
183
253
  id,
184
254
  clamp(0, 1, recipe.n),
185
- typeof recipe.colour === "string" && formatLiteral(recipe.colour)
255
+ typeof recipe.color === "string" && formatLiteral(recipe.color)
186
256
  );
187
257
  return `mods.exnihilo.Composting.addRecipe(${out});`;
188
258
  };
@@ -323,111 +393,6 @@ const addFabricatorGlass = (id, recipe) => {
323
393
  };
324
394
  const removeFabricatorGlass = (id) => `mods.forestry.ThermionicFabricator.removeSmelting(${id});`;
325
395
 
326
- const withTag = (tag) => (id) => `${id}.withTag(${tag})`;
327
- const ENCHANTMENTS = {
328
- protection: 0,
329
- fireResistance: 1,
330
- featherFalling: 2,
331
- blastProtection: 3,
332
- projectileProtection: 4,
333
- respiration: 5,
334
- aquaAffinity: 6,
335
- thorns: 7,
336
- sharpness: 16,
337
- smite: 17,
338
- baneOfAntrophods: 18,
339
- knockback: 19,
340
- fireAspect: 20,
341
- looting: 21,
342
- efficiency: 32,
343
- silkTouch: 33,
344
- unbreaking: 34,
345
- fortune: 35,
346
- power: 48,
347
- punch: 49,
348
- flame: 50,
349
- infinity: 51
350
- };
351
- const formatEnchantment = (enchantment) => {
352
- const id = formatShort(ENCHANTMENTS[enchantment.type]);
353
- const lvl = formatShort(enchantment.level);
354
- return `{ id: ${id}, lvl: ${lvl} }`;
355
- };
356
- const withEnchantment = (enchantments) => withTag(`{ ench: ${formatArray(enchantments.map(formatEnchantment), 3)} }`);
357
- const createCode = (code) => `\\u00A7${code}`;
358
- const NAME_COLOR = {
359
- black: createCode("0"),
360
- darkBlue: createCode("1"),
361
- darkGreen: createCode("2"),
362
- darkAqua: createCode("3"),
363
- darkRed: createCode("4"),
364
- darkPurple: createCode("5"),
365
- gold: createCode("6"),
366
- gray: createCode("7"),
367
- darkGray: createCode("8"),
368
- blue: createCode("9"),
369
- green: createCode("a"),
370
- aqua: createCode("b"),
371
- red: createCode("c"),
372
- lightPurple: createCode("d"),
373
- yellow: createCode("e"),
374
- white: createCode("f")
375
- };
376
- const NAME_FORMAT = {
377
- obfuscated: createCode("k"),
378
- bold: createCode("l"),
379
- strikethrough: createCode("m"),
380
- underline: createCode("n"),
381
- italic: createCode("o"),
382
- reset: createCode("r")
383
- };
384
- const createFormat = (type) => (tooltip) => `format.${type}(${tooltip})`;
385
- const TOOLTIP_COLOR = {
386
- black: createFormat("black"),
387
- darkBlue: createFormat("darkBlue"),
388
- darkGreen: createFormat("darkGreen"),
389
- darkAqua: createFormat("darkAqua"),
390
- darkRed: createFormat("darkRed"),
391
- darkPurple: createFormat("darkPurple"),
392
- gold: createFormat("gold"),
393
- gray: createFormat("gray"),
394
- darkGray: createFormat("darkGray"),
395
- blue: createFormat("blue"),
396
- green: createFormat("green"),
397
- aqua: createFormat("aqua"),
398
- red: createFormat("red"),
399
- lightPurple: createFormat("lightPurple"),
400
- yellow: createFormat("yellow"),
401
- white: createFormat("white")
402
- };
403
- const TOOLTIP_FORMAT = {
404
- obfuscated: createFormat("obfuscated"),
405
- bold: createFormat("bold"),
406
- strikethrough: createFormat("strikethrough"),
407
- underline: createFormat("underline"),
408
- italic: createFormat("italic")
409
- };
410
- const formatName = (...texts) => {
411
- const formatted = texts.map((text) => {
412
- if (typeof text === "string") return text;
413
- return [
414
- text.color && NAME_COLOR[text.color],
415
- text.format && NAME_FORMAT[text.format],
416
- text.text,
417
- (text.color ?? text.format) && NAME_FORMAT.reset
418
- ].filter((x) => x !== void 0).join("");
419
- }).join("");
420
- return `"${formatted}"`;
421
- };
422
- const withName = (id, name) => `${id}.displayName = ${formatName(name)};`;
423
- const formatTooltip = (...texts) => texts.map((text) => {
424
- if (typeof text === "string") return TOOLTIP_COLOR.gray(formatLiteral(text));
425
- const format = text.format ? TOOLTIP_FORMAT[text.format](formatLiteral(text.text)) : formatLiteral(text.text);
426
- return TOOLTIP_COLOR[text.color ?? "gray"](format);
427
- }).join(" + ");
428
- const withTooltip = (id, ...tooltips) => tooltips.map((tooltip) => `${id}.addTooltip(${formatTooltip(tooltip)});`).join("\n");
429
- const withTooltipShift = (id, ...tooltips) => tooltips.map((tooltip) => `${id}.addShiftTooltip(${formatTooltip(tooltip)});`).join("\n");
430
-
431
396
  const addChestLoot = (id, recipe) => {
432
397
  const out = formatArgs(
433
398
  formatLiteral(recipe.chest),
@@ -552,11 +517,43 @@ const hide = (id) => `mods.nei.NEI.hide(${id});`;
552
517
  const show = (id) => `mods.nei.NEI.addEntry(${id});`;
553
518
  const rename = (id, name) => `mods.nei.NEI.overrideName(${formatArgs(id, formatLiteral(name))});`;
554
519
 
555
- const addOreDict = (id, dict) => `${dict}.add(${id});`;
556
- const removeOreDict = (id, dict) => `${dict}.remove(${id});`;
520
+ const addOreDict = (dict) => (id) => `${dict}.add(${id});`;
521
+ const removeOreDict = (dict) => (id) => `${dict}.remove(${id});`;
557
522
  const joinOreDict = (a, b) => `${a}.addAll(${b});`;
558
523
  const mirrorOreDict = (a, b) => `${a}.mirror(${b});`;
559
524
 
525
+ const withName = (name) => (id) => `${id}.displayName = ${formatName(name)};`;
526
+ const withTag = (tag) => (id) => {
527
+ return `${id}.withTag(${util.inspect(tag)})`;
528
+ };
529
+ const ENCHANTMENTS = {
530
+ protection: 0,
531
+ fireProtection: 1,
532
+ featherFalling: 2,
533
+ blastProtection: 3,
534
+ projectileProtection: 4,
535
+ respiration: 5,
536
+ aquaAffinity: 6,
537
+ thorns: 7,
538
+ sharpness: 16,
539
+ smite: 17,
540
+ baneOfAntrophods: 18,
541
+ knockback: 19,
542
+ fireAspect: 20,
543
+ looting: 21,
544
+ efficiency: 32,
545
+ silkTouch: 33,
546
+ unbreaking: 34,
547
+ fortune: 35,
548
+ power: 48,
549
+ punch: 49,
550
+ flame: 50,
551
+ infinity: 51
552
+ };
553
+ const withEnchantment = (...enchantments) => withTag({ ench: enchantments });
554
+ const withTooltip = (...tooltip) => (id) => `${id}.addTooltip(${formatTooltip(...tooltip)});`;
555
+ const withTooltipShift = (...tooltip) => (id) => `${id}.addShiftTooltip(${formatTooltip(...tooltip)});`;
556
+
560
557
  const formatBonus = (bonus) => bonus ? [
561
558
  bonus.id,
562
559
  Math.round(bonus.chance * 100)
@@ -775,7 +772,7 @@ const setMaterialStats = (material, recipe) => {
775
772
  recipe.level.reinforced,
776
773
  recipe.level.stonebound,
777
774
  formatLiteral(recipe.style),
778
- recipe.colour
775
+ recipe.color
779
776
  );
780
777
  return `mods.tconstruct.ToolStats.setStats(${out});`;
781
778
  };
@@ -883,4 +880,4 @@ const setArrowAccuracy = (material, accuracy) => {
883
880
  return `mods.tconstruct.TooLStats.setArrowAccuracy(${out});`;
884
881
  };
885
882
 
886
- export { MATERIALS, MODIFIERS, add, addBiomeRubberTree, addBlacklistAutospawner, addCarpenter, addCastingBasin, addCastingTable, addCentrifuge, addChestLoot, addComposter, addCompressor, addCrucible, addCrucibleFuel, addDryingRack, addExtreme, addFabricator, addFabricatorGlass, addFermenter, addFermenterFuel, addFurnace, addFurnaceFuel, addGrinder, addHammer, addHarvester, addInductionSmelter, addInscriber, addInsolator, addLaser, addLaserFoci, addLaserOre, addMagmaCrucible, addMirror, addMoistener, addOreDict, addPlanter, addPulverizer, addQED, addRedstoneFurnace, addRepairMaterial, addSawmill, addSeed, addShaped, addShapeless, addSieve, addSludgeBoiler, addSmelteryAlloy, addSmelteryFluid, addSmelteryFuel, addSqueezer, addStill, addTransposerExtract, addTransposerFill, createBlock, createItem, createLiquid, createMaterial, hide, joinOreDict, mirrorOreDict, remove, removeBiomeRubberTree, removeBlacklistAutospawner, removeCarpenter, removeCastingBasin, removeCastingTable, removeCentrifuge, removeChestLoot, removeComposter, removeCompressor, removeCrucible, removeCrucibleFuel, removeDryingRack, removeExtreme, removeFabricator, removeFabricatorGlass, removeFermenter, removeFermenterFuel, removeFurnace, removeFurnaceFuel, removeGrinder, removeHammer, removeInductionSmelter, removeInscriber, removeInsolator, removeLaserFoci, removeLaserOre, removeMagmaCrucible, removeModifier, removeMoistener, removeOreDict, removePulverizer, removeQED, removeRedstoneFurnace, removeRepairMaterial, removeSawmill, removeSeed, removeShaped, removeShapeless, removeSieve, removeSludgeBoiler, removeSmelteryAlloy, removeSmelteryFluid, removeSmelteryFuel, removeSqueezer, removeStill, removeTransposerExtract, removeTransposerFill, rename, setArrowAccuracy, setArrowBreakChance, setArrowMass, setArrowStats, setBowMaterialDrawspeed, setBowMaterialDurability, setBowMaterialFlightSpeed, setBowMaterialStats, setMaterialAbility, setMaterialDamage, setMaterialDurability, setMaterialHandleModifier, setMaterialLevelStonebound, setMaterialMiningLevel, setMaterialName, setMaterialReinforcedLevel, setMaterialSpeed, setMaterialStats, setMaterialStyle, show, withEnchantment, withName, withTag, withTooltip, withTooltipShift };
883
+ export { ENCHANTMENTS, MATERIALS, MODIFIERS, add, addBiomeRubberTree, addBlacklistAutospawner, addCarpenter, addCastingBasin, addCastingTable, addCentrifuge, addChestLoot, addComposter, addCompressor, addCrucible, addCrucibleFuel, addDryingRack, addExtreme, addFabricator, addFabricatorGlass, addFermenter, addFermenterFuel, addFurnace, addFurnaceFuel, addGrinder, addHammer, addHarvester, addInductionSmelter, addInscriber, addInsolator, addLaser, addLaserFoci, addLaserOre, addMagmaCrucible, addMirror, addMoistener, addOreDict, addPlanter, addPulverizer, addQED, addRedstoneFurnace, addRepairMaterial, addSawmill, addSeed, addShaped, addShapeless, addSieve, addSludgeBoiler, addSmelteryAlloy, addSmelteryFluid, addSmelteryFuel, addSqueezer, addStill, addTransposerExtract, addTransposerFill, createBlock, createItem, createLiquid, createMaterial, hide, joinOreDict, mirrorOreDict, remove, removeBiomeRubberTree, removeBlacklistAutospawner, removeCarpenter, removeCastingBasin, removeCastingTable, removeCentrifuge, removeChestLoot, removeComposter, removeCompressor, removeCrucible, removeCrucibleFuel, removeDryingRack, removeExtreme, removeFabricator, removeFabricatorGlass, removeFermenter, removeFermenterFuel, removeFurnace, removeFurnaceFuel, removeGrinder, removeHammer, removeInductionSmelter, removeInscriber, removeInsolator, removeLaserFoci, removeLaserOre, removeMagmaCrucible, removeModifier, removeMoistener, removeOreDict, removePulverizer, removeQED, removeRedstoneFurnace, removeRepairMaterial, removeSawmill, removeSeed, removeShaped, removeShapeless, removeSieve, removeSludgeBoiler, removeSmelteryAlloy, removeSmelteryFluid, removeSmelteryFuel, removeSqueezer, removeStill, removeTransposerExtract, removeTransposerFill, rename, setArrowAccuracy, setArrowBreakChance, setArrowMass, setArrowStats, setBowMaterialDrawspeed, setBowMaterialDurability, setBowMaterialFlightSpeed, setBowMaterialStats, setMaterialAbility, setMaterialDamage, setMaterialDurability, setMaterialHandleModifier, setMaterialLevelStonebound, setMaterialMiningLevel, setMaterialName, setMaterialReinforcedLevel, setMaterialSpeed, setMaterialStats, setMaterialStyle, show, withEnchantment, withName, withTag, withTooltip, withTooltipShift };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zen-flow",
3
- "version": "4.0.0",
3
+ "version": "4.2.0",
4
4
  "description": "MineTweaker ZenScript made easy.",
5
5
  "main": "dist/zenflow.cjs",
6
6
  "module": "dist/zenflow.mjs",