Class TemperatureEffect<C>
java.lang.Object
com.github.thedeathlycow.thermoo.api.temperature.effects.TemperatureEffect<C>
- Type Parameters:
C- The config type of the effect
- Direct Known Subclasses:
AttributeModifierTemperatureEffect,DamageTemperatureEffect,EmptyTemperatureEffect,FunctionTemperatureEffect,ScalingAttributeModifierTemperatureEffect,SequenceTemperatureEffect,StatusEffectTemperatureEffect
A temperature effect is some effect that is applied to a
LivingEntity based on their current temperature,
as determined by TemperatureAware. This class represents the
parent class for all temperature effect 'types', which implement the specific behaviour of an effect. Effects may apply
potion effects, modify attributes, apply damage, and more.
Effect types can be configured to only apply effects of different strengths or only under certain conditions. The config is provided by the C generic type.
The config is specified via a datapack in the folder data/{namespace}/thermoo/temperature_effects/.
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTemperatureEffect(com.mojang.serialization.Codec<C> configCodec) -
Method Summary
Modifier and TypeMethodDescriptionabstract voidapply(net.minecraft.world.entity.LivingEntity victim, net.minecraft.server.level.ServerLevel serverLevel, C config) Applies the effect to a living entityfinal com.mojang.serialization.MapCodec<ConfiguredTemperatureEffect<C>> getCodec()voidremove(net.minecraft.world.entity.LivingEntity victim, net.minecraft.server.level.ServerLevel serverLevel, C config) Called the first tick that a temperature effect could not be appliedabstract booleanshouldApply(net.minecraft.world.entity.LivingEntity victim, C config) Tests if the effect should be applied to a living entity.
-
Constructor Details
-
TemperatureEffect
- Parameters:
configCodec- Codec for the config type
-
-
Method Details
-
apply
public abstract void apply(net.minecraft.world.entity.LivingEntity victim, net.minecraft.server.level.ServerLevel serverLevel, C config) Applies the effect to a living entity- Parameters:
victim- The living entity to apply the effect toserverLevel- The server level of the victimconfig- The effect config
-
shouldApply
Tests if the effect should be applied to a living entity. Note that even if this returnstrue, the effect is not guaranteed to be applied. This is because all entity must pass the predicate specified byConfiguredTemperatureEffect.predicate().- Parameters:
victim- The victim to test if the effect should be applied toconfig- The effect config- Returns:
- Returns if the effect should be applied to the victim
-
remove
public void remove(net.minecraft.world.entity.LivingEntity victim, net.minecraft.server.level.ServerLevel serverLevel, C config) Called the first tick that a temperature effect could not be applied- Parameters:
victim- The entity the effect was applied toserverLevel- The server level of the entityconfig- The effect config
-
getCodec
- Returns:
- Returns the codec
-