FET - Forked Ender Tweaker
FET 是 Shadows_of_Fire 的原始 EnderTweaker 的一个分支版本
EnderIO 与 CraftTweaker 之间的接口。
它支持使用 ZenScript 为 EnderIO 机器添加和移除配方,从而实现 热重载(通过 ZenRecipeReload),便于整合包定制。
✨ 本分支的主要改进
-
支持最新版本的 EnderIO:
所有受支持的机制均已在最新版 1.12.2 EnderIO (v.5.3.72) 中测试并正常工作。
部分机制也可能在旧版 EnderIO (5.3.67 - 5.3.71) 上运行,但不保证能正确运作。
-
热重载功能: 添加了使用 /ct reload 和 /jeiReload 命令来热重载你的 ZenScript 脚本的能力,无需完全重启游戏即可应用更改。
(注意:需要 ZenRecipeReload)。
-
改进的日志记录: crafttweaker.log 和游戏内聊天栏中的错误信息更加清晰,有助于你调试脚本。
支持的机器:
合金冶炼炉 •
燃烧发电机 •
附魔台 •
研磨机 •
切片拼接器 •
灵魂绑定器 •
反应槽 •
储液罐
? 文档
重载功能
热重载
要启用脚本重载,必须在你的 ZenScript 文件的第一行包含 #reloadable 预处理指令。
#reloadable
// ...在此处导入模块...
// ...在此处编写你的脚本...
一旦对脚本进行了任何更改(添加或移除了配方),请运行 /ct reload 命令以重载脚本,并运行 /jeiReload 命令以刷新 JEI 配方列表。
你可以在 ZenUtils wiki 找到更多关于重载的有用信息。
合金冶炼炉 (mods.enderio.AlloySmelter)
合金冶炼炉是一个复杂的机制,实现了自己的熔化系统,可以同时熔炼最多三种物品并将它们合并成合金。
添加配方
AlloySmelter.addRecipe(IItemStack output, IItemStack[] inputs, @Optional int energyCost, @Optional xp)
AlloySmelter.addRecipe(
<minecraft:diamond>,
[<minecraft:dirt>, <minecraft:sand>],
2000,
0.5
);
参数:
output (IItemStack) - 合成操作的结果。
inputs (IIngredient[]) - 熔炼合金所需的物品。
energyCost (int, 可选) - 所需 µI 能量(默认值:5000)。
xp (float, 可选) - 获得的经验值(默认值:0.0)。
移除配方
(注意:你无法使用 FET 的 AlloySmelter 类移除标准熔炼配方(例如 面粉 > 面包),因为这些使用的是原版 Minecraft 熔炉熔炼系统。对于此类配方,请使用 CraftTweaker 的熔炉处理器。)
性能提示: 由于合金冶炼炉缺乏原生的配方移除工具,FET 在移除时会重建整个配方列表。这是一项“昂贵”的操作。如果你需要移除 多个配方,最好使用多配方移除格式 以便一次性完成。
1. 按输出结果移除
AlloySmelter.removeRecipe(...IItemStack output)
// 移除单个配方
AlloySmelter.removeRecipe(<enderio:item_alloy_ingot:0>); // 电气钢锭
// 移除多个配方(VarArgs 格式)
AlloySmelter.removeRecipe(
<enderio:item_alloy_ingot:0>, // 电气钢锭
<enderio:item_alloy_ingot:1>, // 动力合金
<enderio:item_alloy_ingot:2> // 活力合金
);
// 移除多个配方(数组格式)
AlloySmelter.removeRecipe([
<enderio:item_alloy_ingot:0>, // 电气钢锭
<enderio:item_alloy_ingot:1> // 动力合金
]);
参数:
2. 按输入物品移除
(注意:removeByInputs 方法要求传入数组/二维数组,不支持 VarArgs。)
AlloySmelter.removeByInputs(IItemStack[] inputs)
AlloySmelter.removeByInputs(IItemStack[][] inputs)
// 移除使用这些确切输入物品的配方
AlloySmelter.removeByInputs(
[<minecraft:iron_ingot>,
<enderio:item_material:23>,
<enderio:item_material:5>]
); // 电气钢锭
// 同时移除多个配方配置(数组的数组)
AlloySmelter.removeByInputs([
[<minecraft:soul_sand>, <minecraft:gold_ingot>], // 灵魂金锭
[<minecraft:iron_ingot>, <minecraft:redstone>] // 导电合金锭
]);
参数:
燃烧发电机 (mods.enderio.CombustionGen)
通过燃烧液体燃料并使用液体冷却剂进行冷却来产生 µI(微兆无限能量)。
(注意:该机器采用混搭系统。一旦注册了某种燃料,它可以与 任何 已注册的冷却剂配合使用,反之亦然。
GUI 中显示的值单位为 t/mB(每毫桶ticks数)。这代表 持续时间)。
其逻辑基于热平衡。燃烧燃料产生热量。冷却剂吸收这些热量。
燃烧发电机机制的基本理解:
(注:变量 标记的变量是您在 ZenScript 脚本中设置的变量。
变量 标记的变量源自 EnderIO 的源代码)。
1. 电容器与机器修饰符
您可以通过 EnderIO XML 配方配置随意配置机器和电容器层级的乘数。它们都有一个基础值和一种缩放类型(声明数学运算将如何处理基础值)。对于燃烧发电机,我们通常有以下最终乘数:
-
电容器品质乘数(capQuality):
基本配置为普通和增强型燃烧发电机声明如下:
<capacitor key="enderio:block_combustion_generator/gen" base="1" scaler="CHEMICAL" />
<capacitor key="enderio:block_enhanced_combustion_generator/gen" base="1" scaler="CHEMICAL" />
公式:1.0 + (CapacitorLevel - 1) * 0.25
- 基础电容器 (Lvl 1): 1.00
- 双层电容器 (Lvl 2): 1.25
- 八极电容器 (Lvl 3): 1.50
(注:对于自定义电容器或来自附加模组的光容器,您需要使用相同的缩放类型及其各自的层级值)。
-
机器品质(machineQuality):
基本配置声明如下:
<capacitor key="enderio:block_combustion_generator/gen" base="1" scaler="CHEMICAL" />
<capacitor key="enderio:block_enhanced_combustion_generator/gen" base="200" scaler="CHEMICAL" />
- 燃烧发电机: 1.00
- 增强型燃烧发电机:
200 * 0.01 = 2.0
2. 能量生成 (µI/t)
公式: energyPerTick = Math.round(powerPerCycle * capQuality * machineQuality)
3. 燃料持续时间 (t/mB)
确定 1 mB 燃料能持续多少个刻。更高级别的电容器会消耗更快的燃料以维持更高的功率输出。
totalBurnTime = 每 1000 mB 的总刻数(在脚本中设置)。
- 公式:
ticksPerFuel = Math.max((int)(totalBurnTime / capQuality / 1000.0F), 1)
4. 冷却剂持续时间 (t/mB)
机器根据能量生成产生热量。
-
A. 冷却能力(每 mB):
1 mB 流体可以移除多少热量。
cooling = (373.25 - Fluid_Temp_K) * degreesCoolingPerMB
Fluid_Temp_K = 液体的温度,可以通过运行 /ct liquids 命令找到。所有注册的液体及其属性都将写入 crafttweaker.log 文件。
-
B. 产生的热量(每刻):
每 µI 恒定的热量:0.000115。
toCool = energyPerTick * machineQuality * 0.000115
-
C. 最终持续时间 (t/mB):
ticksPerCoolant = Math.max((int)Math.round(cooling / toCool), 1)
计算示例(GUI 将显示的内容)
// 场景:您正在添加燃料和冷却剂。例如,让我们选取 IC2 模组的 Hot Coolant 和 Coolant:
// 燃料:"Hot Coolant"(温度 = 1200K),powerPerCycleRF = 100 µI/t,totalBurnTime = 20000。
// 冷却剂:"Coolant"(温度 = 300K),degreesCoolingPerMB = 1.0。
// 普通机器 (MQ=1.0) + 基础电容器 (CQ=1.0)
1. 能量 = 1000 \* 1.0 \* 1.0 = 1000.0 µI/t。
2. 燃料刻数 = 20000 / 1.0 / 1000 = 20。
3. 冷却剂刻数 = ((373.25 - 300K) \* 1.0) / (1000.0µI/t \* 1.0 \* 0.000115) = 73.25 / 0.115 = 637 t/mB。
// B 案例:增强型机器 (MQ=2.0) + 八极电容器 (CQ=1.5)
1. 能量 = 1000 \* 1.5 \* 2.0 = 3000 µI/t。
2. 燃料刻数 = 300 \* 2.0 \* 0.000115 = 13。
3. 冷却剂刻数 = ((373.25 - 300K) \* 1.0) / (1000.0µI/t \* 2.0 \* 0.000115) = 73.25 / 0.69 = 106 t/mB。
添加燃料
CombustionGen.addFuel(ILiquidStack fluid, int powerPerCycle, int totalBurnTime)
import mods.enderio.CombustionGen;
CombustionGen.addFuel(
<liquid:hooch>,
100,
20000
);
参数:
fluid (ILiquidStack) - 要燃烧的液体。
powerPerCycle (int) - 基础 µI/t(在基础电容器、普通机器状态下)。
totalBurnTime (int) - 1000 mB (1 Bucket) 燃烧的总刻数(在基础电容器状态下)。
添加冷却剂
CombustionGen.addCoolant(ILiquidStack fluid, int powerPerCycle, float degreesCoolingPerMB)
import mods.enderio.CombustionGen;
CombustionGen.addCoolant(<liquid:xpjuice>, 1.0);
参数:
fluid (ILiquidStack) - 要燃烧的液体。
degreesCoolingPerMB (int) - 乘数。
移除流体
CombustionGen.removeFuel(ILiquidStack fluid)
CombustionGen.removeCoolant(ILiquidStack fluid)
import mods.enderio.CombustionGen;
CombustionGen.removeFuel(<liquid:fire_water>);
CombustionGen.removeCoolant(<liquid:water>);
参数:
附魔台 (mods.enderio.Enchanter)
附魔台允许通过将特定输入物品与经验等级相结合来创建附魔书。它将实体物品和玩家经验转化为存储的附魔效果。
附魔台机制的基本理解:
- 青金石是隐式的:
你不需要在
input 中指定青金石。机器内部已硬编码,始终需要在副槽位中放入一个青金石。
附魔台的配方是按附魔效果定义的。制作书籍的成本是动态的,并随所选附魔效果的等级线性缩放。它基于原版默认的经验值附魔能力(enchantability)以及一些缩放因子。
(注意:variable 标记的变量是你自己的 ZenScript 脚本中设置的变量。
variable 标记的变量源自 EnderIO 的源代码).
-
物品消耗:
一个简单的计算:它会将每级所需的物品数量乘以目标等级。
itemsNeeded = targetLevel * amountPerLevel
示例:如果 amountPerLevel 为 2,则制作 V 级(5 级)的书籍需要 10 个物品。
(注意:请谨慎处理物品数量。如果超过所需物品的最大堆叠大小(例如大多数资源为 64),即使未达到该附魔效果可能达到的最高等级,较高等级的附魔也将无法制作。但这也可以作为一种有意的限制机制。)
-
经验值消耗:
取决于附魔效果的原始稀有度、costMultiplier,以及配置中的 levelCostFactor 和 baseLevelCost(以下是便于理解的伪代码):
min = Math.max(1, minEnchantability);
min = min * costMultiplier;
cost = (int)Math.round(min * levelCostFactor);
cost = cost + (int)baseLevelCost;
return cost;
(注 1:minEnchantability 可以通过 CraftTweaker 的 getMinEnchantability(int level) 函数获取。)
(注 2: costMultiplier 乘数为 1.0 时使用标准 EnderIO 算法。较高的值会使配方在经验等级上的消耗更高。
默认情况下 levelCostFactor = 0.75,且 baseLevelCost = 2.0).
计算示例
// 场景:用羊毛制作锋利 V 附魔书。
// 配方:输入=红色羊毛, AmountPerLevel=2, CostMultiplier=1.0。
1. 所需物品 = 5 \* 2 = 10 个羊毛。
2. XP 消耗:
min = 锋利 V 附魔 (45) \* 1.0 = 45.0
cost = 45.0 \* 0.75 = 34
cost = 34 + 2.0 = 36
添加配方
Enchanter.addRecipe(IEnchantmentDefinition enchantment, IIngredient input, int amountPerLevel, double costMultiplier)
import mods.enderio.Enchanter;
Enchanter.addRecipe(
<enchantment:minecraft:sharpness>,
<minecraft:wool:14>,
2,
1.0);
参数:
enchantment (IEnchantmentDefinition) - 附魔定义(例如 <enchantment:minecraft:sharpness>)。
input (IIngredient) - 用作催化剂的物品。
amountPerLevel (int) - 每级所需的物品数量。
costMultiplier (double) - XP 消耗计算的乘数。
移除配方
Enchanter.removeRecipe(IEnchantmentDefinition enchantment)
import mods.enderio.Enchanter;
// 移除保护附魔的配方
Enchanter.removeRecipe(<enchantment:minecraft:protection>);
参数:
SAG Mill (mods.enderio.SagMill)
粉碎物品以产生粉末和副产品。此机器受研磨球的影响很大。
(注:标记为 variable 的变量是你在 ZenScript 脚本中设置的变量。
标记为 variable 的变量源自 EnderIO 的源代码).
添加配方
1. 使用数组(标准方式)
SagMill.addRecipe(IItemStack[] outputs, float[] chances, IIngredient input, String bonusType, @Optional int energyCost, @Optional float[] xp);
import mods.enderio.SagMill;
```javascript
SagMill.addRecipe(
[<minecraft:flint>, <minecraft:gravel>],
[1.0, 0.2],
<minecraft:cobblestone>,
"CHANCE_ONLY",
2000,
[0.0, 0.1]
);
参数:
outputs (IItemStack[]) - 结果物品数组。
chances (float[]) - 概率数组(0.0 到 1.0)。必须与 outputs 的长度匹配。
input (IIngredient) - 要被粉碎的物品。
bonusType (String) - 见上方的“奖励类型行为”。
energyCost (int, 可选) - 所需的 µI。默认值:5000。
xp (float[], 可选) - 每个输出物品的经验值。默认值:0。
2. 使用加权堆栈
SagMill.addRecipe(WeightedItemStack[] outputs, IIngredient input, String bonusType, @Optional int energyCost, @Optional float[] xp);
import mods.enderio.SagMill;
SagMill.addRecipe(
[<minecraft:diamond> % 100, <minecraft:coal> % 50],
<minecraft:diamond_ore>,
"MULTIPLY_OUTPUT"
);
参数:
outputs (WeightedItemStack[]) - 物品 + 概率对(例如 <item> % 50 表示 50% 的概率)。
input, bonusType, energy, xp - 同上。
移除配方
SagMill.removeRecipe(IItemStack input);
import mods.enderio.SagMill;
SagMill.removeRecipe(<minecraft:cobblestone>);
参数:
input (IItemStack) - 要移除的研磨物品。
切片与拼接 (mods.enderio.SliceNSplice)
切片与拼接是一种将各种物品组合成高级组件(如僵尸电极或 Z-逻辑控制器)的机器。它独特地需要在工具槽中放入斧头和剪刀才能运行(你不需要显式指定它们)。
重要提示: 此机器是槽位严格的。数组中原料的顺序直接对应机器中的 6 个输入槽。如果你需要留空特定的槽位,必须在数组的相应位置使用 null。如果你想保持末尾的槽位为空,只需提供一个较短的数组即可(例如,一个包含 4 个物品的数组将填充前 4 个槽位,并留后 2 个槽位为空)。
添加配方
SliceNSplice.addRecipe(IItemStack output, IIngredient[] inputs, @Optional int energyCost, @Optional float xp)
import mods.enderio.SliceNSplice;
SliceNSplice.addRecipe(
<minecraft:diamond>,
[
<minecraft:stick>, null, <minecraft:stick>, // 槽位 0, 1, 2
null, <minecraft:iron_ingot>, null // 槽位 3, 4, 5
],
5000,
0.5
);
参数:
output (IItemStack) - 合成操作的结果。
inputs (IIngredient[]) - 最多 6 种原料的数组,按顺序代表机器的槽位。空槽请使用 null。
energyCost (int, 可选) - 所需的 µI(默认值:5000)。
xp (float, 可选) - 授予的经验值(默认值:0.0)。
移除配方
SliceNSplice.removeRecipe(IItemStack output)
import mods.enderio.SliceNSplice;
SliceNSplice.removeRecipe(
<enderio:item_material:41> // Z-逻辑控制器
);
参数:
灵魂绑定器 (mods.enderio.SoulBinder)
灵魂绑定器用于将被捕获生物的灵魂(来自已装满的灵魂瓶)绑定到一个基础物品上,从而创造出新的魔法或机械组件。它同时消耗 µI(能量)和玩家经验(等级)。
理解灵魂绑定器的基本机制:
-
灵魂瓶是隐式的:
你不需要在 input 中指定已装满的灵魂瓶。该机器硬编码为始终在其辅助槽位中需要一个灵魂瓶。
-
实体数组:
你不需要定义具体的瓶子物品,而是提供一个 Entity IDs(实体 ID)数组(例如 ["minecraft:zombie", "minecraft:skeleton"])。配方将接受装有此数组中任何一种实体的灵魂瓶。
-
空瓶输出:
机器在完成制作后会自动返还一个空的灵魂瓶。你不需要为此副产品编写脚本。
添加配方
SoulBinder.addRecipe(IItemStack output, IIngredient input, String[] entities, int xp, @Optional int energyCost)
import mods.enderio.SoulBinder;
// 示例:将僵尸或骷髅的灵魂绑定到钻石上以创造绿宝石。
// 消耗 5 点经验等级和 100,000 µI。
SoulBinder.addRecipe(
<minecraft:emerald>,
<minecraft:diamond>,
["minecraft:zombie", "minecraft:skeleton"],
5,
100000
);
参数:
output (IItemStack) - 绑定操作的结果。
input (IIngredient[]) - 灵魂将被绑定的基础物品。
entities (String[]) - 有效的实体资源定位符数组(例如 "minecraft:creeper")。
xp (int) - 经验等级成本。
energyCost (int, 可选) - 所需的 µI(默认值:5000)。
移除配方
SoulBinder.removeRecipe(IItemStack output)
import mods.enderio.SoulBinder;
SoulBinder.removeRecipe(
<enderio:item_material:17> // 诱人水晶
);
参数:
发酵罐 (mods.enderio.Vat)
发酵罐是一种流体酿造机器。它将基础输入流体与两种固体原料一起发酵,以生成新的输出流体(例如 水 + 糖 + 苹果 = 霍特酒)。
理解灵魂绑定器的基本机制:
-
输入槽:
注液池有两个独立的物品输入槽。配方必须为这两个槽定义原料。
-
槽乘数:
每个固体输入物品和液体输入都有特定的乘数。两种流体的最终量通过以下公式计算:
原料乘数 = slot1Mults * slot2Mults
输入流体体积 = 原料乘数 * 1000
输出流体体积 = 原料乘数 * inMult * 1000
// 场景:你正在添加一个从水中酿造熔岩的配方。使用的物品是煤炭 + 打火石和铁锹:
// 输入液体:"水";输入流体乘数 = 0.5。
// 左槽物品:"煤炭", "木炭";乘数:[2.0, 1.5];
// 右槽物品:"打火石和铁锹";乘数:[2.0].
// 煤炭 (2.0) + 打火石和铁锹 (2.0)
1. 原料乘数 = 2.0 \* 2.0 = 4.0
2. 输入流体体积 = 4.0 \* 1000 = 4000 mB。
3. 输出流体体积 = 4.0 \* 0.5 \* 1000 = 2000 mB。
// 木炭 (1.5) + 打火石和铁锹 (2.0)
1. 原料乘数 = 1.5 \* 2.0 = 3.0
2. 输入流体体积 = 3.0 \* 1000 = 3000 mB。
3. 输出流体体积 = 3.0 \* 0.5 \* 1000 = 1500 mB。
(注意:请小心使用乘数——如果输出的液体最终体积超过了储罐的最大容量,你将无法创建此配方。)
添加配方
Vat.addRecipe(ILiquidStack output, float inMult, ILiquidStack input, IIngredient[] slot1Solids, float[] slot1Mults, IIngredient[] slot2Solids, float[] slot2Mults, @Optional int energyCost)
import mods.enderio.Vat;
Vat.addRecipe(
<liquid:lava>,
0.5,
<liquid:water>,
[<minecraft:coal>, <minecraft:coal:1>], [2.0, 1.5],
[<minecraft:flint_and_steel>], [2.0],
40000
);
参数:
output (ILiquidStack) - 结果流体。
inMult (float) - 输入流体的乘数。
input (ILiquidStack) - 输入流体。
slot1Solids (IIngredient[]) - 第一个槽的物品。
slot1Mults (float[]) - 第一个槽物品的乘数。
slot2Solids (IIngredient[]) - 第二个槽的物品。
slot2Mults (float[]) - 第二个槽物品的乘数。
energyCost (int, optional) - 所需 µI(默认值:5000)。
移除配方
SoulBinder.removeRecipe(IItemStack output)
import mods.enderio.Vat;
// 移除输出 Hootch 的配方
Vat.removeRecipe(<liquid:hootch>);
参数:
储罐 (mods.enderio.Tank)
流体储罐不仅用于存储,还充当一个简单的加工机器。它可以消耗储罐中的流体来修改物品(给物品填充),或者从物品中提取流体以填充储罐(清空物品)。
对储罐机制的基本理解:
(注意:variable 标记的变量是你自己在 ZenScript 脚本中设置的变量。
variable 标记的变量源自 EnderIO 的源代码。)
添加配方
Tank.addRecipe(boolean fill, IIngredient input, ILiquidStack fluid, @Optional IItemStack output)
import mods.enderio.Tank;
// 示例 1(填充模式):从储罐中消耗 250mB 的熔岩,将海绵变成湿海绵。
Tank.addRecipe(true, <minecraft:sponge>, <liquid:lava> * 250, <minecraft:sponge:1>);
// 示例 2(排空模式,无输出):熔化钻石,向储罐中添加 100mB 的熔岩。钻石被完全消耗。
Tank.addRecipe(false, <minecraft:diamond>, <liquid:lava> * 100);
参数:
fill (boolean) - true 表示从储罐中消耗流体(填充模式),false 表示向储罐中生成流体(排空模式)。
input (IIngredient) - 插入到储罐槽中的物品。
fluid (ILiquidStack) - 所需的流体(如果 fill 为 true)或产生的流体(如果 fill 为 false)。
output (IItemStack, optional) - 过程完成后的结果物品。留空以消耗该物品。
移除配方
注意:配方的移除严格基于输入物品和罐子的模式,而非输出。如果你省略流体参数,将移除该输入物品在指定模式下的所有配方。
Tank.removeRecipe(boolean fill, IItemStack input, @Optional ILiquidStack fluid)
import mods.enderio.Tank;
// 示例 1:移除特定的 EnderIO 配方,即将湿海绵倒空以获取水。
Tank.removeRecipe(false, <minecraft:sponge:1>, <liquid:water>);
// 示例 2:移除与经验瓶关联的所有“倒空”配方(忽略其产生的流体类型)。
Tank.removeRecipe(false, <minecraft:experience_bottle>);
参数:
fill (boolean) - true 表示从罐子消耗流体(填充模式),false 表示向罐子生成流体(倒空模式)。
input (IIngredient) - 你想要移除的配方的输入物品。
fluid (ILiquidStack, 可选) - 用于匹配的具体流体。如果省略,则移除给定输入物品的所有配方。
转储
你可以使用 /fet dump 命令转储机器中注册的所有配方。你可以将想要转储配方的机器名称作为参数指定。
参数:[all|alloy|combustion|enchanter|sagmill|slice|soul|tank|vat]
所有配方将被写入 latest.log 文件。
? 贡献
欢迎贡献!如果你发现了 bug,或者想要改进现有功能,请随时提交 issue 或 pull request。
设置开发环境:
- 克隆仓库
- 确保
JAVA_HOME 指向 JDK 25 或更高版本(JDK 8 会通过 Gradle 工具链自动用于编译)
- 运行
./gradlew runClient —— Gradle 将在首次启动时下载所有必需的依赖项
FET - Forked Ender Tweaker
FET is a fork of the original EnderTweaker by Shadows_of_Fire
An interface between EnderIO and CraftTweaker.
It supports adding and removing recipes for EnderIO machines using ZenScript, enabling hot-reloading (via ZenRecipeReload) for modpack customization.
✨ Key Improvements in this Fork
-
The latest version of EnderIO is supported:
All supported mechanisms work and have been tested with the latest version of 1.12.2 EnderIO (v.5.3.72).
Some mechanisms may also work with older versions of EnderIO (5.3.67 - 5.3.71), but the correct operation is not guaranteed.
-
Hot-Reloading: Added the ability to use /ct reload and /jeiReload for hot-reloading your ZenScripts to apply changes without relaunching the game entirely.
(Note: Requires ZenRecipeReload).
-
Improved Logging: Clearer error messages in crafttweaker.log and the in-game chat to help you debug your scripts.
Supported Machines:
Alloy Smelter •
Combustion Generator •
Enchanter •
SAG Mill •
Slice'n'Splice •
Soul Binder •
The Vat •
Tank
? Documentation
Reloading Feature
Hot-Reloading
To enable script reloading, you must include the #reloadable preprocessor at the very first line of your ZenScript file.
#reloadable
// ...Your imports here...
// ...Your script here...
Once you have made any changes to your script (added or removed recipes), run the /ct reload command to reload your scripts and the /jeiReload command to refresh JEI recipes.
You can find more useful info about reloading in general on the ZenUtils wiki.
Alloy Smelter (mods.enderio.AlloySmelter)
The Alloy Smelter is a complex mechanism implementing its own melting system that can smelt up to three items at once and combine them into alloys.
Add Recipe
AlloySmelter.addRecipe(IItemStack output, IItemStack[] inputs, @Optional int energyCost, @Optional xp)
AlloySmelter.addRecipe(
<minecraft:diamond>,
[<minecraft:dirt>, <minecraft:sand>],
2000,
0.5
);
Parameters:
output (IItemStack) - The result of the crafting operation.
inputs (IIngredient[]) - The items required to smelt the alloy.
energyCost (int, optional) - µI required (Default: 5000).
xp (float, optional) - Experience granted (Default: 0.0).
Remove Recipe
(Note: You cannot remove standard smelting recipes (e.g., Flour > Bread) using FET's AlloySmelter class, because those use the vanilla Minecraft Furnace smelting system. For such recipes, use CraftTweaker's Furnace Handler).
Performance Tip: Because the Alloy Smelter lacks native recipe removal tools, FET rebuilds the entire recipe list during removal. This is an "expensive" operation. If you need to remove multiple recipes, better to use the multiple removal formats instead to do it in one pass.
1. Remove by Output
AlloySmelter.removeRecipe(...IItemStack output)
// Remove a single recipe
AlloySmelter.removeRecipe(<enderio:item_alloy_ingot:0>); // Electrical Steel
// Remove multiple recipes (VarArgs format)
AlloySmelter.removeRecipe(
<enderio:item_alloy_ingot:0>, // Electrical Steel
<enderio:item_alloy_ingot:1>, // Energetic Alloy
<enderio:item_alloy_ingot:2> // Vibrant Alloy
);
// Remove multiple recipes (Array format)
AlloySmelter.removeRecipe([
<enderio:item_alloy_ingot:0>, // Electrical Steel
<enderio:item_alloy_ingot:1> // Energetic Alloy
]);
Parameters:
output (IItemStack or array/varargs) - The result of the recipe(s) you want to remove.
2. Remove by Inputs
(Note: The removeByInputs method requires an array/2d array and does not support VarArgs).
AlloySmelter.removeByInputs(IItemStack[] inputs)
AlloySmelter.removeByInputs(IItemStack[][] inputs)
// Remove recipe that use these exact inputs
AlloySmelter.removeByInputs(
[<minecraft:iron_ingot>,
<enderio:item_material:23>,
<enderio:item_material:5>]
); //Electrical Steel Ingot
// Remove multiple recipe configurations at once (Array of Arrays)
AlloySmelter.removeByInputs([
[<minecraft:soul_sand>, <minecraft:gold_ingot>], //Soularium Ingot
[<minecraft:iron_ingot>, <minecraft:redstone>] //Conductive Ingot
]);
Parameters:
inputs (IIngredient[] or IIngredient[][]) - The input items of the recipe(s) you want to remove.
Combustion Generator (mods.enderio.CombustionGen)
Generates µI (Micro Infinity Energy) by burning liquid fuel and using a liquid coolant for cooling.
(Note: This machine acts as a mix-and-match system. Once you register a Fuel, it can be used with ANY registered Coolant and vice versa.
The GUI displays values in t/mB (Ticks per Millibucket). This represents Duration).
The logic is based on Heat Balance. Burning fuel generates Heat. The Coolant absorbs that Heat.
Basic understanding of Combustion Generator Mechanics:
(Note: Variables marked as variable are variables you set in your ZenScript script.
Variables marked as variable are derived from EnderIO's source code).
1. Capacitor & Machine Modifiers
Machine and capacitor tier multipliers can be configured however you want via EnderIO XML recipe configs. All of them have a base value and a scaler type (which declares what the math will do with the base value). For the Combustion Generator, we generally have the following final multipliers:
-
Capacitor Quality Multiplier (capQuality):
The basic config declares for Normal and Enhanced Combustion Gens:
<capacitor key="enderio:block_combustion_generator/gen" base="1" scaler="CHEMICAL" />
<capacitor key="enderio:block_enhanced_combustion_generator/gen" base="1" scaler="CHEMICAL" />
Formula: 1.0 + (CapacitorLevel - 1) * 0.25
- Basic Capacitor (Lvl 1): 1.00
- Double-Layer Capacitor (Lvl 2): 1.25
- Octadic Capacitor (Lvl 3): 1.50
(Note: For custom capacitors or those from add-ons, you need to use the same scaler and their respective level values).
-
Machine Quality (machineQuality):
Basic config declares:
<capacitor key="enderio:block_combustion_generator/gen" base="1" scaler="CHEMICAL" />
<capacitor key="enderio:block_enhanced_combustion_generator/gen" base="200" scaler="CHEMICAL" />
- Combustion Generator: 1.00
- Enhanced Combustion Generator:
200 * 0.01 = 2.0
2. Energy Generation (µI/t)
Formula: energyPerTick = Math.round(powerPerCycle * capQuality * machineQuality)
3. Fuel Duration (t/mB)
Determines how many ticks 1 mB of fuel lasts. Higher capacitor tiers burn fuel faster to maintain higher power output.
totalBurnTime = Total ticks per 1000 mB (set in script).
- Formula:
ticksPerFuel = Math.max((int)(totalBurnTime / capQuality / 1000.0F), 1)
4. Coolant Duration (t/mB)
The machine produces heat based on energy generation.
-
A. Cooling Capacity (per mB):
How much heat 1 mB of fluid can remove.
cooling = (373.25 - Fluid_Temp_K) * degreesCoolingPerMB
Fluid_Temp_K = the liquid's temperature, which can be found by running the /ct liquidscommand. All registered liquids and their properties will be written to the crafttweaker.log file.
-
B. Heat Generated (per Tick):
Heat per µI Constant: 0.000115.
toCool = energyPerTick * machineQuality * 0.000115
-
C. Final Duration (t/mB):
ticksPerCoolant = Math.max((int)Math.round(cooling / toCool), 1)
Example Calculation (What GUI will show)
// Scenario: You're adding fuel and coolant. For example lets took Hot Coolant and Coolant from IC2 mod:
// Fuel: "Hot Coolant" (Temperature = 1200K), powerPerCycleRF = 100 µI/t, totalBurnTime = 20000.
// Coolant: "Coolant" (Temperature = 300K), degreesCoolingPerMB = 1.0.
//Normal Machine (MQ=1.0) + Basic Capacitor (CQ=1.0)
1. Energy = 1000 \* 1.0 \* 1.0 = 1000.0 µI/t.
2. Ticks per Fuel = 20000 / 1.0 / 1000 = 20.
3. Ticks per Coolant = ((373.25 - 300K) \* 1.0) / (1000.0µI/t \* 1.0 \* 0.000115) = 73.25 / 0.115 = 637 t/mB.
// Case B: Enhanced Machine (MQ=2.0) + Octadic Capacitor (CQ=1.5)
1. Energy = 1000 \* 1.5 \* 2.0 = 3000 µI/t.
2. Ticks per Fuel = 300 \* 2.0 \* 0.000115 = 13.
3. Ticks per Coolant = ((373.25 - 300K) \* 1.0) / (1000.0µI/t \* 2.0 \* 0.000115) = 73.25 / 0.69 = 106 t/mB.
Add Fuel
CombustionGen.addFuel(ILiquidStack fluid, int powerPerCycle, int totalBurnTime)
import mods.enderio.CombustionGen;
CombustionGen.addFuel(
<liquid:hooch>,
100,
20000
);
Parameters:
fluid (ILiquidStack) - The liquid to burn.
powerPerCycle (int) - Base µI/t (at Basic Capacitor, Normal Machine).
totalBurnTime (int) - Total ticks that 1000 mB (1 Bucket) will burn (at Basic Capacitor).
Add Coolant
CombustionGen.addCoolant(ILiquidStack fluid, int powerPerCycle, float degreesCoolingPerMB)
import mods.enderio.CombustionGen;
CombustionGen.addCoolant(<liquid:xpjuice>, 1.0);
Parameters:
fluid (ILiquidStack) - The liquid to burn.
degreesCoolingPerMB (int) - Multiplier.
Remove Fluids
CombustionGen.removeFuel(ILiquidStack fluid)
CombustionGen.removeCoolant(ILiquidStack fluid)
import mods.enderio.CombustionGen;
CombustionGen.removeFuel(<liquid:fire_water>);
CombustionGen.removeCoolant(<liquid:water>);
Parameters:
Enchanter (mods.enderio.Enchanter)
The Enchanter allows creating Enchanted Books by combining a specific input item with XP levels. It converts physical items and player experience into stored enchantments.
Basic understanding of Enchanter Mechanics:
- The Lapis is Implicit:
You do not need to specify a Lapis as part of your
input. The machine is hardcoded to always require one in its secondary slot.
Recipes in the Enchanter are defined per Enchantment. The cost of creating a book is dynamic and scales linearly with the Level of the enchantment you select. It is based on the default vanilla XP enchantability and a few scalers.
(Note: Variables marked as variable are variables you set in your ZenScript script.
Variables marked as variable are derived from EnderIO's source code).
-
Item Cost:
A simple calculation: it multiplies the required amount of items per level by the target level.
itemsNeeded = targetLevel * amountPerLevel
Example: If amountPerLevel is 2, crafting a Level V (5) book requires 10 items.
(Note: Be careful with the amount of items. If it exceeds the maximum stack size of the required item (e.g., 64 for most resources), higher levels of the enchantment will become uncraftable, even if the maximum possible level for this enchantment is not reached. However, this can also be used as a deliberate limitation.)
-
XP Cost:
Depends on the enchantment's native rarity, the costMultiplier, and the config's levelCostFactor and baseLevelCost (Below is pseudocode for easier understanding):
min = Math.max(1, minEnchantability);
min = min * costMultiplier;
cost = (int)Math.round(min * levelCostFactor);
cost = cost + (int)baseLevelCost;
return cost;
(Note 1: minEnchantability can be found by procceding CraftTweaker's getMinEnchantability(int level) function).
(Note 2: A costMultiplier multiplier of 1.0 uses standard EnderIO math. Higher values make the recipe more expensive in levels.
By default levelCostFactor= 0.75 and baseLevelCost = 2.0).
Example Calculation
// Scenario: Making Sharpness V book from Wool.
// Recipe: Input=Red Wool, AmountPerLevel=2, CostMultiplier=1.0.
1. Items Needed = 5 \* 2 = 10 Wool.
2. XP Cost:
min = Sharpness V Ench. (45) \* 1.0 = 45.0
cost = 45.0 \* 0.75 = 34
cost = 34 + 2.0 = 36
Add Recipe
Enchanter.addRecipe(IEnchantmentDefinition enchantment, IIngredient input, int amountPerLevel, double costMultiplier)
import mods.enderio.Enchanter;
Enchanter.addRecipe(
<enchantment:minecraft:sharpness>,
<minecraft:wool:14>,
2,
1.0);
Parameters:
enchantment (IEnchantmentDefinition) - The enchantment definition (e.g. <enchantment:minecraft:sharpness>).
input (IIngredient) - The item used as a catalyst.
amountPerLevel (int) - How many items are required for Level 1.
costMultiplier (double) - Multiplier for the XP cost calculation.
Remove Recipe
Enchanter.removeRecipe(IEnchantmentDefinition enchantment)
import mods.enderio.Enchanter;
// Remove the recipe for Protection
Enchanter.removeRecipe(<enchantment:minecraft:protection>);
Parameters:
SAG Mill (mods.enderio.SagMill)
Crushes items to produce dusts and byproducts. This machine is heavily affected by Grinding Balls.
(Note: Variables marked as variable are variables you set in your ZenScript script.
Variables marked as variable are derived from EnderIO's source code).
Add Recipe
1. Using Arrays (Standard)
SagMill.addRecipe(IItemStack[] outputs, float[] chances, IIngredient input, String bonusType, @Optional int energyCost, @Optional float[] xp);
import mods.enderio.SagMill;
SagMill.addRecipe(
[<minecraft:flint>, <minecraft:gravel>],
[1.0, 0.2],
<minecraft:cobblestone>,
"CHANCE_ONLY",
2000,
[0.0, 0.1]
);
Parameters:
outputs (IItemStack[]) - Array of result items.
chances (float[]) - Array of probabilities (0.0 to 1.0). Must match outputs length.
input (IIngredient) - The item to be crushed.
bonusType (String) - See "Bonus Type Behavior" above.
energyCost (int, optional) - µI required. Default: 5000.
xp (float[], optional) - XP per item output. Default: 0.
2. Using WeightedStacks
SagMill.addRecipe(WeightedItemStack[] outputs, IIngredient input, String bonusType, @Optional int energyCost, @Optional float[] xp);
import mods.enderio.SagMill;
SagMill.addRecipe(
[<minecraft:diamond> % 100, <minecraft:coal> % 50],
<minecraft:diamond_ore>,
"MULTIPLY_OUTPUT"
);
Parameters:
outputs (WeightedItemStack[]) - Item + Chance pairs (e.g. <item> % 50 for 50%).
input, bonusType, energy, xp - Same as above.
Remove Recipe
SagMill.removeRecipe(IItemStack input);
import mods.enderio.SagMill;
SagMill.removeRecipe(<minecraft:cobblestone>);
Parameters:
input (IItemStack - The grinding item to remove.
Slice'n'Splice (mods.enderio.SliceNSplice)
The Slice'n'Splice is a machine that combines various items into advanced components like Zombie Electrodes or Z-Logic Controllers. It uniquely requires an Axe and Shears in its tool slots to operate (you don't need to specify them).
Important Note: This machine is slot-strict. The order of the ingredients in your array directly corresponds to the 6 input slots in the machine. If you need to leave a specific slot empty, you must use null in that position of the array. If you want to remain empty trailing slots, you can simply provide a shorter array (e.g., an array of 4 items will fill the first 4 slots and leave the last 2 empty).
Add Recipe
SliceNSplice.addRecipe(IItemStack output, IIngredient[] inputs, @Optional int energyCost, @Optional float xp)
import mods.enderio.SliceNSplice;
SliceNSplice.addRecipe(
<minecraft:diamond>,
[
<minecraft:stick>, null, <minecraft:stick>, // Slots 0, 1, 2
null, <minecraft:iron_ingot>, null // Slots 3, 4, 5
],
5000,
0.5
);
Parameters:
output (IItemStack) - The result of the crafting operation.
inputs (IIngredient[]) - An array of up to 6 ingredients representing the machine's slots in order. Use null for empty slots.
energyCost (int, optional) - µI required (Default: 5000).
xp (float, optional) - Experience granted (Default: 0.0).
Remove Recipe
SliceNSplice.removeRecipe(IItemStack output)
import mods.enderio.SliceNSplice;
SliceNSplice.removeRecipe(
<enderio:item_material:41> // Z-Logic Controller
);
Parameters:
output (IItemStack) - The result of the recipe you want to remove.
Soul Binder (mods.enderio.SoulBinder)
The Soul Binder is used to bind the soul of a captured mob (from a filled Soul Vial) to a base item, creating a new magical or mechanical component. It consumes both µI (Energy) and player Experience (Levels).
Basic understanding of Soul Binder Mechanics:
-
The Soul Vial is Implicit:
You do not need to specify a filled Soul Vial as part of your input. The machine is hardcoded to always require one in its secondary slot.
-
Entity Array:
Instead of defining the exact vial item, you provide an array of Entity IDs (e.g., ["minecraft:zombie", "minecraft:skeleton"]). The recipe will accept a Soul Vial filled with ANY of the entities listed in this array.
-
Empty Vial Output:
The machine automatically returns an empty Soul Vial upon completing the craft. You do not need to script this byproduct.
Add Recipe
SoulBinder.addRecipe(IItemStack output, IIngredient input, String[] entities, int xp, @Optional int energyCost)
import mods.enderio.SoulBinder;
// Example: Binds either a Zombie or Skeleton soul to a Diamond to create an Emerald.
// Costs 5 XP levels and 100,000 µI.
SoulBinder.addRecipe(
<minecraft:emerald>,
<minecraft:diamond>,
["minecraft:zombie", "minecraft:skeleton"],
5,
100000
);
Parameters:
output (IItemStack) - The result of the binding operation.
input (IIngredient[]) - The base item that the soul will be bound to.
entities (String[]) - An array of valid entity Resource Locations (e.g., "minecraft:creeper").
xp (int) - The cost in experience levels.
energyCost (int, optional) - µI required (Default: 5000).
Remove Recipe
SoulBinder.removeRecipe(IItemStack output)
import mods.enderio.SoulBinder;
SoulBinder.removeRecipe(
<enderio:item_material:17> // Enticing Crystal
);
Parameters:
output (IItemStack) - The result of the recipe you want to remove.
The Vat (mods.enderio.Vat)
The Vat is a fluid brewing machine. It ferments a base input fluid along with two solid ingredients to create a new output fluid (e.g., Water + Sugar + Apple = Hootch).
Basic understanding of Soul Binder Mechanics:
-
Input Slots:
The Vat has two distinct item input slots. A recipe must define an ingredient for both slots.
-
Slot Multipliers:
Each solid input item and input liquid has a specific multiplier. The final amount of both fluids is calculated by the following formulas:
Ingredient Multiplier = slot1Mults * slot2Mults
Input Fluid Volume = Ingredient Multiplier * 1000
Output Fluid Volume = Ingredient Multiplier * inMult * 1000
// Scenario: You're adding a recipe for brewing lava from water. As items you're using Coal + Flint and Steel:
// Input liquid: "Water"; Input Fluid Multiplier = 0.5.
// Left slot items: "Coal", "Charcoal"; Multipliers: [2.0, 1.5];
// Right slot items: "Flint and Steel"; Multipliers: [2.0].
// Coal (2.0) + Flint and Steel (2.0)
1. Ingredient Multiplier = 2.0 \* 2.0 = 4.0
2. Input Fluid Volume = 4.0 \* 1000 = 4000 mB.
3. Output Fluid Volume = 4.0 \* 0.5 \* 1000 = 2000 mB.
// Charcoal (1.5) + Flint and Steel (2.0)
1. Ingredient Multiplier = 1.5 \* 2.0 = 3.0
2. Input Fluid Volume = 3.0 \* 1000 = 3000 mB.
3. Output Fluid Volume = 3.0 \* 0.5 \* 1000 = 1500 mB.
(Note: Be careful with multipliers - if the final volume of output liquid exceeds the max capacity of the tank, you will not be able to create this recipe.).
Add Recipe
Vat.addRecipe(ILiquidStack output, float inMult, ILiquidStack input, IIngredient[] slot1Solids, float[] slot1Mults, IIngredient[] slot2Solids, float[] slot2Mults, @Optional int energyCost)
import mods.enderio.Vat;
Vat.addRecipe(
<liquid:lava>,
0.5,
<liquid:water>,
[<minecraft:coal>, <minecraft:coal:1>], [2.0, 1.5],
[<minecraft:flint_and_steel>], [2.0],
40000
);
Parameters:
output (ILiquidStack) - The resulting fluid.
inMult (float) - The multiplier for input fluid.
input (ILiquidStack) - The input fluid.
slot1Solids (IIngredient[]) - The items for the first slot.
slot1Mults (float[]) - Multipliers for first slot items.
slot2Solids (IIngredient[]) - The items for the second slot.
slot2Mults (float[]) - Multipliers for second slot items.
energyCost (int, optional) - µI required (Default: 5000).
Remove Recipe
SoulBinder.removeRecipe(IItemStack output)
import mods.enderio.Vat;
// Remove the recipe that outputs Hootch
Vat.removeRecipe(<liquid:hootch>);
Parameters:
output (ILiquidStack) - The result of the recipe you want to remove.
The Tank (mods.enderio.Tank)
The Fluid Tank is not only for storage but also functions as a simple processing machine. It can either consume fluids from the tank to modify an item (Filling the item) or extract fluids from an item to fill the tank (Emptying the item).
Basic understanding of Tank Mechanics:
(Note: Variables marked as variable are variables you set in your ZenScript script.
Variables marked as variable are derived from EnderIO's source code).
-
The fill boolean:
This parameter dictates the direction of the fluid transfer:
true (Filling Mode): The fluid is consumed from the tank's internal storage to process or fill the input item.
false (Emptying Mode): The fluid is extracted from the input item and added to the tank's internal storage.
-
Optional Output (Item Consumption):
The output item parameter is optional. If you do not provide an output (or pass null), the input item will be completely consumed/destroyed during the process.
-
Native Forge Containers Restriction:
You cannot add or remove recipes that use native Forge fluid containers (such as Vanilla Buckets, IC2 Capsules, or Portable Tanks). The EnderIO Tank handles these items automatically via hardcoded Forge mechanics.
Add Recipe
Tank.addRecipe(boolean fill, IIngredient input, ILiquidStack fluid, @Optional IItemStack output)
import mods.enderio.Tank;
// Example 1 (Filling Mode): Consumes 250mB of Lava from the tank to turn a Sponge into a Wet Sponge.
Tank.addRecipe(true, <minecraft:sponge>, <liquid:lava> * 250, <minecraft:sponge:1>);
// Example 2 (Emptying Mode, No Output): Melts a Diamond to add 100mB of Lava to the tank. The Diamond is completely consumed.
Tank.addRecipe(false, <minecraft:diamond>, <liquid:lava> * 100);
Parameters:
fill (boolean) - true to consume fluid from the tank (Filling Mode), false to generate fluid into the tank (Emptying Mode).
input (IIngredient) - The item inserted into the tank's slot.
fluid (ILiquidStack) - The fluid required (if fill is true) or produced (if fill is false).
output (IItemStack, optional) - The resulting item after the process. Leave empty to consume the item.
Remove Recipe
Note: Recipe removal is based strictly on the input item and the tank's mode, not the output. If you omit the fluid parameter, all recipes for that input item in the specified mode will be removed.
Tank.removeRecipe(boolean fill, IItemStack input, @Optional ILiquidStack fluid)
import mods.enderio.Tank;
// Example 1: Remove the specific EnderIO recipe that empties a Wet Sponge to get Water.
Tank.removeRecipe(false, <minecraft:sponge:1>, <liquid:water>);
// Example 2: Remove ALL Emptying recipes associated with the Experience Bottle (ignoring which fluid it produces).
Tank.removeRecipe(false, <minecraft:experience_bottle>);
Parameters:
fill (boolean) - true to consume fluid from the tank (Filling Mode), false to generate fluid into the tank (Emptying Mode).
input (IIngredient) - the input item of the recipe you want to remove.
fluid (ILiquidStack, optional) - The specific fluid to match. If omitted, removes all recipes for the given input.
Dumping
You can dump all registered recipes from machines using /fet dump command. You can specify the machine from which you want to dump the recipes as a parameter.
Parameters: [all|alloy|combustion|enchanter|sagmill|slice|soul|tank|vat]
All recipes will be written to the latest.log file.
? Contributing
Contributions are welcome! If you've found a bug, or want to improve existing functionality, feel free to open an issue or a pull request.
To set up the dev environment:
- Clone the repo
- Make sure
JAVA_HOME points to JDK 25 or newer (JDK 8 is used for compilation automatically via Gradle toolchains)
- Run
./gradlew runClient — Gradle will download all required dependencies on first launch
评论 0
登录后参与评分
还没有评论,来抢沙发吧