Record Class MagneticProjectileEffect
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.effect.projectile.MagneticProjectileEffect
- Record Components:
pullStrength- TheLevelBasedValuegoverning 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- TheLevelBasedValueminimum distance (in blocks) the projectile must travel before magnetism activates.searchRadius- TheLevelBasedValueradius (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
FieldsModifier and TypeFieldDescriptionstatic final StringJSON field key for the minimum arming distance in blocks.static final com.mojang.serialization.Codec<MagneticProjectileEffect> Codec for serializing and deserializingMagneticProjectileEffectinstances 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 prioritizing target eye height.static final StringJSON field key for the magnetic pull strength.static final StringJSON field key for the radial target search distance in blocks. -
Constructor Summary
ConstructorsConstructorDescriptionMagneticProjectileEffect(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 aMagneticProjectileEffectrecord class. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.item.enchantment.LevelBasedValueReturns the value of thearmingDistancerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanReturns the value of theprioritizeHeadrecord component.net.minecraft.world.item.enchantment.LevelBasedValueReturns the value of thepullStrengthrecord component.net.minecraft.world.item.enchantment.LevelBasedValueReturns the value of thesearchRadiusrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
PULL_STRENGTH
JSON field key for the magnetic pull strength.- See Also:
-
PRIORITIZE_HEAD
JSON field key for prioritizing target eye height.- See Also:
-
ARMING_DISTANCE
JSON field key for the minimum arming distance in blocks.- See Also:
-
SEARCH_RADIUS
JSON field key for the radial target search distance in blocks.- 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 deserializingMagneticProjectileEffectinstances 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 aMagneticProjectileEffectrecord class.- Parameters:
pullStrength- the value for thepullStrengthrecord componentprioritizeHead- the value for theprioritizeHeadrecord componentarmingDistance- the value for thearmingDistancerecord componentsearchRadius- the value for thesearchRadiusrecord component
-
-
Method Details
-
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. -
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. -
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 '=='. -
pullStrength
public net.minecraft.world.item.enchantment.LevelBasedValue pullStrength()Returns the value of thepullStrengthrecord component.- Returns:
- the value of the
pullStrengthrecord component
-
prioritizeHead
public boolean prioritizeHead()Returns the value of theprioritizeHeadrecord component.- Returns:
- the value of the
prioritizeHeadrecord component
-
armingDistance
public net.minecraft.world.item.enchantment.LevelBasedValue armingDistance()Returns the value of thearmingDistancerecord component.- Returns:
- the value of the
armingDistancerecord component
-
searchRadius
public net.minecraft.world.item.enchantment.LevelBasedValue searchRadius()Returns the value of thesearchRadiusrecord component.- Returns:
- the value of the
searchRadiusrecord component
-