Contents
Interface PhysicsConfig
- All Superinterfaces:
NetworkSerializable<PhysicsConfig>
- All Known Implementing Classes:
GroundFollowPhysicsConfig, StandardPhysicsConfig
A configuration defining the physics behavior of a projectile.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CodecMapCodec<PhysicsConfig> The codec used to parsePhysicsConfiginstances -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(Holder<EntityStore> holder, Ref<EntityStore> creatorRef, org.joml.Vector3d velocity, ComponentAccessor<EntityStore> componentAccessor, boolean predicted) Called to apply the physics to the given entity store holder.default doubleReturns the gravitational acceleration for this physics configuration.Methods inherited from interface NetworkSerializable
toPacket
-
Field Details
-
CODEC
The codec used to parsePhysicsConfiginstances
-
-
Method Details
-
apply
void apply(@Nonnull Holder<EntityStore> holder, @Nullable Ref<EntityStore> creatorRef, @Nonnull org.joml.Vector3d velocity, @Nonnull ComponentAccessor<EntityStore> componentAccessor, boolean predicted) Called to apply the physics to the given entity store holder.- Parameters:
holder- The entity holder of the projectile.creatorRef- The entity reference of the instigating entity.velocity- The initial velocity of the projectile.componentAccessor- TheComponentAccessor<EntityStore>for component access.predicted- Whether the physics is being applied in a predicted context.
-
getGravity
default double getGravity()Returns the gravitational acceleration for this physics configuration. Used for NPC ballistic aiming calculations.- Returns:
- the gravity in blocks/second², or 0 if gravity is not applicable.
-