Record Class ShrapnelProjectileEffect
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.effect.projectile.ShrapnelProjectileEffect
- Record Components:
generations- TheLevelBasedValuenumber of recursive split generations permitted.amount- TheLevelBasedValuenumber of child projectiles spawned per fracture event.spreadDegrees- TheLevelBasedValueinaccuracy cone spread (in degrees) applied to child projectiles.velocityRetention- TheLevelBasedValuemultiplier applied to the parent projectile's speed for each child.damageRetention- TheLevelBasedValuemultiplier 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
FieldsModifier and TypeFieldDescriptionstatic final StringJSON field key for the number of shrapnel projectiles spawned per split.static final com.mojang.serialization.Codec<ShrapnelProjectileEffect> Codec for serializing and deserializingShrapnelProjectileEffectinstances from JSON.static final StringJSON field key for the base damage retention multiplier per generation.static final StringJSON field key for the number of recursive split generations.static final StringRegistry path identifier for this projectile effect component.static final LevelBasedKeyProviderSupplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation.static final StringJSON field key for the angular spread of spawned shrapnel in degrees.static final StringJSON field key for enabling shrapnel on block impact.static final StringJSON field key for enabling shrapnel on entity impact.static final StringJSON field key for the velocity retention multiplier per generation. -
Constructor Summary
ConstructorsConstructorDescriptionShrapnelProjectileEffect(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 aShrapnelProjectileEffectrecord class. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.item.enchantment.LevelBasedValueamount()Returns the value of theamountrecord component.net.minecraft.world.item.enchantment.LevelBasedValueReturns the value of thedamageRetentionrecord component.final booleanIndicates whether some other object is "equal to" this one.net.minecraft.world.item.enchantment.LevelBasedValueReturns the value of thegenerationsrecord component.final inthashCode()Returns a hash code value for this object.net.minecraft.world.item.enchantment.LevelBasedValueReturns the value of thespreadDegreesrecord component.final StringtoString()Returns a string representation of this record class.booleanReturns the value of thetriggerOnBlockrecord component.booleanReturns the value of thetriggerOnEntityrecord component.net.minecraft.world.item.enchantment.LevelBasedValueReturns the value of thevelocityRetentionrecord component.
-
Field Details
-
GENERATIONS
JSON field key for the number of recursive split generations.- See Also:
-
AMOUNT
JSON field key for the number of shrapnel projectiles spawned per split.- See Also:
-
SPREAD_DEGREES
JSON field key for the angular spread of spawned shrapnel in degrees.- See Also:
-
VELOCITY_RETENTION
JSON field key for the velocity retention multiplier per generation.- See Also:
-
DAMAGE_RETENTION
JSON field key for the base damage retention multiplier per generation.- See Also:
-
TRIGGER_ON_BLOCK
JSON field key for enabling shrapnel on block impact.- See Also:
-
TRIGGER_ON_ENTITY
JSON field key for enabling shrapnel on entity impact.- See Also:
-
KEY
Registry path identifier for this projectile effect component.- See Also:
-
KEY_PROVIDER
Supplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
CODEC
Codec for serializing and deserializingShrapnelProjectileEffectinstances 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 aShrapnelProjectileEffectrecord class.- Parameters:
generations- the value for thegenerationsrecord componentamount- the value for theamountrecord componentspreadDegrees- the value for thespreadDegreesrecord componentvelocityRetention- the value for thevelocityRetentionrecord componentdamageRetention- the value for thedamageRetentionrecord componenttriggerOnBlock- the value for thetriggerOnBlockrecord componenttriggerOnEntity- the value for thetriggerOnEntityrecord component
-
-
Method Details
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
generations
public net.minecraft.world.item.enchantment.LevelBasedValue generations()Returns the value of thegenerationsrecord component.- Returns:
- the value of the
generationsrecord component
-
amount
-
spreadDegrees
public net.minecraft.world.item.enchantment.LevelBasedValue spreadDegrees()Returns the value of thespreadDegreesrecord component.- Returns:
- the value of the
spreadDegreesrecord component
-
velocityRetention
public net.minecraft.world.item.enchantment.LevelBasedValue velocityRetention()Returns the value of thevelocityRetentionrecord component.- Returns:
- the value of the
velocityRetentionrecord component
-
damageRetention
public net.minecraft.world.item.enchantment.LevelBasedValue damageRetention()Returns the value of thedamageRetentionrecord component.- Returns:
- the value of the
damageRetentionrecord component
-
triggerOnBlock
public boolean triggerOnBlock()Returns the value of thetriggerOnBlockrecord component.- Returns:
- the value of the
triggerOnBlockrecord component
-
triggerOnEntity
public boolean triggerOnEntity()Returns the value of thetriggerOnEntityrecord component.- Returns:
- the value of the
triggerOnEntityrecord component
-