Class AttributeModifierEffect
java.lang.Object
com.github.thedeathlycow.thermoo.api.temperature.status.v2.effect.AttributeModifierEffect
- All Implemented Interfaces:
TemperatureEffect
A temperature effect that applies an attribute modifier to a victim.
Includes options to increase the modifier in strength with respect to the target's current temperature scale.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<AttributeModifierEffect> Fields inherited from interface TemperatureEffect
DIRECT_CODEC -
Method Summary
Modifier and TypeMethodDescriptionbooleanapply(net.minecraft.world.entity.LivingEntity target, TemperatureEffectContext context) Applies an attribute modifier to the target.net.minecraft.core.Holder<net.minecraft.world.entity.ai.attributes.Attribute> The attribute to be modifiedcom.mojang.serialization.MapCodec<AttributeModifierEffect> codec()static AttributeModifierEffectcreate(net.minecraft.core.Holder<net.minecraft.world.entity.ai.attributes.Attribute> attribute, double value, net.minecraft.resources.Identifier id, net.minecraft.world.entity.ai.attributes.AttributeModifier.Operation operation) Creates a new modifier effect for data generation.static AttributeModifierEffectcreate(net.minecraft.core.Holder<net.minecraft.world.entity.ai.attributes.Attribute> attribute, net.minecraft.world.entity.ai.attributes.AttributeModifier modifier) Uses an existing attribute modifier to create a new effect for data generation.static AttributeModifierEffectcreateScaled(net.minecraft.core.Holder<net.minecraft.world.entity.ai.attributes.Attribute> attribute, double value, net.minecraft.resources.Identifier id, net.minecraft.world.entity.ai.attributes.AttributeModifier.Operation operation) Creates a new modifier effect for data generation.static AttributeModifierEffectcreateScaled(net.minecraft.core.Holder<net.minecraft.world.entity.ai.attributes.Attribute> attribute, net.minecraft.world.entity.ai.attributes.AttributeModifier modifier) Uses an existing attribute modifier to create a new effect for data generation.net.minecraft.resources.Identifierid()The ID of the attribute modifier.net.minecraft.world.entity.ai.attributes.AttributeModifier.OperationThe operation of the modifier.voidremove(net.minecraft.world.entity.LivingEntity target, TemperatureEffectContext context) Removes the attribute modifier from the target.booleanWhether the modifier value applied by this effect is scaled with the target's temperature.doublevalue()The value of the modifier.
-
Field Details
-
CODEC
-
-
Method Details
-
create
public static AttributeModifierEffect create(net.minecraft.core.Holder<net.minecraft.world.entity.ai.attributes.Attribute> attribute, double value, net.minecraft.resources.Identifier id, net.minecraft.world.entity.ai.attributes.AttributeModifier.Operation operation) Creates a new modifier effect for data generation. The returned effect is unscaled; the value it applies is fixed.- Throws:
NullPointerException- if any ofattribute,id, oroperationarenullIllegalArgumentException- ifvalueis infinite or NaN
-
create
public static AttributeModifierEffect create(net.minecraft.core.Holder<net.minecraft.world.entity.ai.attributes.Attribute> attribute, net.minecraft.world.entity.ai.attributes.AttributeModifier modifier) Uses an existing attribute modifier to create a new effect for data generation.- Throws:
NullPointerException- if any ofattribute,modifier, or any of themodifier's fields arenullIllegalArgumentException- if themodifier's amount is infinite or NaN
-
createScaled
public static AttributeModifierEffect createScaled(net.minecraft.core.Holder<net.minecraft.world.entity.ai.attributes.Attribute> attribute, double value, net.minecraft.resources.Identifier id, net.minecraft.world.entity.ai.attributes.AttributeModifier.Operation operation) Creates a new modifier effect for data generation. The returned effect will scale its value with a target's temperature scale.- Throws:
NullPointerException- if any ofattribute,id, oroperationarenullIllegalArgumentException- ifvalueis infinite or NaN
-
createScaled
public static AttributeModifierEffect createScaled(net.minecraft.core.Holder<net.minecraft.world.entity.ai.attributes.Attribute> attribute, net.minecraft.world.entity.ai.attributes.AttributeModifier modifier) Uses an existing attribute modifier to create a new effect for data generation. The returned effect will scale its value with a target's temperature scale. -
apply
public boolean apply(net.minecraft.world.entity.LivingEntity target, TemperatureEffectContext context) Applies an attribute modifier to the target.- Specified by:
applyin interfaceTemperatureEffect- Parameters:
target- The entity receiving the effect.context- Additional context for the effect.- Returns:
- Returns
trueif the attribute modifier should not be removed,falseotherwise.
-
remove
public void remove(net.minecraft.world.entity.LivingEntity target, TemperatureEffectContext context) Removes the attribute modifier from the target.- Specified by:
removein interfaceTemperatureEffect- Parameters:
target- The entity the effect is being removed from.context- Additional context for the effect.
-
codec
- Specified by:
codecin interfaceTemperatureEffect- Returns:
- Returns
CODEC.
-
value
public double value()The value of the modifier. If this modifier isscaledthen this is the value at +100% temperature scale.- Returns:
- Returns a finite double
-
attribute
public net.minecraft.core.Holder<net.minecraft.world.entity.ai.attributes.Attribute> attribute()The attribute to be modified -
id
public net.minecraft.resources.Identifier id()The ID of the attribute modifier. -
operation
public net.minecraft.world.entity.ai.attributes.AttributeModifier.Operation operation()The operation of the modifier. -
scaleWithTemperature
public boolean scaleWithTemperature()Whether the modifier value applied by this effect is scaled with the target's temperature.
-