Class StandardPhysicsConfig

java.lang.Object
com.hypixel.hytale.server.core.modules.projectile.config.StandardPhysicsConfig
All Implemented Interfaces:
NetworkSerializable<PhysicsConfig>, PhysicsConfig
Direct Known Subclasses:
GroundFollowPhysicsConfig

public class StandardPhysicsConfig extends Object implements PhysicsConfig
A standard implementation of PhysicsConfig that defines common physics properties for projectiles.
  • Field Details

  • Constructor Details

    • StandardPhysicsConfig

      public StandardPhysicsConfig()
  • Method Details

    • getGravity

      public double getGravity()
      Description copied from interface: PhysicsConfig
      Returns the gravitational acceleration for this physics configuration. Used for NPC ballistic aiming calculations.
      Specified by:
      getGravity in interface PhysicsConfig
      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: PhysicsConfig
      Called to apply the physics to the given entity store holder.
      Specified by:
      apply in interface PhysicsConfig
      Parameters:
      holder - The entity holder of the projectile.
      creatorRef - The entity reference of the instigating entity.
      velocity - The initial velocity of the projectile.
      componentAccessor - The ComponentAccessor<EntityStore> for component access.
      predicted - Whether the physics is being applied in a predicted context.
    • toPacket

      @Nonnull public PhysicsConfig toPacket()
      Specified by:
      toPacket in interface NetworkSerializable<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:
      true if the projectile sticks vertically upon landing; false otherwise.
    • isAllowRolling

      public boolean isAllowRolling()
      Returns:
      true if yaw rotation is computed based on velocity; false otherwise.
    • 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.