Klasse Utils.ChunkUtils

java.lang.Object
net.risingworld.api.utils.Utils.ChunkUtils
Umschließende Klasse:
Utils

public abstract static class Utils.ChunkUtils extends Object
Chunk related functions, including conversion of global positions to chunk/block positions and vice versa.
  • Felddetails

    • CHUNK_SIZE_X

      public static final int CHUNK_SIZE_X
      Horizontal (x) size of a chunk (amount of blocks)
    • CHUNK_SIZE_Y

      public static final int CHUNK_SIZE_Y
      Vertical (y) size of a chunk (amount of blocks)
    • CHUNK_SIZE_Z

      public static final int CHUNK_SIZE_Z
      Horizontal (z) size of a chunk (amount of blocks)
    • CHUNK_INV_SIZE_X

      public static final float CHUNK_INV_SIZE_X
      Inverse x size of a chunk (1.0 / size)
    • CHUNK_INV_SIZE_Y

      public static final float CHUNK_INV_SIZE_Y
      Inverse y size of a chunk (1.0 / size)
    • CHUNK_INV_SIZE_Z

      public static final float CHUNK_INV_SIZE_Z
      Inverse z size of a chunk (1.0 / size)
  • Konstruktordetails

    • ChunkUtils

      public ChunkUtils()
  • Methodendetails

    • getChunkPosition

      public static Vector3i getChunkPosition(Vector3f globalPosition)
      Calculates a chunk offset from a given global position and stores the result in a Vector3i.
      Parameter:
      globalPosition - the global position.
      Gibt zurück:
      a new Vector3i containing the chunk offset.
    • getChunkPosition

      public static Vector3i getChunkPosition(Vector3f globalPosition, Vector3i storeTo)
      Calculates a chunk offset from a given global position and stores the result in the provided Vector3i.
      Parameter:
      globalPosition - the global position.
      storeTo - the Vector3i you want to store the result in.
      Gibt zurück:
      the Vector3i containing the chunk offset.
    • getChunkPosition

      public static Vector3i getChunkPosition(float x, float y, float z)
      Calculates a chunk offset from a given global position and stores the result in a Vector3i.
      Parameter:
      x - the global x position.
      y - the global y position.
      z - the global z position.
      Gibt zurück:
      a new Vector3i containing the chunk offset.
    • getChunkPosition

      public static Vector3i getChunkPosition(float x, float y, float z, Vector3i storeTo)
      Calculates a chunk offset from a given global position and stores the result in the provided Vector3i.
      Parameter:
      x - the global x position.
      y - the global y position.
      z - the global z position.
      storeTo - the Vector3i you want to store the result in.
      Gibt zurück:
      the Vector3i containing the chunk offset.
    • getChunkPositionX

      public static int getChunkPositionX(float x)
      Calculates the x chunk offset from a given global position (x).
      Parameter:
      x - the global x position.
      Gibt zurück:
      the x chunk offset.
    • getChunkPositionY

      public static int getChunkPositionY(float y)
      Calculates the y chunk offset from a given global position (y).
      Parameter:
      y - the global y position.
      Gibt zurück:
      the y chunk offset.
    • getChunkPositionZ

      public static int getChunkPositionZ(float z)
      Calculates the z chunk offset from a given global position (z).
      Parameter:
      z - the global z position.
      Gibt zurück:
      the z chunk offset.
    • getRelativePositionX

      public static float getRelativePositionX(float x, int cx)
    • getRelativePositionY

      public static float getRelativePositionY(float y, int cy)
    • getRelativePositionZ

      public static float getRelativePositionZ(float z, int cz)
    • getChunkAndBlockPosition

      public static void getChunkAndBlockPosition(Vector3f globalPosition, Vector3i chunkPositionStore, Vector3i blockPositionStore)
      Calculates a chunk offset and the according block position (within this chunk) from a given global position and stores the results in the provided Vector3i's.
      Parameter:
      globalPosition - the global position.
      chunkPositionStore - Vector3i you want to store the chunk offset in.
      blockPositionStore - Vector3i you want to store the block position in.
    • getChunkAndBlockPosition

      public static void getChunkAndBlockPosition(float x, float y, float z, Vector3i chunkPositionStore, Vector3i blockPositionStore)
      Calculates a chunk offset and the according block position (within this chunk) from a given global position and stores the results in the provided Vector3i's.
      Parameter:
      x - the global x position.
      y - the global y position.
      z - the global z position.
      chunkPositionStore - Vector3i you want to store the chunk offset in.
      blockPositionStore - Vector3i you want to store the block position in.
    • getBlockPosition

      public static Vector3i getBlockPosition(Vector3f globalPosition, Vector3i chunkPosition)
      Calculates a block position (within the provided chunk position)
      Parameter:
      globalPosition - the global position.
      chunkPosition - the chunk offset.
      Gibt zurück:
      a new Vector3i containing the block position within the provided chunk.
    • getBlockPositionX

      public static int getBlockPositionX(float x, int chunkPositionX)
      Calculates the x block position within a given chunk position.
      Parameter:
      x - the global x position.
      chunkPositionX - the x chunk position, see getChunkPositionX(float)
      Gibt zurück:
      the x block position.
    • getBlockPositionY

      public static int getBlockPositionY(float y, int chunkPositionY)
      Calculates the y block position within a given chunk position.
      Parameter:
      y - the global y position.
      chunkPositionY - the y chunk position, see getChunkPositionY(float)
      Gibt zurück:
      the y block position.
    • getBlockPositionZ

      public static int getBlockPositionZ(float z, int chunkPositionZ)
      Calculates the z block position within a given chunk position.
      Parameter:
      z - the global y position.
      chunkPositionZ - the z chunk position, see getChunkPositionZ(float)
      Gibt zurück:
      the z block position.
    • getGlobalPosition

      public static Vector3f getGlobalPosition(Vector3i chunkPosition, Vector3i blockPosition)
    • getGlobalPosition

      public static Vector3f getGlobalPosition(Vector3i chunkPosition, Vector3i blockPosition, Vector3f storeTo)
    • getGlobalBlockPosition

      public static Vector3i getGlobalBlockPosition(Vector3i chunkPosition, Vector3i blockPosition)
    • getGlobalBlockPosition

      public static Vector3i getGlobalBlockPosition(int cx, int cy, int cz, int bx, int by, int bz)