Record Class RicochetProjectileEffect
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.effect.projectile.RicochetProjectileEffect
- Record Components:
maxBounces- TheLevelBasedValuegoverning the maximum number of block ricochets allowed.velocityRetention- TheLevelBasedValuefraction of speed retained after each bounce (default0.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
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<RicochetProjectileEffect> Codec for serializing and deserializingRicochetProjectileEffectinstances from JSON.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 maximum number of bounces.static final StringJSON field key for the post-bounce velocity retention multiplier. -
Constructor Summary
ConstructorsConstructorDescriptionRicochetProjectileEffect(net.minecraft.world.item.enchantment.LevelBasedValue maxBounces, net.minecraft.world.item.enchantment.LevelBasedValue velocityRetention) Creates an instance of aRicochetProjectileEffectrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.net.minecraft.world.item.enchantment.LevelBasedValueReturns the value of themaxBouncesrecord component.final StringtoString()Returns a string representation of this record class.net.minecraft.world.item.enchantment.LevelBasedValueReturns the value of thevelocityRetentionrecord component.
-
Field Details
-
MAX_BOUNCES
-
VELOCITY_RETENTION
JSON field key for the post-bounce velocity retention multiplier.- 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 deserializingRicochetProjectileEffectinstances 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 aRicochetProjectileEffectrecord class.- Parameters:
maxBounces- the value for themaxBouncesrecord componentvelocityRetention- the value for thevelocityRetentionrecord 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. All components in this record class are compared withObjects::equals(Object,Object). -
maxBounces
public net.minecraft.world.item.enchantment.LevelBasedValue maxBounces()Returns the value of themaxBouncesrecord component.- Returns:
- the value of the
maxBouncesrecord component
-
velocityRetention
public net.minecraft.world.item.enchantment.LevelBasedValue velocityRetention()Returns the value of thevelocityRetentionrecord component.- Returns:
- the value of the
velocityRetentionrecord component
-