Class DamageEffect
java.lang.Object
com.github.thedeathlycow.thermoo.api.temperature.status.v2.effect.DamageEffect
- All Implemented Interfaces:
TemperatureEffect
Applies damage to
LivingEntitys.
The type and amount of damage can be configured, as well as the damage type. However, the DamageSource
applied only stores the type - the direct source entity, attacker, and position are all null.
-
Field Summary
FieldsFields inherited from interface TemperatureEffect
DIRECT_CODEC -
Method Summary
Modifier and TypeMethodDescriptionfloatamount()The amount of damage inflicted by the effect.booleanapply(net.minecraft.world.entity.LivingEntity target, TemperatureEffectContext context) Hurts the target.com.mojang.serialization.MapCodec<DamageEffect> codec()static DamageEffectcreate(float amount, net.minecraft.resources.ResourceKey<net.minecraft.world.damagesource.DamageType> damageType) Creates a new damage effect for data generation.net.minecraft.resources.ResourceKey<net.minecraft.world.damagesource.DamageType> The damage type of the effect.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface TemperatureEffect
remove
-
Field Details
-
CODEC
-
-
Method Details
-
create
public static DamageEffect create(float amount, net.minecraft.resources.ResourceKey<net.minecraft.world.damagesource.DamageType> damageType) Creates a new damage effect for data generation.- Parameters:
amount- A non-negative finite float.damageType- The damage type key.- Throws:
IllegalArgumentException- if theamountis negative, infinite, or NaN.NullPointerException- if thedamageTypeisnull.
-
apply
public boolean apply(net.minecraft.world.entity.LivingEntity target, TemperatureEffectContext context) Hurts the target.- Specified by:
applyin interfaceTemperatureEffect- Parameters:
target- The entity receiving the effect.context- Additional context for the effect.- Returns:
- Returns
trueif executed on the logical server AND the target was successfully hurt.
-
codec
- Specified by:
codecin interfaceTemperatureEffect- Returns:
- Returns
CODEC
-
amount
public float amount()The amount of damage inflicted by the effect.- Returns:
- Returns a float that is finite and non-negative.
-
damageType
public net.minecraft.resources.ResourceKey<net.minecraft.world.damagesource.DamageType> damageType()The damage type of the effect.
-