自定义药水

自定义药水

允许通过数据包添加自定义药水和药水配方

魔法

Custom Potions

提供了一种仅服务端的方式来使用数据包添加自定义药水。

安装在客户端时,可提供与 REI 和 EMI 的集成。(仅支持至 1.21.1。如果你遇到问题,可以从 2.1.2+1.21.1 开始在 config/custompotions.json 中禁用它)

添加药水

在数据包中,为你的药水创建一个 data/id/custom_potions/id.json 文件。

可用参数包括 “fallback”,用于在翻译不可用时作为药水的回退名称 (Potion of {fallback}、Arrow of {fallback}、Splash {fallback}、Lingering {fallback}), 一个遵循原版格式的效果数组,以及一个可选的 color,使用与原版相同的格式。

例如:

{
    "fallback": "Bad Luck",
    "effects": [
        {
            "id": "minecraft:unluck",
            "duration": 6000,
            "amplifier": 1
        }
    ],
    "color": 5841183
}

添加药水配方

在你的数据包中,为你的配方创建一个 data/id/potion_recipes/id.json 文件。可用参数包括 “reagent”, 它接收一个物品 id,是在酿造台顶部用于制作该药水的原料。还有 “base” 和 “result”,二者使用相同的格式,并定义配方中使用的输入和输出药水。 它们具有参数 “type”,可接收 “custompotions:vanilla” 用于原版(或模组)药水,以及 “custompotions:custom” 用于通过此模组由数据包添加的药水。

例如:

{
    "reagent": "minecraft:poisonous_potato",
    "base": {
        "type": "custompotions:vanilla",
        "potion": "minecraft:awkward"
    },
    "result": {
        "type": "custompotions:custom",
        "potion": "potionstuffs:bad_luck"
    }
}
{
    "reagent": "minecraft:nautilus_shell",
    "base": {
        "type": "custompotions:vanilla",
        "potion": "minecraft:awkward"
    },
    "result": {
        "type": "custompotions:vanilla",
        "potion": "minecraft:luck"
    }
}

翻译

翻译键遵循 custompotion.namespace.id.type 的格式。例如,custompotion.mypotions.bad_luck.normal、custompotion.mypotions.bad_luck.splash、custompotion.mypotions.bad_luck.lingering, 以及 custompotion.mypotions.bad_luck.arrow。

你可以像这样在语言 json 文件中使用它们:

{
    "custompotion.mypotions.bad_luck.normal": "Unlucky Potion",
    "custompotion.mypotions.bad_luck.splash": "Throwable Unlucky Potion",
    "custompotion.mypotions.bad_luck.lingering": "Lingering Unlucky Potion",
    "custompotion.mypotions.bad_luck.arrow": "Unlucky Arrow"
}