-
Notifications
You must be signed in to change notification settings - Fork 3
Temperature Effects (Mods and Datapacks)
Temperature effects are data-driven ways of adding effects to temperature under certain conditions. Some examples include damage, status effects, and attribute modifiers. They are used by both mods and datapacks. For mods, you should place your files in src/main/resources/data/[modid]/thermoo/temperature_effect
and for datapacks, they should instead be placed in [world]/datapacks/your_datapack/data/[namespace]/thermoo/temperature_effect
.
thermoo/temperature_effects
in these versions, but it has since been updated to a singular form to reflect similar changes made to the vanilla game.
Temperature effects come in the following JSON format:
-
type
: Resource location/Identifier of the type (see below). By default, Thermoo allows forthermoo:empty
,thermoo:status_effect
,thermoo:attribute_modifier
,thermoo:scaling_attribute_modifier
,thermoo:damage
,thermoo:function
, orthermoo:sequence
-
entity
: A datapack predicate. OPTIONAL: If not specified, treated as always evaluating totrue
. -
entity_type
: Resource location/Identifier of an entity type, for exampleminecraft:player
orfrostiful:frostologer
. Only ticks the effect for that entity type. Is generally more efficient than using a predicate, as the effect won't be ticked at all for other types. OPTIONAL: Defaults tonull
, which ticks the effect for all entity types. -
temperature_scale_range
: An int provider that specifies at what temperature scales the effect should apply on. Note that the scale is a percentage from -1 to +1, not their actual temperature value. OPTIONAL: will accept any temperature scale if not specified -
config
: A JSON compound. Its form is dependent on the value oftype
(see below for details) -
loading_priority
: An integer. Allows load-order independent overriding of temperature effects from other mods/datapacks, to support the creation of compatibility patches. An effect of a higher priority will always load before an effect at the same resource location with a lower priority. OPTIONAL: defaults to 0. - Temperature effects also support the Fabric Resource Conditions API. See: https://github.com/FabricMC/fabric/pull/1656
The empty temperature effect, as the name implies, does nothing. It is primarily useful for overriding/deleting temperature effects from lower-priority mods or datapacks.
If the type
is thermoo:empty
, the config
can be left as an empty object. Note that it must still be specified!
The status effect temperature effect applies the specified status effect(s) (aka potion effects) to the affected entity when they match the predicate
If the type is thermoo:status_effect
, the config
has the following format:
-
effects
: A list of effects, which have the following format:-
type
: A resource location/identifier of the status effect type. For example,minecraft:speed
-
duration
: The time (in ticks) the status effect will be applied for. OPTIONAL: defaults to 20 if not specified -
amplifier
: The amplifier of the status effect
-
The attribute modifier applies a fixed attribute modifier to the affected entity
If the type is thermoo:attribute_modifier
, the config
has the following format:
-
value
: Float, the value of the modifier. -
attribute_type
: Resource Location/Identifier of the attribute type to apply the modifier to -
id
: The ID of the modifier. Must be formatted as a valid identifier/resource location, e.g.example:slow_from_freezing
. -
operation
: Enum. How to apply the modifier. Must be one ofadd_value
,add_multiplied_base
, oradd_multiplied_total
.
The scaling attribute modifier applies an attribute modifier that scales with the entity's temperature
If the type is thermoo:scaling_attribute_modifier
, the config
has the following format:
-
scale
: Float, the multiplier of the strength of the modifier against the temperature scale of the entity. This is basically the maximum value of the modifier when the absolute value of the affected entity's temperature scale is 1. OPTIONAL: defaults to 1 if not specified -
attribute_type
: Resource Location/Identifier of the attribute type to apply the modifier to -
id
: The id of the modifier. Must be formatted as a valid identifier/resource location, e.g.thermoo:slow_from_freezing
. -
operation
: Enum. How to apply the modifier. Must be one ofadd_value
,add_multiplied_base
, oradd_multiplied_total
.
Note for 1.20 and below: The id
field is instead a pair of fields, one being a string UUID field called modifier_uuid
and another being a regular string field called name
. Furthermore, the operation
field required one of add
, multiply_base
or multiply_total
.
Applies damage to the entity in regular intervals, or "pulses".
If the type is thermoo:damage
, the config
has the following format:
-
amount
: Integer, the amount of damage to apply on each pulse -
damage_interval
: Integer, the number of ticks between each damage pulse -
damage_type
: String Resource Location/Identifier, the damage type to apply to the entity.
The freeze damage legacy affect will apply freeze damage every few ticks to entities when they match the predicate. This is called "legacy" because in 1.19.4, the way damage is applied is changed to be data-driven. This effect hard codes freeze damage rather than allowing for arbitrary damage types. This effect is deprecated in 1.19.4+, but is kept for posterity.
If the type is thermoo:freeze_damage_legacy
, the config
has the following format:
-
amount
: The amount of freeze damage to apply -
damage_interval
: The number of ticks between pulses of damage
A temperature effect that executes datapack functions on an interval. Supports macro functions.
If the type is thermoo:function
, the config
has the following format:
-
function
: The ID of the function to execute. -
arguments
: A string that is the SNBT representation of the function's macro arguments. Must be supplied if and only if the specifiedfunction
is a macro function. -
interval
: A positive integer that is the time, in ticks, between executions of thefunction
. OPTIONAL: Defaults to 20, or once per second. -
permission_level
: The permission level of the function to execute. OPTIONAL: Defaults to 2, which is the normal permission level for functions. Note that this does not respect the function permission level set inserver.properties
, it is only what is set here.
A meta-temperature effect that can be used to apply several other child effects in sequence. The child effects will only apply if the parent effect can be applied as well. This is useful when you have many different effects that should apply under the same conditions.
Note: For child effects, there is not much additional performance gain from the entity_type
field - but it will still function identically.
If the type is thermoo:sequence
, the config
has the following format:
-
children
: An inline list of other temperature effects.
You can easily define your own custom temperature effects by extending the class TemperatureEffect
and then registering an instance into the custom registry ThermooRegistries.TEMPERATURE_EFFECTS
. Scorchful does this to create sound temperature effect, which you can see here
The best examples of how to use these effects can be found in Frostiful and Scorchful.
You can also get examples in the Thermoo Test Mod.
➡️ Next: Item Attribute Modifiers