Contents
Class StandardPhysicsConfig
java.lang.Object
com.hypixel.hytale.server.core.modules.projectile.config.StandardPhysicsConfig
- All Implemented Interfaces:
NetworkSerializable<PhysicsConfig>, PhysicsConfig
- Direct Known Subclasses:
GroundFollowPhysicsConfig
A standard implementation of
PhysicsConfig that defines common physics properties for projectiles.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BuilderCodec<StandardPhysicsConfig> The codec used to parseStandardPhysicsConfiginstancesstatic final StandardPhysicsConfigThe default standard physics configuration -
Constructor Summary
Constructors -
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.intdoubledoubledoubleReturns the gravitational acceleration for this physics configuration.doubledoubledoublebooleanbooleantoPacket()
-
Field Details
-
CODEC
The codec used to parseStandardPhysicsConfiginstances -
DEFAULT
The default standard physics configuration
-
-
Constructor Details
-
StandardPhysicsConfig
public StandardPhysicsConfig()
-
-
Method Details
-
getGravity
public double getGravity()Description copied from interface:PhysicsConfigReturns the gravitational acceleration for this physics configuration. Used for NPC ballistic aiming calculations.- Specified by:
getGravityin interfacePhysicsConfig- Returns:
- the gravity in blocks/second², or 0 if gravity is not applicable.
-
apply
public void apply(@Nonnull Holder<EntityStore> holder, @Nullable Ref<EntityStore> creatorRef, @Nonnull org.joml.Vector3d velocity, @Nonnull ComponentAccessor<EntityStore> componentAccessor, boolean predicted) Description copied from interface:PhysicsConfigCalled to apply the physics to the given entity store holder.- Specified by:
applyin interfacePhysicsConfig- 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.
-
toPacket
- Specified by:
toPacketin interfaceNetworkSerializable<PhysicsConfig>
-
getBounciness
public double getBounciness()- Returns:
- the density of the projectile in kg/m^3.
-
getBounceCount
public int getBounceCount()- Returns:
- the number of bounces the projectile can make before coming to rest.
-
getBounceLimit
public double getBounceLimit()- Returns:
- the minimum velocity threshold below which the projectile will stop bouncing.
-
isSticksVertically
public boolean isSticksVertically()- Returns:
trueif the projectile sticks vertically upon landing;falseotherwise.
-
isAllowRolling
public boolean isAllowRolling()- Returns:
trueif yaw rotation is computed based on velocity;falseotherwise.
-
getRollingFrictionFactor
public double getRollingFrictionFactor()- Returns:
- the friction factor applied during rolling.
-
getSwimmingDampingFactor
public double getSwimmingDampingFactor()- Returns:
- the speed at which the projectile rolls.
-
getHitWaterImpulseLoss
public double getHitWaterImpulseLoss()- Returns:
- the impulse loss factor when the projectile hits water.
-