Klasse MathUtil

java.lang.Object
info.u_team.u_team_core.util.MathUtil

public class MathUtil extends Object
Utility methods for math
  • Verschachtelte Klassen - Übersicht

    Verschachtelte Klassen
    Modifizierer und Typ
    Klasse
    Beschreibung
    static final record 
    Wrapper around the RandomSource for normal Random instances
  • Feldübersicht

    Felder
    Modifizierer und Typ
    Feld
    Beschreibung
    static final net.minecraft.util.RandomSource
    Static random instance if random numbers without specific seed are desired.
  • Konstruktorübersicht

    Konstruktoren
    Konstruktor
    Beschreibung
     
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    static float
    getPlaneDistance(int x1, int z1, int x2, int z2)
    Returns the distance between x1, z1 and x2, z2
    static double
    randomNumberInRange(double min, double max)
    Returns a pseudo random number in range of min and max (inclusive).
    static float
    randomNumberInRange(float min, float max)
    Returns a pseudo random number in range of min and max (inclusive).
    static int
    randomNumberInRange(int min, int max)
    Returns a pseudo random number in range of min and max (inclusive).
    static double
    randomNumberInRange(net.minecraft.util.RandomSource random, double min, double max)
    Returns a pseudo random number in range of min and max (inclusive).
    static float
    randomNumberInRange(net.minecraft.util.RandomSource random, float min, float max)
    Returns a pseudo random number in range of min and max (inclusive).
    static int
    randomNumberInRange(net.minecraft.util.RandomSource random, int min, int max)
    Returns a pseudo random number in range of min and max (inclusive).
    static net.minecraft.world.phys.Vec3
    rotateVectorAroundYCC(net.minecraft.world.phys.Vec3 vec, double angle)
    Rotate a vector counter clock wise around the y axis.
    static net.minecraft.world.phys.Vec3
    rotateVectorCC(net.minecraft.world.phys.Vec3 vec, net.minecraft.world.phys.Vec3 axis, double angle)
    Rotate a vector counter clock wise around an axis.
    static double
    valueInRange(double min, double max, double value)
    Returns a value between min and max
    static float
    valueInRange(float min, float max, float value)
    Returns a value between min and max
    static int
    valueInRange(int min, int max, int value)
    Returns a value between min and max
    static long
    valueInRange(long min, long max, long value)
    Returns a value between min and max

    Von Klasse geerbte Methoden java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Felddetails

    • RANDOM

      public static final net.minecraft.util.RandomSource RANDOM
      Static random instance if random numbers without specific seed are desired.
  • Konstruktordetails

    • MathUtil

      public MathUtil()
  • Methodendetails

    • rotateVectorAroundYCC

      public static net.minecraft.world.phys.Vec3 rotateVectorAroundYCC(net.minecraft.world.phys.Vec3 vec, double angle)
      Rotate a vector counter clock wise around the y axis.
      Parameter:
      vec - Vector to rotate
      angle - Rotation angle
      Gibt zurück:
      Rotated vector
    • rotateVectorCC

      public static net.minecraft.world.phys.Vec3 rotateVectorCC(net.minecraft.world.phys.Vec3 vec, net.minecraft.world.phys.Vec3 axis, double angle)
      Rotate a vector counter clock wise around an axis.
      Parameter:
      vec - Vector to rotate
      axis - Rotation axis
      angle - Rotation angle
      Gibt zurück:
      Rotated vector
    • randomNumberInRange

      public static int randomNumberInRange(int min, int max)
      Returns a pseudo random number in range of min and max (inclusive). Use this RANDOM instance
      Parameter:
      min - Minimal value (inclusive)
      max - Maximal value (inclusive)
      Gibt zurück:
      Return a random value between min and max
    • randomNumberInRange

      public static int randomNumberInRange(net.minecraft.util.RandomSource random, int min, int max)
      Returns a pseudo random number in range of min and max (inclusive).
      Parameter:
      random - The random instance
      min - Minimal value (inclusive)
      max - Maximal value (inclusive)
      Gibt zurück:
      Return a random value between min and max
    • randomNumberInRange

      public static float randomNumberInRange(float min, float max)
      Returns a pseudo random number in range of min and max (inclusive). Use this RANDOM instance
      Parameter:
      min - Minimal value (inclusive)
      max - Maximal value (inclusive)
      Gibt zurück:
      Return a random value between min and max
    • randomNumberInRange

      public static float randomNumberInRange(net.minecraft.util.RandomSource random, float min, float max)
      Returns a pseudo random number in range of min and max (inclusive).
      Parameter:
      random - The random instance
      min - Minimal value (inclusive)
      max - Maximal value (inclusive)
      Gibt zurück:
      Return a random value between min and max
    • randomNumberInRange

      public static double randomNumberInRange(double min, double max)
      Returns a pseudo random number in range of min and max (inclusive). Use this RANDOM instance
      Parameter:
      min - Minimal value (inclusive)
      max - Maximal value (inclusive)
      Gibt zurück:
      Return a random value between min and max
    • randomNumberInRange

      public static double randomNumberInRange(net.minecraft.util.RandomSource random, double min, double max)
      Returns a pseudo random number in range of min and max (inclusive).
      Parameter:
      random - The random instance
      min - Minimal value (inclusive)
      max - Maximal value (inclusive)
      Gibt zurück:
      Return a random value between min and max
    • valueInRange

      public static int valueInRange(int min, int max, int value)
      Returns a value between min and max
      Parameter:
      min - Minimal value (inclusive)
      max - Maximal value (inclusive)
      value - Value that should be in range
      Gibt zurück:
      Return a value between min and max
    • valueInRange

      public static long valueInRange(long min, long max, long value)
      Returns a value between min and max
      Parameter:
      min - Minimal value (inclusive)
      max - Maximal value (inclusive)
      value - Value that should be in range
      Gibt zurück:
      Return a value between min and max
    • valueInRange

      public static float valueInRange(float min, float max, float value)
      Returns a value between min and max
      Parameter:
      min - Minimal value (inclusive)
      max - Maximal value (inclusive)
      value - Value that should be in range
      Gibt zurück:
      Return a value between min and max
    • valueInRange

      public static double valueInRange(double min, double max, double value)
      Returns a value between min and max
      Parameter:
      min - Minimal value (inclusive)
      max - Maximal value (inclusive)
      value - Value that should be in range
      Gibt zurück:
      Return a value between min and max
    • getPlaneDistance

      public static float getPlaneDistance(int x1, int z1, int x2, int z2)
      Returns the distance between x1, z1 and x2, z2
      Parameter:
      x1 - First x coordinate
      z1 - First z coordinate
      x2 - Second x coordinate
      z2 - Second z coordinate
      Gibt zurück:
      The distance between these two coordinates