手册:Minecraft:food/1.12.0

来自Minecraft基岩版开发Wiki

模式[编辑]

object "minecraft:food"
{
    int "nutrition" : opt
    float "saturation_modifier" : opt
    enumerated_value "saturation_modifier"<"poor", "low", "normal", "good", "max", "supernatural"> : opt
    string "using_converts_to" : opt
    enumerated_value "on_use_action"<"chorus_teleport", "suspicious_stew_effect"> : opt
    array "on_use_range"[3] : opt
    {
        float "<any array element>"
    }
    string "cooldown_type" : opt
    int "cooldown_time" : opt
    bool "can_always_eat" : opt
    array "effects" : opt
    {
        object "<any array element>"
        {
            string "name"
            int "duration" : opt
            int "amplifier" : opt
            float "chance" : opt
        }
    }
    array "remove_effects" : opt
    {
        string "<any array element>"
    }
}

结构[编辑]

  •  minecraft:food:根对象。
    •  nutrition:该物品被使用后恢复的饥饿值,默认为0。
    •  saturation_modifier[①]:该物品提供的饱和度修饰符,是营养值的12,默认为0.6
    •  saturation_modifier[②]:该物品字符串形式的的饱和度修饰符,可以填写supernaturalmaxgoodnormallowpoor,默认为normal,应对数值见下表
    •  using_converts_to:该物品被使用后给予玩家的物品。
    •  on_use_action:使用时的操作,默认为空。
    •  on_use_range:使用时的操作的距离,默认为0.0。
      •  0:X方向的距离。
      •  1:Y方向的距离。
      •  2:Z方向的距离。
    •  cooldown_type:使用冷却类型,默认为空。
    •  cooldown_time:使用冷却时间,默认为0。
    •  can_always_eat:该物品能否在饥饿值满时被使用,默认为false
    •  effects:该物品被使用后给予的状态效果。
      • :状态效果的信息。
        •  name:状态效果的标识符。
        •  duration:状态效果的持续时间(秒),默认为1。
        •  amplifier:状态效果的额外等级,默认为1。
        •  chance:状态效果的触发概率,默认为1.0。
    •  remove_effects:该物品被使用后移除的状态效果。
      • :状态效果的信息。

枚举[编辑]

饱和度修饰符[编辑]

在本格式版本中high不可用。

食物常数列表
键名 接口字符串 描述
MAX_FOOD 20 最大食物水平
HEALTH_TICK_COUNT 80 生命值滴答数
HEAL_LEVEL 18 治疗食物水平
MAX_SATURATION 20.0 最大饱和度
START_SATURATION 5.0 起始饱和度
MAX_EXHAUSTION 4.0 最大疲劳度
STARVE_LEVEL 0 挨饿食物水平
FOOD_SPRINT_LEVEL 6.0 疾跑食物水平
FOOD_SATURATION_POOR 0.1 poor 饱和度修饰符,差
FOOD_SATURATION_LOW 0.3 low 饱和度修饰符,低
FOOD_SATURATION_NORMAL 0.6 normal
high
饱和度修饰符,普通
FOOD_SATURATION_GOOD 0.8 good 饱和度修饰符,好
FOOD_SATURATION_MAX 1.0 max 饱和度修饰符,最大
FOOD_SATURATION_SUPERNATURAL 1.2 supernatural 饱和度修饰符,超自然

使用时操作[编辑]

使用时操作枚举
键名 接口字符串 描述
NONE -1 任意无效值
CHORUS_TELEPORT 0 chorus_teleport
SUSPICIOUS_STEW_EFFECT 1 suspicious_stew_effect