Record Class RicochetProjectileEffect

java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.effect.projectile.RicochetProjectileEffect
Record Components:
maxBounces - The LevelBasedValue governing the maximum number of block ricochets allowed.
velocityRetention - The LevelBasedValue fraction of speed retained after each bounce (default 0.8).

public record RicochetProjectileEffect(net.minecraft.world.item.enchantment.LevelBasedValue maxBounces, net.minecraft.world.item.enchantment.LevelBasedValue velocityRetention) extends Record
Data-driven projectile enchantment effect component that causes arrows to bounce off solid block surfaces instead of embedding on impact.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.Codec<RicochetProjectileEffect>
    Codec for serializing and deserializing RicochetProjectileEffect 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 the maximum number of bounces.
    static final String
    JSON field key for the post-bounce velocity retention multiplier.
  • Constructor Summary

    Constructors
    Constructor
    Description
    RicochetProjectileEffect(net.minecraft.world.item.enchantment.LevelBasedValue maxBounces, net.minecraft.world.item.enchantment.LevelBasedValue velocityRetention)
    Creates an instance of a RicochetProjectileEffect record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    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 maxBounces record component.
    final String
    Returns a string representation of this record class.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the velocityRetention record component.

    Methods inherited from class Object

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

    • MAX_BOUNCES

      public static final String MAX_BOUNCES
      JSON field key for the maximum number of bounces.
      See Also:
    • VELOCITY_RETENTION

      public static final String VELOCITY_RETENTION
      JSON field key for the post-bounce velocity retention multiplier.
      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<RicochetProjectileEffect> CODEC
      Codec for serializing and deserializing RicochetProjectileEffect instances from JSON.
  • Constructor Details

    • RicochetProjectileEffect

      public RicochetProjectileEffect(net.minecraft.world.item.enchantment.LevelBasedValue maxBounces, net.minecraft.world.item.enchantment.LevelBasedValue velocityRetention)
      Creates an instance of a RicochetProjectileEffect record class.
      Parameters:
      maxBounces - the value for the maxBounces record component
      velocityRetention - the value for the velocityRetention 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. 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.
    • maxBounces

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

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