Skip to content

[1.16+] Time Existed Modifier

Alberto edited this page Jul 15, 2022 · 3 revisions

The Time Existed Modifier object is used in Range and Modifiable Value, and lets you change the value of those two objects based off the time played by nearby players (128 blocks).

Time Existed Modifier

  • time_existed_modifier: (Object) the object that contains the modifier's parameters.
    • bonus_percentage: bonus percentage given to the value every seconds
    • seconds: Every how many seconds will the value increase by bonus_percentage
    • max_bonus_percentage: The maximum value bonus_percentage can reach
    • mode: How the bonus_percentage is calculated when there are multiple players near the mob spawned. If omitted, defaults to "average"
      • "average": Makes an average of time played of the nearby players
      • "sum": Sums the time played of the nearby players
      • "nearest": Takes into account only the time played of the nearest player
    • affects_max_only: currently used in the Range object, a true or false value (defaulting to false) which makes the modifier affect only the max value

Note that the bonus_percentage is not flat for other percentages, so e.g. a chance of 15% with a bonus percentage of 100% will make the chance 30% not 115%.

Example

In this example the chance for the creeper to get speed on spawn increases by 20% every hour. So after 4.5 hours of play the chance will be 15% * (0.2 * 4.5 + 1) = 15% * 1.9 = 28.5%

{
    "mob_id": "minecraft:creeper",
    "potion_effects": [
        {
            "id": "minecraft:speed",
            "chance": {
                "value": 0.15,
                "time_existed_modifier": {
                    "bonus_percentage": 0.20,
                    "seconds": 3600
                }
            }
        }
    ]
}
Clone this wiki locally