在配置 The Spice of Life(生活调味料) Mod的时候,往往会有“希望某些食物不受该mod影响”的需求
偏偏The Spice of Life的食物黑名单无法直接在cfg文件中添加,而是需要使用json文件配置,本教程将介绍如何添加食物黑名单与FoodGroups的详细设置
注意,不恢复饥饿度和饱和度的”食物“(如Aether的白苹果,治愈灵石),是默认不受The Spice of Life影响的
无脑且快速的添加食物黑名单方法:
在 \config\spiceoflife 目录下新建一个json文件(名字随意,非中文即可)
按下列格式输入代码
{
"food": {
"items": [
//此处加入黑名单食物的ID
"minecraft:apple",
"minecraft:golden_apple:0"
]
},
"blacklist": true
}
3. 保存重启游戏即可
4. 将食物加入黑名单的最终效果为:
①食物的饥饿度和饱和度不会随着食用次数衰减
②食物的食用速度不会随着食用次数变慢
③食物的食用次数仍会计入食用历史中(在之前食用的xx次食物中占了xx次)
FoodGroups详细介绍
The Spice of Life在 \config\spiceoflife 中提供了一个示例文件,其中详细介绍了FoodGroup中各个参数的功能,下面是翻译和注释
即便本教程添加了注释,但笔者仍然强烈建议玩家实际打开该示例文件辅助理解
// Mod Version: 1.3.12
{
// 将指定食物添加到该FoodGroup中(一般一个json文件就代表一个FoodGroup)
// Food included in the food group
"food": {
// 添加某个矿物词典到该FoodGroup中,示例添加了Pam's HarvestCraft的"listAllfruit","listAllberry"两个矿物词典
// A list of Ore Dictionary entries
// This example adds two oredictionary entries created by Pam's HarvestCraft,
// including all fruit and all berries
"oredict": [
"listAllfruit",
"listAllberry"
],
// 添加指定食物到该FoodGroup中,示例添加了原版的苹果和金苹果,但是没有添加附魔金苹果("minecraft:golden_apple:1")
// A list of items in "mod:name:meta" format
// This example adds red apples and golden apples (golden_apple with metadata 0),
// thereby excluding enchanted golden apples (golden_apple with metadata 1)
"items": [
"minecraft:apple",
"minecraft:golden_apple:0"
]
},
// 将指定食物从该FoodGroup中剔除
// Food excluded from the food group, takes precedence over items in "food"
// Optional; uses the same format as the "food" property
"exclude": {
// 示例中将Pam's HarvestCraft的harvestcraft:strawberryItem(蓝莓)从该FoodGroup中剔除了
// 但要注意由于harvestcraft:strawberryItem属于listAllberry矿物词典,而我们前面添加过该矿物词典
// 所以现在FoodGroup中包含的是剔除了harvestcraft:strawberryItem的listAllberry矿物词典
// This example excludes HarvestCraft strawberrys, which would have
// otherwise been included in the "listAllberry" oredict inclusion
"items": [
"harvestcraft:strawberryItem"
]
},
// 设置在Tooltip中显示的名字
// 默认显示为"spiceoflife.foodgroup.<filename>",若将hidden属性打开则不显示
// The name that will be shown in the tooltip.
// Can be localized. Unused for hidden food groups.
// Optional; default if not defined: "spiceoflife.foodgroup.<filename>"
"name": "Example",
// 是否启用该FoodGroup
// 默认为true(但是示例是false,所以示例默认是不生效的)
// Optional; default if not defined: true
"enabled": false,
// 是否将该FoodGroup加入黑名单
// 默认为false,如果开启则该FoodGroup内所有食物都不受该Mod影响
// If true, the foods in this food group will be excluded from diminishing returns
// Optional; default if not defined: false
"blacklist": false,
// 是否隐藏
// 默认为false,如果开启则不在tooltip中显示(如果开启黑名单则自动设置为开启隐藏)
// If true, this food group will not be shown in the tooltip
// Note: blacklist food groups are always hidden
// Optional; default if not defined: false
"hidden": false,
// 设置该FoodGroup内食物的衰减公式
// 更多的信息请查看cfg文件中food.modifier.formula一栏
// If defined, this formula will be used for this food group
// instead of the main diminishing returns formula
// See the food.modifier.formula config option in the main SpiceOfLife.cfg for documentation
// Optional; default if not defined: food.modifier.formula from SpiceOfLife.cfg
"formula": "MAX(0, 1 - count/2)",
// 设置在tooltips中显示的颜色
// Used to set the style of the food group name in tooltips, etc
// Valid values:
// black, dark_blue, dark_green, dark_aqua, dark_red, dark_purple, gold,
// gray, dark_gray, blue, green, aqua, red, light_purple, yellow, white,
// obfuscated, bold, strikethrough, underline, italic
// Optional; default if not defined: gray
"color": "gold"
}
最后提供一份无注释版方便玩家理解,复制和修改
{
"food": {
"oredict": [
"listAllfruit",
"listAllberry"
],
"items": [
"minecraft:apple",
"minecraft:golden_apple:0"
]
},
"exclude": {
"items": [
"harvestcraft:strawberryItem"
]
},
"name": "Example",
"enabled": false,
"blacklist": false,
"hidden": false,
"formula": "MAX(0, 1 - count/2)",
"color": "gold"
}