Level based value

Helpers that build a minecraft:level_based_value object, one for each of its types. Where a field takes one, write the helper's call; its name is the type it makes. Click a type to see what it accepts.

Clamped

Clamped
Clamped(value, min, max)
value
LevelBasedValue
min
number
max
number

Exponent

Exponent
Exponent(base, power)
base
LevelBasedValue
power
LevelBasedValue

Fraction

Fraction
Fraction(numerator, denominator)
numerator
LevelBasedValue
denominator
LevelBasedValue

LevelsSquared

LevelsSquared
LevelsSquared(added)
added
number

Added to the result so that the result becomes square(level) + added.

Linear

Linear
Linear(base, per_level_above_first)
base
number

Base value at level 1.

per_level_above_first
number

Value increase per level above 1.

Lookup

Lookup
Lookup(values, fallback)
values
list of LevelBasedValue (at least 1)

Indexed by level - 1 to apply, if present

fallback
LevelBasedValue

Applied if the level is greater than the size of values.