Record Class PointAttractorForceData
- All Implemented Interfaces:
ParticleModuleData
Point attractor forces are forces that are applied in the direction of a point. They are useful for simulating gravity or other forces that pull particles towards a point. The strength of the force is determined by the strength parameter. The falloff parameter determines how quickly the force falls off with distance. (unused) The strengthByDistance parameter determines whether the strength of the force is multiplied by the distance from the point. If strengthByDistance is true, the strength of the force is multiplied by (1 - distance / range). If strengthByDistance is false, the strength of the force is not affected by distance. The range parameter determines the maximum distance from the point at which the force is applied. If the distance from the point is greater than the range, the force is not applied. The position parameter determines the position of the point. The position parameter can be a Vec3 or a Supplier Vec3. If the position parameter is a Vec3, the position of the point is fixed. If the position parameter is a Supplier Vec3, the position of the point is updated every tick. This allows the point to move.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec
<PointAttractorForceData> Fields inherited from interface foundry.veil.api.quasar.data.module.ParticleModuleData
INIT_CODEC, INIT_DIRECT_CODEC, RENDER_CODEC, RENDER_DIRECT_CODEC, UPDATE_CODEC, UPDATE_DIRECT_CODEC
-
Constructor Summary
ConstructorDescriptionPointAttractorForceData
(org.joml.Vector3dc position, boolean localPosition, float range, float strength, boolean strengthByDistance, boolean invertDistanceModifier) Creates an instance of aPointAttractorForceData
record class. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addModules
(ParticleModuleSet.Builder builder) final boolean
Indicates whether some other object is "equal to" this one.ModuleType
<?> getType()
final int
hashCode()
Returns a hash code value for this object.boolean
Returns the value of theinvertDistanceModifier
record component.boolean
Returns the value of thelocalPosition
record component.org.joml.Vector3dc
position()
Returns the value of theposition
record component.float
range()
Returns the value of therange
record component.float
strength()
Returns the value of thestrength
record component.boolean
Returns the value of thestrengthByDistance
record component.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
CODEC
-
-
Constructor Details
-
PointAttractorForceData
public PointAttractorForceData(org.joml.Vector3dc position, boolean localPosition, float range, float strength, boolean strengthByDistance, boolean invertDistanceModifier) Creates an instance of aPointAttractorForceData
record class.- Parameters:
position
- the value for theposition
record componentlocalPosition
- the value for thelocalPosition
record componentrange
- the value for therange
record componentstrength
- the value for thestrength
record componentstrengthByDistance
- the value for thestrengthByDistance
record componentinvertDistanceModifier
- the value for theinvertDistanceModifier
record component
-
-
Method Details
-
addModules
- Specified by:
addModules
in interfaceParticleModuleData
-
getType
- Specified by:
getType
in interfaceParticleModuleData
-
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 '=='. -
position
public org.joml.Vector3dc position()Returns the value of theposition
record component.- Returns:
- the value of the
position
record component
-
localPosition
public boolean localPosition()Returns the value of thelocalPosition
record component.- Returns:
- the value of the
localPosition
record component
-
range
public float range()Returns the value of therange
record component.- Returns:
- the value of the
range
record component
-
strength
public float strength()Returns the value of thestrength
record component.- Returns:
- the value of the
strength
record component
-
strengthByDistance
public boolean strengthByDistance()Returns the value of thestrengthByDistance
record component.- Returns:
- the value of the
strengthByDistance
record component
-
invertDistanceModifier
public boolean invertDistanceModifier()Returns the value of theinvertDistanceModifier
record component.- Returns:
- the value of the
invertDistanceModifier
record component
-