从 7.4.1 更新到 7.5.0
Note
由于这些变化,使用 GregTech Post Modern 7.5.0+ 时,不能再让你的 mod 或整合包依赖以 7.4.1 编译且接触任何机器相关内容的 addons 或 coremods 来编译。 请确认你的依赖已经更新。
Machine Builder 泛型
我们为 (Multiblock)MachineBuilder 添加了第二个泛型参数。这意味着过去存储未完成 MachineBuilder<?> 的地方,现在需要存储 MachineBuilder<?, ?>。MultiblockMachineBuilder<?, ?> 也同理。
机器与覆盖板复制/粘贴系统
新增了使用 Machine Memory Card 复制机器的系统。如果你想为自己的机器和覆盖板添加额外复制/粘贴行为,请参见此页面。
多方块结构变更
Large Fractionating Still 不再需要 muffler hatch,因此可以在 cleanrooms 中使用。
RecipeCondition 泛型
我们为 RecipeCondition 添加了一个用于描述条件的泛型参数。
这意味着你的自定义 recipe conditions 现在需要继承 RecipeCondition<MyCondition>(过去只需要继承 RecipeCondition)。
例如,如果你有这样的自定义 recipe condition 类:public class ExampleCondition extends RecipeCondition,现在应改为 public class ExampleCondition extends RecipeCondition<ExampleCondition>。
你还需要调整 getType() 和 createTemplate() 的泛型以匹配这一变化,例如:
- public RecipeConditionType<?> getType() {
+ public RecipeConditionType<ExampleCondition> getType() {
- public RecipeCondition createTemplate() {
+ public ExampleCondition createTemplate() {
研钵配方修复
过去,为工具添加 GTToolType.MORTAR 不会自动生成配方。此问题已修复。如果你过去因此手动生成过配方,现在需要移除手动配方。
管道渲染变更
这只与拥有自定义管道类型的附属 mod 相关。 拥有自定义管道实现的 addons 需要稍微调整代码,才能配合新的渲染代码工作(见下方示例)。
-public final PipeModel model = new PipeModel(pipeType.getThickness(), () -> [side texture], () -> [end texture], null, null);
-@Getter
-private final PipeBlockRenderer renderer = new PipeBlockRenderer(model);
...
@Override
-public PipeModel getPipeModel() {
- return model;
+public PipeModel createPipeModel(GTBlockstateProvider provider) {
+ return new PipeModel(this, pipeType.getThickness(), [side texture], [end texture], provider);
}
PipeModel#dynamicModel(),
以便在运行时生成模型。
如果这样做,还必须为 RegisterDynamicResourcesEvent 添加一个 Mod bus 事件监听器,例如:
@SubscribeEvent
public static void registerDynamicResources(RegisterDynamicResourcesEvent event) {
for (var block : MyBlocks.MY_PIPE_BLOCKS) block.get().createPipeModel(RuntimeExistingFileHelper.INSTANCE).dynamicModel();
}
MyBlocks.MY_PIPE_BLOCKS 替换为你的管道方块数组或 map values 集合引用。
相反,如果管道不是生成的,而是拥有固定的一组变体(例如光纤线缆或激光管道),
则不要使用 PipeModel#dynamicModel(),而应像下面这样使用 GTBlockBuilder#gtBlockstate 设置模型:
// on your pipe block builder
... = REGISTRATE.block(...)
.properties(...)
.gtBlockstate(GTModels::createPipeBlockModel)
...more builder things...
.item(...)
.model(NonNullBiConsumer.noop())
...more builder things...
Lamp Predicates(灯谓词)
过去,多方块中的 terminal 不能使用 lamps。现在新增了 lamp predicates 来帮助解决这个问题。
使用所有 lamps 的 predicate 是:Predicates.anyLamp()
使用特定颜色的 predicate 是:Predicates.lampsByColor(DyeColor.DYE_COLOR)。其中 DYE_COLOR 是你想要的颜色名称。
GTRecipeBuilder#adjacentFluidTag() and GTRecipeBuilder#adjacentBlockTag()
这只与使用这些 condition 的自定义 recipe types 的 add-on mods 相关。KubeJS 配方不受影响。
GTRecipeBuilder#adjacentFluid(TagKey<Fluid>...) -> #adjacentFluidTag(TagKey<Fluid>...) 和 GTRecipeBuilder#adjacentBlock(TagKey<Block>...) -> #adjacentBlockTag(TagKey<Block>...) 这两组重命名已经弃用,转而分别统一使用 adjacentFluids 和 adjacentBlocks 命名所有变体。
请更新你的 addon mods 配方以使用这些新方法,因为当前已弃用的方法会在 8.0.0 中移除。
所有已弃用方法及其替代项完整列表如下:
Fluids: adjacentFluid, adjacentFluidTag -> adjacentFluids
Blocks: adjacentBlock, adjacentBlockTag -> adjacentBlocks
机器配方失败诊断
机器现在会提供详细诊断,说明配方为何无法启动。
失败原因会显示在: - simple machines 的侧边栏 - multiblock machines 的 UI - 所有机器的 Jade tooltip
你应该将 ModifierFunction.NULL 替换为 ModifierFunction.cancel(reason),以告知机器配方启动失败的原因。
- return ModifierFunction.NULL;
+ return ModifierFunction.cancel(Component.translatable("gtceu.recipe_modifier.xxx"));
另外,如果你在 IRecipeLogicMachine#beforeWorking() 中取消配方,应添加一些自定义原因信息,例如:
@Override
public boolean beforeWorking(@Nullable GTRecipe recipe) {
if(xxx){
RecipeLogic.putFailureReason(this, recipe, Component.literal("Machine spirit is displeased"));
return false
}
return true;
}
已染色输出总线/仓
过去一段时间里,可以使用 Spray Paint cans 给多方块机器的 Input 和 Output Buses/Hatches 染色。 7.0.0 版本新增了这样的功能:机器运行配方时,不同颜色的 Painted Input Buses/Hatches 不会彼此共享原料。这个系统在 Painted Inputs and Outputs 中有更完整说明。
7.5.0 也将这一逻辑应用到 Output Buses/Hatches。已染色的 Input Buses/Hatches 现在只允许将输出发送到相同染色颜色或未染色的 Output Buses/Hatches。如果现有装置上有已染色的 Output Buses/Hatches,可能导致它们停止运行。
GTRecipe 构造函数变更
GTRecipe 及其构造函数新增了一个字段:int groupColor。对于新配方,该参数设为 -1;而对于正在准备和运行的配方,此字段保存配方抽取输入时所用 Painted Input Group 的染色颜色。
显式构造、复制 GTRecipe 或将自己的 ModifierFunctions 应用于 GTRecipe 的 addon mods(即不使用标准 builder 或 kjs 函数)需要在构造函数调用末尾添加额外的 int 参数,或在 copy 调用中添加额外的 recipe.groupColor。
新增 BiomeTagCondition
新增了名为 BiomeTagCondition 的 RecipeCondition,用于要求特定 biome tag。可在 KubeJS 中通过 .biomeTag("biome") 使用。