Class AttributeModifierEffect

java.lang.Object
com.github.thedeathlycow.thermoo.api.temperature.status.v2.effect.AttributeModifierEffect
All Implemented Interfaces:
TemperatureEffect

public final class AttributeModifierEffect extends Object implements 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

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.MapCodec<AttributeModifierEffect>
     

    Fields inherited from interface TemperatureEffect

    DIRECT_CODEC
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    apply(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 modified
    com.mojang.serialization.MapCodec<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.
    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.
    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.
    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.
    net.minecraft.resources.Identifier
    id()
    The ID of the attribute modifier.
    net.minecraft.world.entity.ai.attributes.AttributeModifier.Operation
    The operation of the modifier.
    void
    remove(net.minecraft.world.entity.LivingEntity target, TemperatureEffectContext context)
    Removes the attribute modifier from the target.
    boolean
    Whether the modifier value applied by this effect is scaled with the target's temperature.
    double
    The value of the modifier.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • 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 of attribute, id, or operation are null
      IllegalArgumentException - if value is 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 of attribute, modifier, or any of the modifier's fields are null
      IllegalArgumentException - if the modifier'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 of attribute, id, or operation are null
      IllegalArgumentException - if value is 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:
      apply in interface TemperatureEffect
      Parameters:
      target - The entity receiving the effect.
      context - Additional context for the effect.
      Returns:
      Returns true if the attribute modifier should not be removed, false otherwise.
    • remove

      public void remove(net.minecraft.world.entity.LivingEntity target, TemperatureEffectContext context)
      Removes the attribute modifier from the target.
      Specified by:
      remove in interface TemperatureEffect
      Parameters:
      target - The entity the effect is being removed from.
      context - Additional context for the effect.
    • codec

      public com.mojang.serialization.MapCodec<AttributeModifierEffect> codec()
      Specified by:
      codec in interface TemperatureEffect
      Returns:
      Returns CODEC.
    • value

      public double value()
      The value of the modifier. If this modifier is scaled then 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.