Record Class ShrapnelProjectileEffect

java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.effect.projectile.ShrapnelProjectileEffect
Record Components:
generations - The LevelBasedValue number of recursive split generations permitted.
amount - The LevelBasedValue number of child projectiles spawned per fracture event.
spreadDegrees - The LevelBasedValue inaccuracy cone spread (in degrees) applied to child projectiles.
velocityRetention - The LevelBasedValue multiplier applied to the parent projectile's speed for each child.
damageRetention - The LevelBasedValue multiplier applied to the parent arrow's base damage for each child.
triggerOnBlock - Whether colliding with a block triggers shrapnel splitting.
triggerOnEntity - Whether colliding with an entity triggers shrapnel splitting.

public record ShrapnelProjectileEffect(net.minecraft.world.item.enchantment.LevelBasedValue generations, net.minecraft.world.item.enchantment.LevelBasedValue amount, net.minecraft.world.item.enchantment.LevelBasedValue spreadDegrees, net.minecraft.world.item.enchantment.LevelBasedValue velocityRetention, net.minecraft.world.item.enchantment.LevelBasedValue damageRetention, boolean triggerOnBlock, boolean triggerOnEntity) extends Record
Data-driven projectile enchantment effect component that fractures a projectile into multiple sub-munition clones upon impacting a block or entity.

On block impact, spawned shrapnel reflects off the hit surface normal; on entity impact, shrapnel prioritizes aiming at nearby secondary living targets before falling back to an even radial ring.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    JSON field key for the number of shrapnel projectiles spawned per split.
    static final com.mojang.serialization.Codec<ShrapnelProjectileEffect>
    Codec for serializing and deserializing ShrapnelProjectileEffect instances from JSON.
    static final String
    JSON field key for the base damage retention multiplier per generation.
    static final String
    JSON field key for the number of recursive split generations.
    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 angular spread of spawned shrapnel in degrees.
    static final String
    JSON field key for enabling shrapnel on block impact.
    static final String
    JSON field key for enabling shrapnel on entity impact.
    static final String
    JSON field key for the velocity retention multiplier per generation.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ShrapnelProjectileEffect(net.minecraft.world.item.enchantment.LevelBasedValue generations, net.minecraft.world.item.enchantment.LevelBasedValue amount, net.minecraft.world.item.enchantment.LevelBasedValue spreadDegrees, net.minecraft.world.item.enchantment.LevelBasedValue velocityRetention, net.minecraft.world.item.enchantment.LevelBasedValue damageRetention, boolean triggerOnBlock, boolean triggerOnEntity)
    Creates an instance of a ShrapnelProjectileEffect record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the amount record component.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the damageRetention record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the generations record component.
    final int
    Returns a hash code value for this object.
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the spreadDegrees record component.
    final String
    Returns a string representation of this record class.
    boolean
    Returns the value of the triggerOnBlock record component.
    boolean
    Returns the value of the triggerOnEntity record component.
    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

    • GENERATIONS

      public static final String GENERATIONS
      JSON field key for the number of recursive split generations.
      See Also:
    • AMOUNT

      public static final String AMOUNT
      JSON field key for the number of shrapnel projectiles spawned per split.
      See Also:
    • SPREAD_DEGREES

      public static final String SPREAD_DEGREES
      JSON field key for the angular spread of spawned shrapnel in degrees.
      See Also:
    • VELOCITY_RETENTION

      public static final String VELOCITY_RETENTION
      JSON field key for the velocity retention multiplier per generation.
      See Also:
    • DAMAGE_RETENTION

      public static final String DAMAGE_RETENTION
      JSON field key for the base damage retention multiplier per generation.
      See Also:
    • TRIGGER_ON_BLOCK

      public static final String TRIGGER_ON_BLOCK
      JSON field key for enabling shrapnel on block impact.
      See Also:
    • TRIGGER_ON_ENTITY

      public static final String TRIGGER_ON_ENTITY
      JSON field key for enabling shrapnel on entity impact.
      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<ShrapnelProjectileEffect> CODEC
      Codec for serializing and deserializing ShrapnelProjectileEffect instances from JSON.
  • Constructor Details

    • ShrapnelProjectileEffect

      public ShrapnelProjectileEffect(net.minecraft.world.item.enchantment.LevelBasedValue generations, net.minecraft.world.item.enchantment.LevelBasedValue amount, net.minecraft.world.item.enchantment.LevelBasedValue spreadDegrees, net.minecraft.world.item.enchantment.LevelBasedValue velocityRetention, net.minecraft.world.item.enchantment.LevelBasedValue damageRetention, boolean triggerOnBlock, boolean triggerOnEntity)
      Creates an instance of a ShrapnelProjectileEffect record class.
      Parameters:
      generations - the value for the generations record component
      amount - the value for the amount record component
      spreadDegrees - the value for the spreadDegrees record component
      velocityRetention - the value for the velocityRetention record component
      damageRetention - the value for the damageRetention record component
      triggerOnBlock - the value for the triggerOnBlock record component
      triggerOnEntity - the value for the triggerOnEntity 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.
    • generations

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

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

      public net.minecraft.world.item.enchantment.LevelBasedValue spreadDegrees()
      Returns the value of the spreadDegrees record component.
      Returns:
      the value of the spreadDegrees 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
    • damageRetention

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

      public boolean triggerOnBlock()
      Returns the value of the triggerOnBlock record component.
      Returns:
      the value of the triggerOnBlock record component
    • triggerOnEntity

      public boolean triggerOnEntity()
      Returns the value of the triggerOnEntity record component.
      Returns:
      the value of the triggerOnEntity record component