Record Class MagneticProjectileEffect

java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.effect.projectile.MagneticProjectileEffect
Record Components:
pullStrength - The LevelBasedValue governing the strength of the trajectory attraction toward the target.
prioritizeHead - Whether magnetic attraction targets the entity's eye position rather than its center of mass.
armingDistance - The LevelBasedValue minimum distance (in blocks) the projectile must travel before magnetism activates.
searchRadius - The LevelBasedValue radius (in blocks) searched around the projectile for candidate targets.

public record MagneticProjectileEffect(net.minecraft.world.item.enchantment.LevelBasedValue pullStrength, boolean prioritizeHead, net.minecraft.world.item.enchantment.LevelBasedValue armingDistance, net.minecraft.world.item.enchantment.LevelBasedValue searchRadius) extends Record
Data-driven projectile enchantment effect component that curves a projectile's flight trajectory directly toward the nearest living entity within a radial search area, without FOV or turn-rate constraints.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    JSON field key for the minimum arming distance in blocks.
    static final com.mojang.serialization.Codec<MagneticProjectileEffect>
    Codec for serializing and deserializing MagneticProjectileEffect instances from JSON.
    static final String
    Registry path identifier for this projectile effect component.
    Supplies the JSON property keys holding LevelBasedValue definitions for data transformation.
    static final String
    JSON field key for prioritizing target eye height.
    static final String
    JSON field key for the magnetic pull strength.
    static final String
    JSON field key for the radial target search distance in blocks.
  • Constructor Summary

    Constructors
    Constructor
    Description
    MagneticProjectileEffect(net.minecraft.world.item.enchantment.LevelBasedValue pullStrength, boolean prioritizeHead, net.minecraft.world.item.enchantment.LevelBasedValue armingDistance, net.minecraft.world.item.enchantment.LevelBasedValue searchRadius)
    Creates an instance of a MagneticProjectileEffect record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the armingDistance record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    Returns the value of the prioritizeHead record component.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the pullStrength record component.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the searchRadius 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

    • PULL_STRENGTH

      public static final String PULL_STRENGTH
      JSON field key for the magnetic pull strength.
      See Also:
    • PRIORITIZE_HEAD

      public static final String PRIORITIZE_HEAD
      JSON field key for prioritizing target eye height.
      See Also:
    • ARMING_DISTANCE

      public static final String ARMING_DISTANCE
      JSON field key for the minimum arming distance in blocks.
      See Also:
    • SEARCH_RADIUS

      public static final String SEARCH_RADIUS
      JSON field key for the radial target search distance in blocks.
      See Also:
    • KEY

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

    • MagneticProjectileEffect

      public MagneticProjectileEffect(net.minecraft.world.item.enchantment.LevelBasedValue pullStrength, boolean prioritizeHead, net.minecraft.world.item.enchantment.LevelBasedValue armingDistance, net.minecraft.world.item.enchantment.LevelBasedValue searchRadius)
      Creates an instance of a MagneticProjectileEffect record class.
      Parameters:
      pullStrength - the value for the pullStrength record component
      prioritizeHead - the value for the prioritizeHead record component
      armingDistance - the value for the armingDistance record component
      searchRadius - the value for the searchRadius record component
  • Method Details

    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • pullStrength

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

      public boolean prioritizeHead()
      Returns the value of the prioritizeHead record component.
      Returns:
      the value of the prioritizeHead record component
    • armingDistance

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

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