Record Class SetFireDurationEffect

java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.effect.SetFireDurationEffect
Record Components:
duration - The LevelBasedValue specifying the fire duration in seconds.
All Implemented Interfaces:
net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect, net.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect

public record SetFireDurationEffect(net.minecraft.world.item.enchantment.LevelBasedValue duration) extends Record implements net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect
An EnchantmentEntityEffect that assigns a custom burn duration (in seconds) to an entity implementing FireDurationAccessor.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.MapCodec<SetFireDurationEffect>
    MapCodec for serializing and deserializing SetFireDurationEffect instances from JSON.
    static final String
    JSON field key for the fire duration in seconds.
    static final String
    Registry path identifier for this entity effect.
    Supplies the JSON property keys holding LevelBasedValue definitions for data transformation.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SetFireDurationEffect(net.minecraft.world.item.enchantment.LevelBasedValue duration)
    Creates an instance of a SetFireDurationEffect record class.
  • 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 entity, net.minecraft.world.phys.Vec3 origin)
    Assigns the evaluated fire duration in seconds to entity if it implements FireDurationAccessor.
    com.mojang.serialization.MapCodec<? extends net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect>
     
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the duration record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect

    onChangedBlock

    Methods inherited from interface net.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect

    onDeactivated
  • Field Details

    • DURATION

      public static final String DURATION
      JSON field key for the fire duration in seconds.
      See Also:
    • KEY

      public static final String KEY
      Registry path identifier for this 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<SetFireDurationEffect> CODEC
      MapCodec for serializing and deserializing SetFireDurationEffect instances from JSON.
  • Constructor Details

    • SetFireDurationEffect

      public SetFireDurationEffect(net.minecraft.world.item.enchantment.LevelBasedValue duration)
      Creates an instance of a SetFireDurationEffect record class.
      Parameters:
      duration - the value for the duration 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 entity, net.minecraft.world.phys.Vec3 origin)
      Assigns the evaluated fire duration in seconds to entity if it implements FireDurationAccessor.
      Specified by:
      apply in interface net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect
      Parameters:
      level - The server level in which the effect is triggered.
      enchantmentLevel - The level of the source enchantment.
      context - The context of the enchanted item in use.
      entity - The target entity receiving the fire duration state.
      origin - The origin position vector of the trigger.
    • codec

      public com.mojang.serialization.MapCodec<? extends net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect> codec()
      Specified by:
      codec in interface net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect
      Specified by:
      codec in interface net.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect
    • 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.
    • duration

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