Class Morton

java.lang.Object
dev.kitteh.factions.util.Morton

@NullMarked public final class Morton extends Object
Simple two-ints-in-a-long Morton code.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    getX(long mortonCode)
    Gets the X value from a given Morton code.
    static int
    getZ(long mortonCode)
    Gets the Z value from a given Morton code.
    static long
    of(int x, int z)
    Gets a Morton code for the given coordinates.
    static long
    of(FLocation location)
     

    Methods inherited from class java.lang.Object

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

    • Morton

      public Morton()
  • Method Details

    • of

      public static long of(FLocation location)
    • of

      public static long of(int x, int z)
      Gets a Morton code for the given coordinates.
      Parameters:
      x - x coordinate
      z - z coordinate
      Returns:
      Morton code for the coordinates
    • getX

      public static int getX(long mortonCode)
      Gets the X value from a given Morton code.
      Parameters:
      mortonCode - Morton code
      Returns:
      x coordinate
    • getZ

      public static int getZ(long mortonCode)
      Gets the Z value from a given Morton code.
      Parameters:
      mortonCode - Morton code
      Returns:
      z coordinate