Class NukkitMath

java.lang.Object
org.cloudburstmc.server.math.NukkitMath

public class NukkitMath extends Object
author: MagicDroidX Nukkit Project
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    ceilDouble​(double n)
     
    static int
    ceilFloat​(float n)
     
    static double
    clamp​(double value, double min, double max)
     
    static int
    clamp​(int value, int min, int max)
     
    static int
    floorDouble​(double n)
     
    static int
    floorFloat​(float n)
     
    static double
    getDirection​(double diffX, double diffZ)
     
    static com.nukkitx.math.vector.Vector3f
    getIntermediateWithXValue​(com.nukkitx.math.vector.Vector3f v, com.nukkitx.math.vector.Vector3f v2, float x)
    Returns a new vector with x value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.
    static com.nukkitx.math.vector.Vector3f
    getIntermediateWithYValue​(com.nukkitx.math.vector.Vector3f v, com.nukkitx.math.vector.Vector3f v2, float y)
    Returns a new vector with y value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.
    static com.nukkitx.math.vector.Vector3f
    getIntermediateWithZValue​(com.nukkitx.math.vector.Vector3f v, com.nukkitx.math.vector.Vector3f v2, float z)
    Returns a new vector with z value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.
    static double
    round​(double d)
     
    static double
    round​(double d, int precision)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • NukkitMath

      public NukkitMath()
  • Method Details

    • floorDouble

      public static int floorDouble(double n)
    • ceilDouble

      public static int ceilDouble(double n)
    • floorFloat

      public static int floorFloat(float n)
    • ceilFloat

      public static int ceilFloat(float n)
    • round

      public static double round(double d)
    • round

      public static double round(double d, int precision)
    • clamp

      public static double clamp(double value, double min, double max)
    • clamp

      public static int clamp(int value, int min, int max)
    • getDirection

      public static double getDirection(double diffX, double diffZ)
    • getIntermediateWithXValue

      public static com.nukkitx.math.vector.Vector3f getIntermediateWithXValue(com.nukkitx.math.vector.Vector3f v, com.nukkitx.math.vector.Vector3f v2, float x)
      Returns a new vector with x value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.
      Parameters:
      v2 - vector
      x - x value
      Returns:
      intermediate vector
    • getIntermediateWithYValue

      public static com.nukkitx.math.vector.Vector3f getIntermediateWithYValue(com.nukkitx.math.vector.Vector3f v, com.nukkitx.math.vector.Vector3f v2, float y)
      Returns a new vector with y value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.
      Parameters:
      v2 - vector
      y - y value
      Returns:
      intermediate vector
    • getIntermediateWithZValue

      public static com.nukkitx.math.vector.Vector3f getIntermediateWithZValue(com.nukkitx.math.vector.Vector3f v, com.nukkitx.math.vector.Vector3f v2, float z)
      Returns a new vector with z value equal to the second parameter, along the line between this vector and the passed in vector, or null if not possible.
      Parameters:
      v2 - vector
      z - z value
      Returns:
      intermediate vector