营养
Nutritional 为 Minecraft 添加了一个饮食系统。你摄入的食物会归属于五个食物组,保持平衡会让你变得更强,而只依赖单一食物则会对你产生负面影响。这是 WesCook's Nutrition 的 NeoForge 1.21.1 重写版本。
模组中的所有功能均设计为允许整合包制作者在不编写代码的情况下进行调整。详见下方的 面向整合包制作者和开发者。
工作原理
每种食物都属于五个组中的一个或多个:乳制品、水果、谷物、蛋白质和蔬菜。进食会增加对应组的数值,而这些组会随着饥饿度的增加而随时间缓慢下降。目标是让所有五个组都保持在合理水平,而不是反复食用同一种食物。
你的整体饮食均衡度会被评定为一个饮食层级,从最差到最好依次为:
starving(饥饿)、malnourished(营养不良)、surviving(勉强维持)、nourished(营养充足)、gourmand(美食家)
饮食不佳会使你处于低层级并受到惩罚。多样化且充足的饮食能让你进入高层级,从而获得诸如最大生命值、移动速度和护甲等方面的加成。良好的饮食习惯还会使未来的餐食更具滋养效果,并减缓各组数值的下降速度,因此好习惯会自我强化。
除了层级之外:
- 状态效果。 跨越特定的营养阈值可能会赋予你状态效果,包括因饮食良好而获得的增益效果,以及因饮食不当而受到的惩罚效果。
- 长期奖励。 连续多个 Minecraft 日保持良好饮食,你将获得永久加成。该加成将持续存在,直到你死亡或饮食状况恶化到一定程度。
- 更严苛的维度。 默认情况下,下界和末地会对玩家更加不利:在这些维度中,你的营养组数值消耗更快,食物的效果也会减弱。
查看饮食状态
- 按 N 键打开一个界面,显示每个食物组的条形图以及当前的饮食层级。
- 右上角的小部件可让你一目了然地查看当前层级。你可以在饮食界面的按钮处切换其显示。
- 将鼠标悬停在食物上,可查看它所属的组及其提供的数值。
- 如果你使用了 JEI,查询某项食物时会显示“提供营养”条目,包含相同的信息。
进度
模组附带了一个小型的进度树,涵盖从各个食物组获取食物、保持多样化饮食以及达到更高饮食层级和奖励等内容。
配置
大多数行为可以通过两个配置文件进行更改:
nutritional-client.toml 用于个人显示选项,如工具提示、HUD 小部件和饮食界面按钮。
nutritional-server.toml 用于世界规则,如各组数值的消耗速度、死亡惩罚以及总体难度乘数。
整合包制作者还可以通过数据包更改更多内容,如下文所述。
面向整合包制作者和开发者
Nutritional 是基于数据的。食物组、其中的物品、饮食层级、状态效果规则、奖励以及各维度的难度均在数据包中定义,因此无需触碰 Java 代码即可添加、重新平衡或移除这些内容。
数据模型
六个一级数据包注册表:
| 注册表 |
路径 |
nutritional:nutrient |
data/<pack>/nutritional/nutrient/<id>.json |
nutritional:effect |
data/<pack>/nutritional/effect/<id>.json |
nutritional:food_hint |
data/<pack>/nutritional/food_hint/<id>.json |
nutritional:diet_tier |
data/<pack>/nutritional/diet_tier/<id>.json |
nutritional:sustained_reward |
data/<pack>/nutritional/sustained_reward/<id>.json |
nutritional:dimension_modifier |
data/<pack>/nutritional/dimension_modifier/<dim_namespace>/<dim_path>.json |
效果支持四种检测模式:any(任意)、average(平均)、all(全部)和 cumulative(累积)。默认的 nourished(营养充足)、malnourished(营养不良)和 toughness(坚韧)生物效果已内置。
物品与缩放
物品所属的组由标签决定(#nutritional:nutrient/<id>)。每个物品的缩放覆盖值来自 NeoForge DataMap(在 minecraft:item 注册表上的 nutritional:nutrient_scales)。大多数食物只需一个标签条目即可。
自定义属性
添加了两个属性,可通过装备、生物效果和模组进行修改:
nutritional:nutrient_absorption:食物提供的营养量。数值越高,餐食的滋养效果越强。
nutritional:nutrient_decay_rate:各组数值下降的速度。数值越低,消耗越慢。
命令
/nutritional get|set|add|subtract|reset <player> <nutrient> [<value>]
/nutritional reload 重新加载数据包
/nutritional-food 打印手中物品提供的营养产量
进度触发器
提供了两个自定义标准触发器 nutritional:tier_reached 和 `nutritional:reward_earned供数据包构建自己的进度树使用。
致谢
- WesCook,原版 Nutrition 的作者。原版 1.12 模组启发了此重写版本的核心概念:与饥饿相关的营养、阈值和衰减机制。
- 原版 1.12 的贡献者列于此仓库的 git 历史记录中,保留在
1.12 分支上。
Nutritional
Nutritional adds a diet system to Minecraft. The food you eat counts toward five food groups, and keeping them in balance makes you stronger, while living on a single food works against you. It is a NeoForge 1.21.1 rewrite of WesCook's Nutrition.
Everything in the mod is built to be retuned by pack makers without writing code. See For pack makers and developers below.
How it works
Every food belongs to one or more of five groups: dairy, fruit, grain, protein, and vegetable. Eating raises the groups that food belongs to, and each group slowly drops over time as you get hungry. The goal is to keep all five reasonably topped up rather than spamming one food.
Your overall balance is graded into a diet tier, from worst to best:
starving, malnourished, surviving, nourished, gourmand
A poor diet leaves you in a low tier with penalties. A varied, well-fed diet pushes you into a high tier that grants bonuses to things like max health, movement speed, and armor. Eating well also makes future meals more nourishing and slows how fast your groups drop, so good habits build on themselves.
On top of the tiers:
- Status effects. Crossing certain nutrient levels can give you status effects, both helpful ones for eating well and penalties for eating badly.
- Long-term rewards. Keep a good diet going for several Minecraft days in a row and you earn a permanent bonus. It sticks until you die or let your diet slip too far.
- Harsher dimensions. By default the Nether and the End are tougher on you: your groups drain faster and food does less there.
Seeing your diet
- Press N to open a screen with a bar for every food group and your current diet tier.
- A small widget in the top-right corner shows your current tier at a glance. You can toggle it from a button on the diet screen.
- Hovering a food shows which groups it fills and how much.
- If you use JEI, looking up a food shows a "Provides nutrients" entry with the same information.
Advancements
The mod ships a small advancement tree for eating from each food group, eating a varied diet, and reaching the higher diet tiers and rewards.
Configuration
Most behavior can be changed in two config files:
nutritional-client.toml for personal display options like the tooltip, the HUD widget, and the diet screen button.
nutritional-server.toml for world rules like how fast groups drain, the death penalty, and overall difficulty multipliers.
Pack makers can change far more than this through datapacks, covered next.
For pack makers and developers
Nutritional is data-driven. Food groups, the items in them, diet tiers, status-effect rules, rewards, and per-dimension difficulty are all defined in datapacks, so they can be added, rebalanced, or removed without touching Java.
Data model
Six first-class datapack registries:
| Registry |
Path |
nutritional:nutrient |
data/<pack>/nutritional/nutrient/<id>.json |
nutritional:effect |
data/<pack>/nutritional/effect/<id>.json |
nutritional:food_hint |
data/<pack>/nutritional/food_hint/<id>.json |
nutritional:diet_tier |
data/<pack>/nutritional/diet_tier/<id>.json |
nutritional:sustained_reward |
data/<pack>/nutritional/sustained_reward/<id>.json |
nutritional:dimension_modifier |
data/<pack>/nutritional/dimension_modifier/<dim_namespace>/<dim_path>.json |
Effects support four detection modes: any, average, all, and cumulative. The nourished, malnourished, and toughness mob effects ship by default.
Items and scaling
Which group an item belongs to comes from tags (#nutritional:nutrient/<id>). Per-item scale overrides come from a NeoForge DataMap (nutritional:nutrient_scales on the minecraft:item registry). Most foods need only a tag entry.
Custom attributes
Two attributes are added and can be modified by equipment, mob effects, and other mods:
nutritional:nutrient_absorption, how much food gives. Higher means meals are more nourishing.
nutritional:nutrient_decay_rate, how fast groups drop. Lower means they drain slower.
Commands
/nutritional get|set|add|subtract|reset <player> <nutrient> [<value>]
/nutritional reload reloads datapacks
/nutritional-food prints the nutrient yield for the held item
Advancement triggers
Two custom criterion triggers, nutritional:tier_reached and nutritional:reward_earned, are available for datapacks to build their own advancement trees against.
Credits
- WesCook, original Nutrition author. The original 1.12 mod inspired this rewrite's core concepts: nutrients, thresholds, and decay tied to hunger.
- Original 1.12 contributors are listed in this repo's git history, preserved on the
1.12 branch.
评论 0
登录后参与评分
还没有评论,来抢沙发吧