前言:

    本篇教程的创作动机是笔者在制作整合包时发现,MCMOD上显示TA(极光幽境)与CrT(CraftTweaker)有联动,但CrT官方文档的Mods分类中并没有给出相关信息,在评论区某位大佬的指路下笔者在github的wiki上成功找到了联动接口。现拟撰此教程以利后者。

    笔者属于魔改萌新,如有错误欢迎dalao指正!!!谢谢!!


※github的官方wiki文档:https://github.com/shiroroku/TheAurorian/wiki/CraftTweaker-Integration


    极光幽境(下简称TA)为CraftTweaker(下简称CrT)提供了两个合成器的配方修改接口:Moonlight Forge(月光融锻台)和Scrapper(粉碎器)。为了美观笔者为代码作了分行处理,实际分行不影响代码运行。


一、月光融锻台(Moonlight Forge)


    导包:


import mods.theaurorian.MoonlightForge;

    

1.添加配方


//模板(*标记内容将在下文讲解)
mods.theaurorian.MoonlightForge.addRecipe(
    IItemStack* input , IItemStack catalyst , IItemStack output
);

//官方样例(皎月石剑和钻石锻造成钻石剑)
mods.theaurorian.MoonlightForge.addRecipe(
    <theaurorian:moonstonesword> , <minecraft:diamond> , <minecraft:diamond_sword>
);


    三个IItemStack分别对应月光融锻台里从左至右三个物品交互接口(Imput、Catalyst、Output)(话说你这催化剂怎么合成后还会消耗啊()


    实例:以下魔改代码对应图中配方:修复了蛛母奖励日常没人权的bug(


import mods.theaurorian.MoonlightForge;

mods.theaurorian.MoonlightForge.addRecipe(
    <contenttweaker:aurorian_element_ignot>*9, <theaurorian:trophyspider>, <theaurorian:umbraingot>*9
);

//<contenttweaker:aurorian_element_ignot>是图中笔者自定义的粉色-蓝色渐变的锭


[1.12.2][CrT联动补充]极光幽境的CrT联动接口-第1张图片


2.移除配方


//模板
mods.theaurorian.MoonlightForge.removeRecipe(
    IItemStack* input , IItemStack catalyst , IItemStack output
);

//官方样例
mods.theaurorian.MoonlightForge.removeRecipe(
    <theaurorian:moonstonesword>, <theaurorian:aurorianiteingot>, <theaurorian:aurorianitesword>
);

    

    移除符合代码描述的配方(官方样例便是移除了极光剑的合成配方)。


    *注意:

    根据官方文档描述:“代码中input一处类型并非IItemStack而是‘Items’,配方中input物品的耐久和其他NBT标签将被忽略,但数量除外。”

    (原文:the Moonlight Forge's recipe checker only compares input items as Items, not as an ItemStack. This means item damage and other NBT data on input items is ignored. It does count ItemStack counts.

    但是!根据笔者测试,此处并非是IIngredient类型而依旧是IItemStack类型,内部处理器依旧只接受IItemStack类型的参数输入,只是配方处理时会忽略IItemStack的耐久参数和NBT参数。

    以下涉及此处注解所指的特殊IItemStack均在其后加“*”以示区分。


    附:报错实例:


import mods.theaurorian.MoonlightForge;

mods.theaurorian.MoonlightForge.addRecipe(
    <contenttweaker:aurorian_element_block>.or(<contenttweaker:aurorian_element_ignot>*9), <theaurorian:trophykeeper>, <theaurorian:aurorianiteingot>*9
);
//此处用item1.or(item2)把IItemStack转化为IIngredient


[1.12.2][CrT联动补充]极光幽境的CrT联动接口-第2张图片

    

二、粉碎器(Scrapper)(实际上这个机器的原理应该是刮蹭()

    

    导包:


import mods.theaurorian.Scrapper;


    添加配方:


//模板
mods.theaurorian.Scrapper.addRecipe(
    IItemStack input , IItemStack output
);

//官方样例(真的会有人去加这个配方嘛......)
mods.theaurorian.Scrapper.addRecipe(
    <minecraft:iron_ingot>, <minecraft:iron_nugget> * 9
);


    实例:(为暮色森林的各种工具添加兼容,以钢叶头盔为例)


import mods.theaurorian.Scrapper;

mods.theaurorian.Scrapper.addRecipe(
    <twilightforest:steeleaf_helmet> , <twilightforest:steeleaf_ingot> * 3
);


[1.12.2][CrT联动补充]极光幽境的CrT联动接口-第3张图片


    删除配方:


//模板
mods.theaurorian.Scrapper.removeRecipe(
    IItemStack imput, IItemStack output
);
//官方样例
mods.theaurorian.Scrapper.removeRecipe(
    <theaurorian:auroriansteelsword>, <theaurorian:auroriansteelnugget> * 12
);


    移除符合代码描述的配方(官方样例便是移除了极光钢剑的粉碎配方)。