Skip to content

Clamped

Provides the number value clamped to a specific minimum and maximum range.

Type ID: kaya:clamped

Note

This number meta type can only provide the same kind of value of the field where it was used. (e.g: if the field is a float provider, the number provider to specify should be a float provider or if the field is an int provider, the number provider to specify should be an int provider)

Format

Field Type Default Description
value Number Provider The number value to provide and clamp.
min Number Provider The minimum number value for the provided number value.
max Number Provider The maximum number value for the provided number value.

Example

{
    "type": "kaya:clamped",
    "value": {
        "type": "kaya:entity/attribute",
        "attribute": "minecraft:max_health",
        "entity": "this"
    },
    "min": 1.0,
    "max": 20.0
}

This example is a float provider that provides the value of the minecraft:max_health attribute of the entity provided by the kaya:this_entity context parameter. The float value is then clamped where its value will be within the range of $1.0$ to $20.0$.

History

Minecraft Mod Changelog
1.21.5 0.1.0 Added the type.