zen-flow
v2.10.0
Published
MineTweaker ZenScript made easy.
Downloads
76
Maintainers
Readme
Install
$ npm i zen-flow -D
Note: This package requires Node >10.12.0 and Minecraft 1.7.10.
Features
- Easy to use API, written in TypeScript.
- Polymorphic and variadic; do more with less code.
- Supports both MineTweaker3 and ModTweaker.
- Formatted output; makes debugging easier.
Getting started
Crafting Table Add crafting recipe
import { vanilla } from 'zen-flow';
vanilla.add('<minecraft:saddle>', {
1: '<minecraft:leather>', 2: '<minecraft:leather>', 3: '<minecraft:leather>',
4: '<ore:ingotIron', 5: '<minecraft:string>', 6: '<ore:ingotIron>'
});
/**
* recipes.addShaped(<minecraft:saddle>, [
* [<minecraft:leather>, <minecraft:leather>, <minecraft:leather>],
* [<ore:ingotIron>, <minecraft:string>, <ore:ingotIron>],
* [null, null, null]
* ]);
**/
vanilla.add('<minecraft:saddle>', { edge: '<minecraft:leather>' });
/**
* recipes.addShaped(<minecraft:saddle>, [
* [null, <minecraft:leather>, null],
* [<minecraft:leather>, null, <minecraft:leather>],
* [null, <minecraft:leather>, null]
* ]);
**/
Extra Utilities generators Remove & hide generators
import { nei, vanilla } from 'zen-flow';
Array.from({ length: 11 })
.map((_, i) => [
`<ExtraUtilities:generator${i === 0 ? '' : `:${i}`}>`,
`<ExtraUtilities:generator.8${i === 0 ? '' : `:${i}`}>`,
`<ExtraUtilities:generator.64${i === 0 ? '' : `:${i}`}>`
])
.flat()
.map(generator => [
vanilla.remove(generator),
nei.hide(generator)
].join('\n'));
/**
* recipes.remove(<ExtraUtilities:generator>);
* NEI.hide(<ExtraUtilities:generator>);
* [...]
* recipes.remove(<ExtraUtilities:generator.64:10>);
* NEI.hide(<ExtraUtilities:generator.64:10>);
**/
API
Patterns
Shaped crafting recipes support the following shorthand patterns, in order:
Square
[
[square, square, null],
[square, square, null],
[null, null, null]
]
Ring
[
[ring, ring, ring],
[ring, center, ring],
[ring, ring, ring]
]
Edge / Corner
[
[corner, edge, corner],
[edge, center, edge],
[corner, edge, corner]
]
Default
[
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
]
Recipes
Items
addDict
- Add ingredients to ore dictionaryremoveDict
- Remove ingredients from ore dictionarywithName
- Change item namewithTooltip
- Add item tooltip*withTooltipShift
- Add shift item tooltip*withTag
- Add item NBT tag datawithEnchantment
- Add item enchantment(s)
* It is currently not possible to remove item tooltips.
Formatting
withName
, withTooltip
and withTooltipShift
accept formatting strings:
// Bread
withName('<minecraft:bread>', 'Bread');
// Bread (with red text)
withName('<minecraft:bread>', { text: 'Bread', colour: 'red' });
// Bread (bold red text)
withName('<minecraft:bread>', { text: 'Bread', colour: 'red', format: 'bold' });
// Bread (normal text) with butter (yellow italic text)
withName('<minecraft:bread>', [
'Bread',
{ text: 'with butter', colour: 'yellow', format: 'italic' }
]);
Vanilla
add
- Add a crafting table recipe.- Shaped recipe:
object
- Shapeless recipe:
Array
- Shaped recipe:
addMirror
- Adds a shaped crafting table recipe with mirrored variant.remove
- Removes both shaped and shapeless recipesremoveShaped
- Removes only shaped recipesremoveShapeless
- Removes only shaped recipesreplace
- Replaced crafting recipe- Shaped recipe:
object
- Shapeless recipe:
Array
- Shaped recipe:
replaceAll
- Replace all recipesreplaceMany
- Remove all recipes and add multiple recipesaddFurnace
- Adds furnace reciperemoveFurnace
- Removes furnace recipeaddFurnaceFuel
- Add furnace fuel (excluding vanilla fuels)removeFurnaceFuel
- Removes furnace fuel (excluding vanilla fuels)
Forestry
addCarpenter
- Add Carpenter reciperemoveCarpenter
- Remove Carpenter recipeaddCentrifuge
- Add Centrifuge reciperemoveCentrifuge
- Remove Centrifuge recipeaddFermenter
- Add Fermenter reciperemoveFermenter
- Remove Fermenter recipeaddFermenterFuel
- Add Fermenter fuelremoveFermenterFuel
- Remove Fermenter fueladdMoistener
- Add Moistener reciperemoveMoistener
- Remove Moistener recipeaddSqueezer
- Add Squeezer reciperemoveSqueezer
- Remove Squeezer recipeaddStill
- Add Still reciperemoveStill
- Remove Still recipeaddFabricator
- Add Thermionic Fabricator reciperemoveFabricator
- Remove Thermionic Fabricator recipeaddFabricatorFuel
- Add Thermionic Fabricator glass sourceremoveFabricatorFuel
- Remove Thermionic Fabricator glass source
Applied Energistics 2
addGrinder
- Add Quartz Grindstone recipebonus
must be a value between0
and1
removeGrinder
- Remove Quartz Grindstone recipeaddInscriber
- Add Inscriber reciperemoveInscriber
- Remove Inscriber recipe
Avaritia
addCompressor
- Add Neutronium Compressor reciperemoveCompressor
- Remove Neutronium Compressor recipeaddExtreme
- Add Extreme Crafting reciperemoveExtreme
- Remove Extreme Crafting recipe
ExNihilo
addComposter
- Add item that can be composted to dirtfill
must be a value between0
and1
removeComposter
- Remove item that can be composted to dirtaddCrucibleNihilo
- Add crucible reciperemoveCrucibleNihilo
- Remove crucible recipeaddCrucibleSource
- Add crucible heat sourceheat
must be a value between0
and1
removeCrucibleSource
- Remove crucible heat sourceaddHammer
- Add hammer reciperemoveHammer
- Remove hammer recipeaddSieve
- Add sieve recipe- Some percentages are impossible, such as
0.7 => 1 / 0.7 => ~1.42 => 1 (100%)
0.13 => 1 / 0.13 => ~7.69 => 8 (12.5%)
- Some percentages are impossible, such as
removeSieve
- Remove sieve recipe
Examples
import { exnihilo } from 'zen-flow';
exnilo.addHammer('<minecraft:cobblestone>', {
'<minecraft:stick>': 0.5, // 50%
'<minecraft:bread>': [1, 1, 0.5] // 100%, 100%, 50%
'<minecraft:stone>': [{ chance: 1, modifier: 2 }, { chance: 0.5, modifier: 1 }] // 100% with 2x modifier, 50% with 1x modifier
'<minecraft:coal>': [{ chance: 1, modifier: 2 }, 1] // 100% with 2x modifier, 100%
});
exnihilo.addSieve('<minecraft:cobblestone>', {
'<minecraft:stick': 2.5 // 250%
'<minecraft:bread>': 0.33 // 33%
});
ExtraUtilities
addQED
- Add QED recipe- QED only accepts shaped recipes
removeQED
- Remove QED recipereplaceQED
- Replace QED recipe
MineFactoryReloaded
addLaser
- Add ore to the Mining Laser ore tableremoveLaser
- Remove ore from the Mining Laser ore tableaddFoci
- Add ores to the Laser Focus ore tableremoveFoci
- Remove ores from the Laser Focus ore table
NEI
hide
- Hide item from NEIaddNEI
- Add item to NEI
ThermalExpansion
addCrucibleThermal
- Add Magma Crucible reciperemoveCrucibleThermal
- Remove Magma Crucible recipeaddFurnaceThermal
- Add Redstone Furnace reciperemoveFurnaceThermal
- Remove Redstone Furnace recipeaddInsolator
- Add Phytogenic Insolator reciperemoveInsolator
- Remove Phytogenic Insolator recipeaddPulverizer
- Add Pulverizer reciperemovePulverizer
- Remove Pulverizer recipeaddSawmill
- Add Sawmill reciperemoveSawmill
- Remove Sawmill recipeaddSmelter
- Add Induction Smelter reciperemoveSmelter
- Remove Induction Smelter recipeaddTransposerFill
- Add Fluid Transposer fill reciperemoveTransposerFill
- Remove Fluid Transposer fill recipeaddTransposerExtract
- Add Fluid Transposer extract reciperemoveTransposerExtract
- Remove Fluid Transposer extract recipe
* All bonus properties take a number between 1 and 100
Tinkers' Construct
addCastBasin
- Add Casting Basin reciperemoveCastBasin
- Remove Casting Basin recipeaddCastTable
- Add Casting Table reciperemoveCastTable
- Remove Casting Table recipeaddDryingRack
- Add Drying Rack reciperemoveDryingRack
- Remove Drying Rack reciperemoveModifier
- Removes modifieraddSmeltery
- Add Smeltery reciperemoveSmeltery
- Remove Smeltery recipeaddSmelteryAlloy
- Add Smeltery alloy reciperemoveSmelteryAlloy
- Remove Smeltery alloy recipeaddSmelteryFuel
- Add Smeltery fuelremoveSmelteryFuel
- Remove Smeltery fueladdRepair
- Add repair materialremoveRepair
- Remove repair materialsetMaterialStats
- Set material statssetMaterialName
- Set material namesetMaterialLevelHarvest
- Set material harvest levelsetMaterialDurability
- Set material durabilitysetMaterialSpeed
- Set material speedsetMaterialDamage
- Set material damagesetMaterialModifierHandle
- Set material handle modifiersetMaterialLevelReinforced
- Set material reinforced levelsetMaterialLevelStonebound
- Set material stonebound levelsetMaterialStyle
- Set material stylesetMaterialAbility
- Set material abilitysetBowStats
- Set bow statssetBowDurability
- Set bow durabilitysetBowDrawSpeed
- Set bow draw speedsetBowFlightSpeed
- Set bow flight speedsetArrowStats
- Set arrow statssetArrowMass
- Set arrow masssetArrowBreak
, - Set arrow break percentagesetArrowAccuracy
- set arrow accuracy