Record Class ExtinguishEffect

java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.spellfield.effect.entity.ExtinguishEffect
Record Components:
tickReduction - The LevelBasedValue number of fire ticks subtracted before topological scaling.
entityFilter - Optional LootItemCondition restricting which entities are extinguished.
All Implemented Interfaces:
SpellFieldEffect, SpellFieldEntityEffect

public record ExtinguishEffect(net.minecraft.world.item.enchantment.LevelBasedValue tickReduction, Optional<net.minecraft.core.Holder<net.minecraft.world.level.storage.loot.predicates.LootItemCondition>> entityFilter) extends Record implements SpellFieldEntityEffect
A SpellFieldEntityEffect that reduces the remaining burn duration (Entity.getRemainingFireTicks()) of burning entities within a spell field volume, scaled by each target's local topological multiplier.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.MapCodec<ExtinguishEffect>
    MapCodec for serializing and deserializing ExtinguishEffect instances from JSON.
    static final String
    JSON field key for the optional entity filter predicate.
    static final String
    Registry path identifier for this spell field entity effect.
    Supplies the JSON property keys holding LevelBasedValue definitions for data transformation.
    static final String
    JSON field key for the fire tick reduction amount.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ExtinguishEffect(net.minecraft.world.item.enchantment.LevelBasedValue tickReduction)
    Constructs an unfiltered ExtinguishEffect.
    ExtinguishEffect(net.minecraft.world.item.enchantment.LevelBasedValue tickReduction, Optional<net.minecraft.core.Holder<net.minecraft.world.level.storage.loot.predicates.LootItemCondition>> entityFilter)
    Creates an instance of a ExtinguishEffect record class.
    ExtinguishEffect(net.minecraft.world.item.enchantment.LevelBasedValue tickReduction, net.minecraft.core.Holder<net.minecraft.world.level.storage.loot.predicates.LootItemCondition> entityFilter)
    Constructs an ExtinguishEffect restricted by the given entity predicate filter.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    apply(net.minecraft.server.level.ServerLevel level, int enchantmentLevel, net.minecraft.world.item.enchantment.EnchantedItemInUse context, net.minecraft.world.entity.Entity spatialReference, net.minecraft.world.phys.Vec3 epicenter, net.minecraft.world.entity.Entity victim, float volumeScalar)
    Subtracts $\text{tickReduction} \cdot \text{volumeScalar}$ from victim's remaining fire ticks (clamped to a minimum of 0) if the entity is currently burning.
    com.mojang.serialization.MapCodec<? extends SpellFieldEntityEffect>
    Retrieves the MapCodec responsible for serializing and deserializing this effect.
    Optional<net.minecraft.core.Holder<net.minecraft.world.level.storage.loot.predicates.LootItemCondition>>
    Returns the value of the entityFilter record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the tickReduction record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • TICK_REDUCTION

      public static final String TICK_REDUCTION
      JSON field key for the fire tick reduction amount.
      See Also:
    • ENTITY_FILTER

      public static final String ENTITY_FILTER
      JSON field key for the optional entity filter predicate.
      See Also:
    • KEY

      public static final String KEY
      Registry path identifier for this spell field entity effect.
      See Also:
    • KEY_PROVIDER

      public static final LevelBasedKeyProvider KEY_PROVIDER
      Supplies the JSON property keys holding LevelBasedValue definitions for data transformation.
    • CODEC

      public static final com.mojang.serialization.MapCodec<ExtinguishEffect> CODEC
      MapCodec for serializing and deserializing ExtinguishEffect instances from JSON.
  • Constructor Details

    • ExtinguishEffect

      public ExtinguishEffect(net.minecraft.world.item.enchantment.LevelBasedValue tickReduction)
      Constructs an unfiltered ExtinguishEffect.
      Parameters:
      tickReduction - The LevelBasedValue fire tick reduction amount.
    • ExtinguishEffect

      public ExtinguishEffect(net.minecraft.world.item.enchantment.LevelBasedValue tickReduction, net.minecraft.core.Holder<net.minecraft.world.level.storage.loot.predicates.LootItemCondition> entityFilter)
      Constructs an ExtinguishEffect restricted by the given entity predicate filter.
      Parameters:
      tickReduction - The LevelBasedValue fire tick reduction amount.
      entityFilter - The predicate filter to match against candidate entities.
    • ExtinguishEffect

      public ExtinguishEffect(net.minecraft.world.item.enchantment.LevelBasedValue tickReduction, Optional<net.minecraft.core.Holder<net.minecraft.world.level.storage.loot.predicates.LootItemCondition>> entityFilter)
      Creates an instance of a ExtinguishEffect record class.
      Parameters:
      tickReduction - the value for the tickReduction record component
      entityFilter - the value for the entityFilter record component
  • Method Details

    • apply

      public void apply(net.minecraft.server.level.ServerLevel level, int enchantmentLevel, net.minecraft.world.item.enchantment.EnchantedItemInUse context, net.minecraft.world.entity.Entity spatialReference, net.minecraft.world.phys.Vec3 epicenter, net.minecraft.world.entity.Entity victim, float volumeScalar)
      Subtracts $\text{tickReduction} \cdot \text{volumeScalar}$ from victim's remaining fire ticks (clamped to a minimum of 0) if the entity is currently burning.
      Specified by:
      apply in interface SpellFieldEntityEffect
      Parameters:
      level - The executing server level.
      enchantmentLevel - The active level of the spell field enchantment.
      context - The item usage context triggering the spell field.
      spatialReference - The anchor entity or focal point of the spell field.
      epicenter - The exact spatial origin vector of the spell field.
      victim - The target entity intersecting the spell field.
      volumeScalar - The active topological multiplier for victim.
    • codec

      public com.mojang.serialization.MapCodec<? extends SpellFieldEntityEffect> codec()
      Description copied from interface: SpellFieldEffect
      Retrieves the MapCodec responsible for serializing and deserializing this effect.
      Specified by:
      codec in interface SpellFieldEffect
      Returns:
      The registered MapCodec instance.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • tickReduction

      public net.minecraft.world.item.enchantment.LevelBasedValue tickReduction()
      Returns the value of the tickReduction record component.
      Returns:
      the value of the tickReduction record component
    • entityFilter

      public Optional<net.minecraft.core.Holder<net.minecraft.world.level.storage.loot.predicates.LootItemCondition>> entityFilter()
      Returns the value of the entityFilter record component.
      Returns:
      the value of the entityFilter record component