Record Class Aerodynamics

java.lang.Object
java.lang.Record
net.minestom.server.collision.Aerodynamics
Record Components:
gravity - the entity's downward acceleration per tick
horizontalAirResistance - the horizontal drag coefficient; the entity's current horizontal velocity is multiplied by this every tick
verticalAirResistance - the vertical drag coefficient; the entity's current vertical * velocity is multiplied by this every tick

public record Aerodynamics(double gravity, double horizontalAirResistance, double verticalAirResistance) extends Record
Represents the aerodynamic properties of an entity
  • Constructor Details

    • Aerodynamics

      public Aerodynamics(double gravity, double horizontalAirResistance, double verticalAirResistance)
      Creates an instance of a Aerodynamics record class.
      Parameters:
      gravity - the value for the gravity record component
      horizontalAirResistance - the value for the horizontalAirResistance record component
      verticalAirResistance - the value for the verticalAirResistance record component
  • Method Details

    • withGravity

      @Contract(pure=true) @NotNull public @NotNull Aerodynamics withGravity(double gravity)
    • withHorizontalAirResistance

      @Contract(pure=true) @NotNull public @NotNull Aerodynamics withHorizontalAirResistance(double horizontalAirResistance)
    • withHorizontalAirResistance

      @Contract(pure=true) @NotNull public @NotNull Aerodynamics withHorizontalAirResistance(@NotNull @NotNull it.unimi.dsi.fastutil.doubles.DoubleUnaryOperator operator)
    • withVerticalAirResistance

      @Contract(pure=true) @NotNull public @NotNull Aerodynamics withVerticalAirResistance(double verticalAirResistance)
    • withVerticalAirResistance

      @Contract(pure=true) @NotNull public @NotNull Aerodynamics withVerticalAirResistance(@NotNull @NotNull it.unimi.dsi.fastutil.doubles.DoubleUnaryOperator operator)
    • withAirResistance

      @Contract(pure=true) @NotNull public @NotNull Aerodynamics withAirResistance(double horizontal, double vertical)
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • gravity

      public double gravity()
      Returns the value of the gravity record component.
      Returns:
      the value of the gravity record component
    • horizontalAirResistance

      public double horizontalAirResistance()
      Returns the value of the horizontalAirResistance record component.
      Returns:
      the value of the horizontalAirResistance record component
    • verticalAirResistance

      public double verticalAirResistance()
      Returns the value of the verticalAirResistance record component.
      Returns:
      the value of the verticalAirResistance record component