Skip to content

Customizing Dietary Effects

C4 edited this page Apr 1, 2022 · 4 revisions

Dietary effects are custom potion effects or attribute modifiers applied to players when certain conditions are met.

The configuration file is located in the world save's serverconfig folder as diet-effects.toml.

Example effect entry:

[[effects]]
    [[effects.attributes]]
        name = "minecraft:generic.movement_speed"
        operation = "multiply_base"
        amount = 0.25
    [[effects.status_effects]]
        name = "minecraft:hunger"
        power = 3
    [[effects.conditions]]
        groups = ["sugars"]
        match = "all"
        above = 0.8
        below = 1.0

Effects

Each effect entry is divided into three different components: Attribute Modifiers, Status Effects, and Conditions.

Effects can have multiple attribute modifiers, status effects, and conditions tied to a single entry.

Start a new effects entry by typing [[effects]] at the beginning of the entry.

Attribute Modifiers

An attribute modifier represents a direct modifier to an entity attribute.

Start a new attribute modifier entry by typing [[effects.attributes]] one indent away from the main [[effects]] header.

Example:

[[effects]]
    [[effects.attributes]]
        name = "minecraft:generic.movement_speed"
        operation = "multiply_base"
        amount = 0.25

Fields

name - string

  • The namespaced registry name of the entity attribute to apply this entry on.
  • List of vanilla Minecraft entity attribute names:
    • Max Health - "minecraft:generic.max_health"
    • Knockback Resistance - "minecraft:generic.knockback_resistance"
    • Movement Speed - "minecraft:generic.movement_speed"
    • Attack Damage - "minecraft:generic.attack_damage"
    • Attack Knockback - "minecraft:generic.attack_knockback"
    • Attack Speed - "minecraft:generic.attack_speed"
    • Armor - "minecraft:generic.armor"
    • Armor Toughness - "minecraft:generic.armor_toughness"
    • Luck - "minecraft:generic.luck"

operation - string

  • The type of operation to perform on the entity attribute
  • Possible values:
    • "multiply_total" - Increment the attribute by (value * amount)
    • "multiply_base" - Increment the attribute by (base * amount)
    • "add" - Increment the attribute by the amount

amount - decimal

  • The amount to use for the operation on the attribute modifier

Status Effects

A status effect represents a potion effect applied to an entity.

Start a new status effect entry by typing [[effects.status_effects]] one indent away from the main [[effects]] header.

Example:

[[effects]]
    [[effects.status_effects]]
        name = "minecraft:hunger"
        power = 3

Fields

name - string

  • The namespaced registry name of the potion effect to apply

power - integer

  • The integer amount representing the strength of the potion effect

Conditions

A condition is an entry defining a test that needs to pass in order to activate the corresponding effect. There can be multiple conditions for a single effect, and all conditions must pass in order to activate the effect.

Start a new status effect entry by typing [[effects.status_effects]] one indent away from the main [[effects]] header.

[[effects]]
    [[effects.conditions]]
        groups = ["sugars"]
        match = "all"
        above = 0.8
        below = 1.0

Fields

groups - string[]

  • A list of groups that this condition is testing against
  • The names correspond to the names given to the groups in the diet-groups.toml configuration

above - decimal

  • A decimal value between 0.0 and 1.0 that indicates the lower bound that the value must be at or above

below - decimal

  • A decimal value between 0.0 and 1.0 that indicates the upper bound that the value must be at or below

match - string

  • The match method used for the condition testing
  • Possible values:
    • "all" - Condition passes if all of the groups meet the threshold.
    • "any" - Condition passes if any of the groups meet the threshold.
    • "average" - Condition passes if the average value of the groups meets the threshold.
    • "none" - Condition passes if none of the groups meet the threshold.
    • "every" - Condition passes if at least one group meets the threshold. In addition, looks for each group that passes the condition and amplifies the effect's power for each one.
      • Example: If three groups pass an "every" test, then a "Strength I" potion effect becomes "Strength III"

Mod Compatibility - Fields

Origins

origins - string[]

  • A list of origins that this condition is testing against
  • The names correspond to the identifier of the origin (i.e. "origins:arachnid")

matchOrigins - string

  • The match method used for the origins condition testing
  • Possible values:
    • "all" - Condition passes if all of the origins are present.
    • "any" - Condition passes if any of the origins are present.
    • "none" - Condition passes if none of the origins are present.

powers - string[]

  • A list of powers that this condition is testing against
  • The names correspond to the identifier of the power (i.e. "origins:carnivore")

matchPowers - string

  • The match method used for the powers condition testing
  • Possible values:
    • "all" - Condition passes if all of the powers are present.
    • "any" - Condition passes if any of the powers are present.
    • "none" - Condition passes if none of the powers are present.