Nourished
基本信息
| 属性 | 值 |
|---|---|
| 注册名 | nutrition:nourished(Potion.setPotionName → potion.nutrition:nourished) |
| 效果类型 | 增益(good Potion,PotionCustom(id, false, icon)) |
| 修饰属性 | SharedMonsterAttributes.maxHealth(UUID bdafe0c7-5881-4505-802e-e18f6c419554) |
| 图标资源 | assets/nutrition/textures/potions/nourished.png |
| 应用时长 | 619 ticks(约 30.95 秒),由 EffectsManager.reapplyEffects 每 110 ticks 续期 |
功能
根据玩家 5 大 Nutrient 平均值(或单 Nutrient)维持在 70 以上,奖励每 amplifier 等级 +1 HP(半颗心)。是 mod 的"吃饭回报"正向反馈机制。
实现
public class PotionNourished extends PotionCustom {
PotionNourished(int id, ResourceLocation icon) {
super(id, false, icon);
}
@Override
public double func_111183_a(int amplifier, AttributeModifier modifier) {
if (modifier.getID().equals(ModPotions.NOURISHMENT_HEALTH)) {
return (amplifier + 1); // Half-heart per level
}
return 0D;
}
}
func_111183_a 返回的值会乘到 AttributeModifier 的 amount 上。
数值公式
maxHealth 增加 = (amplifier + 1) HP
| amplifier | 额外 HP | 额外红心 |
|---|---|---|
| 0 | 1 | 0.5 |
| 1 | 2 | 1 |
| 2 | 3 | 1.5 |
| 4 | 5 | 2.5 |
⚠️ 注意:自 v3.0.0 起,“half-heart per level” 是有意的破兼容性变更,让玩家能用更细粒度的健康调整做 mod 配置。
触发条件
由 EffectsList 中注册:
EFFECTS.add(
Effect.builder("toughness", ModPotions.toughness) // 注意:源码注释上写 toughness 但 builder name 不影响 Potion
.nutrientRange(90, 100)
.detectionType(EnumDetectionType.CUMULATIVE)
.build());
实际上 Nourished 在源码中没有显式注册到 EffectsList,仅注册了 toughness(同名 mapping)。Nourished 与 Malnourished 通过 API 暴露,第三方 mod 可注册自定义 Effect 触发它,或自定义 mod 扩展使用。
相关条目
- Malnourished - 对称的减益 Potion(负方向)
- Toughness - 同为 mod 自定义 Potion,但用 knockbackResistance
- 效果阈值检测类型 -
CUMULATIVE算法说明