
ForkedEnderTweaker
CraftTweaker + EnderIO 接口
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和游戏内聊天中提供更清晰的错误消息,帮助你调试脚本。
支持的机器:
合金炉 •
燃烧发电机 •
附魔器 •
SAG 磨粉机 •
切片与拼接机 •
灵魂绑定器 •
发酵桶 •
储罐
📖 文档
重载功能
热重载
要启用脚本重载,你必须在 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 类移除标准熔炼配方(例如 Flour > Bread),因为这些配方使用原版 Minecraft 熔炉熔炼系统。对于此类配方,请使用 CraftTweaker 的熔炉处理器)。
性能提示: 由于合金炉缺少原生的配方移除工具,FET 在移除时会重建整个配方列表。这是一个“昂贵”的操作。如果你需要移除多个配方,最好使用多配方移除格式以一次性完成。
1. 按输出移除
AlloySmelter.removeRecipe(...IItemStack output)
// 移除单个配方
AlloySmelter.removeRecipe(<enderio:item_alloy_ingot:0>); // 电工钢
// 移除多个配方(可变参数格式)
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> // 能量合金
]);
参数:
output(IItemStack 或数组/可变参数) - 你想要移除的配方的结果。
2. 按输入移除
(注意:removeByInputs 方法需要数组/二维数组,不支持可变参数)。
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>] //导电锭
]);
参数:
inputs(IIngredient[] 或 IIngredient[][]) - 你想要移除的配方的输入物品。
燃烧发电机 (mods.enderio.CombustionGen)
通过燃烧液体燃料并使用液体冷却剂进行冷却来产生 µI(微无限能量)。 (注意:该机器充当混合搭配系统。一旦你注册了燃料,它就可以与任何已注册的冷却剂一起使用,反之亦然。
GUI 以 t/mB(每毫桶刻数)显示数值。这代表持续时间)。
其逻辑基于热量平衡。燃烧燃料产生热量。冷却剂吸收该热量。
燃烧发电机机制的基本理解:
(注意:标记为 variable 的变量是你 ZenScript 脚本中设置的变量。
标记为 variable 的变量来源于 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- 基础电容(1 级):1.00
- 双层电容(2 级):1.25
- 八重电容(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) *degreesCoolingPerMBFluid_Temp_K= 液体的温度,可以通过运行/ct liquids命令找到。所有已注册的液体及其属性将被写入crafttweaker.log文件。B. 产生热量(每刻):
每 µI 的热量常数:0.000115。
toCool=energyPerTick*machineQuality* 0.000115C. 最终持续时间(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 桶)将燃烧的总刻数(在基础电容下)。
添加冷却剂
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>);
参数:
fluid(ILiquidStack) - 要移除的液体。
附魔器 (mods.enderio.Enchanter)
附魔器允许通过将特定输入物品与经验等级结合来制作附魔书。它将实体物品和玩家经验转化为存储的附魔。
附魔器机制的基本理解:
- 青金石是隐含的:
你不需要在
input中指定青金石。该机器硬编码为始终需要在其副槽中放置一个青金石。
附魔器中的配方按附魔定义。制作一本书的成本是动态的,并随你选择的附魔等级线性增长。它基于原版经验可附魔性和几个缩放系数。
(注意:标记为 variable 的变量是你 ZenScript 脚本中设置的变量。
标记为 variable 的变量来源于 EnderIO 的源代码)。
物品成本:
一个简单的计算:它将每级所需物品数量乘以目标等级。
示例:如果itemsNeeded=targetLevel*amountPerLevelamountPerLevel为 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 附魔书。
// 配方:Input=红色羊毛,AmountPerLevel=2,CostMultiplier=1.0。
1. 所需物品 = 5 \* 2 = 10 羊毛。
2. 经验成本:
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) - 1 级所需的物品数量。costMultiplier(double) - 经验成本计算的修正系数。
移除配方
Enchanter.removeRecipe(IEnchantmentDefinition enchantment)
import mods.enderio.Enchanter;
// 移除保护附魔的配方
Enchanter.removeRecipe(<enchantment:minecraft:protection>);
参数:
enchantment(IEnchantmentDefinition) - 要从机器中移除的附魔。
SAG 磨粉机 (mods.enderio.SagMill)
将物品粉碎以产生粉尘和副产物。该机器受研磨球影响很大。
(注意:标记为 variable 的变量是你 ZenScript 脚本中设置的变量。
标记为 variable 的变量来源于 EnderIO 的源代码)。
加成类型行为:
研磨球如何影响这个特定配方(由
bonusType定义):NONE- 研磨球没有效果。MULTIPLY_OUTPUT- 研磨球倍增主输出的数量。CHANCE_ONLY- 研磨球仅提升次要/三级输出的概率。
添加配方
1. 使用数组(标准)
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]
);
参数:
outputs(IItemStack[]) - 结果物品数组。chances(float[]) - 概率数组(0.0 到 1.0)。必须与outputs长度匹配。input(IIngredient) - 要粉碎的物品。bonusType(String) - 参见上文的"加成类型行为"。energyCost(int, 可选) - 所需的 µI。默认值:5000。xp(float[], 可选) - 每个物品输出的经验值。默认值:0。
2. 使用 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"
);
参数:
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-逻辑控制器
);
参数:
output(IItemStack) - 你想要移除的配方的结果。
灵魂绑定器 (mods.enderio.SoulBinder)
灵魂绑定器用于将捕获的生物灵魂(来自已填充的灵魂瓶)绑定到基础物品上,创建新的魔法或机械组件。它同时消耗 µI(能量)和玩家经验(等级)。
灵魂绑定器机制的基本理解:
灵魂瓶是隐含的: 你不需要在
input中指定已填充的灵魂瓶。该机器硬编码为始终需要在其副槽中放置一个。实体数组: 你不需要定义确切的瓶子物品,而是提供一个
实体 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> // 诱人水晶
);
参数:
output(IItemStack) - 你想要移除的配方的结果。
发酵桶 (mods.enderio.Vat)
发酵桶是一种液体酿造机器。它将基础输入液体与两种固体配料一起发酵,以产生新的输出液体(例如 Water + Sugar + Apple = Hootch)。
发酵桶机制的基本理解:
输入槽: 发酵桶有两个不同的物品输入槽。配方必须为两个槽都定义一种配料。
槽位修正系数: 每种固体输入物品和输入液体都有特定的修正系数。两种液体的最终数量由以下公式计算:
配料修正系数=slot1Mults*slot2Mults输入液体量=配料修正系数* 1000输出液体量=配料修正系数*inMult* 1000
// 场景:你正在添加一个从水酿造岩浆的配方。作为物品,你使用煤炭 + 打火石:
// 输入液体:"Water";输入液体修正系数 = 0.5。
// 左槽物品:"Coal"、"Charcoal";修正系数:[2.0, 1.5];
// 右槽物品:"Flint and Steel";修正系数:[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, 可选) - 所需的 µI(默认值:5000)。
移除配方
SoulBinder.removeRecipe(IItemStack output)
import mods.enderio.Vat;
// 移除输出 Hootch 的配方
Vat.removeRecipe(<liquid:hootch>);
参数:
output(ILiquidStack) - 你想要移除的配方的结果。
储罐 (mods.enderio.Tank)
流体储罐不仅用于存储,还作为简单的加工机器使用。它既可以消耗储罐中的流体来修饰物品(填充物品),也可以从物品中提取流体来填充储罐(排空物品)。
储罐机制的基本理解:
(注意:标记为 variable 的变量是你 ZenScript 脚本中设置的变量。
标记为 variable 的变量来源于 EnderIO 的源代码)。
fill布尔值: 该参数决定流体传输的方向:true**(填充模式
正在加载版本记录…
正在加载评论…
评论在新手盒子客户端中发表,这里同步展示。