Package net.risingworld.api.utils
Klasse Utils.ChunkUtils
java.lang.Object
net.risingworld.api.utils.Utils.ChunkUtils
- Umschließende Klasse:
Utils
Chunk related functions, including conversion of global positions to
chunk/block positions and vice versa.
-
Feldübersicht
Modifizierer und TypFeldBeschreibungstatic final float
Inverse x size of a chunk (1.0 / size)static final float
Inverse y size of a chunk (1.0 / size)static final float
Inverse z size of a chunk (1.0 / size)static final int
Horizontal (x) size of a chunk (amount of blocks)static final int
Vertical (y) size of a chunk (amount of blocks)static final int
Horizontal (z) size of a chunk (amount of blocks) -
Konstruktorübersicht
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic Vector3i
getBlockPosition
(Vector3f globalPosition, Vector3i chunkPosition) Calculates a block position (within the provided chunk position)static int
getBlockPositionX
(float x, int chunkPositionX) Calculates the x block position within a given chunk position.static int
getBlockPositionY
(float y, int chunkPositionY) Calculates the y block position within a given chunk position.static int
getBlockPositionZ
(float z, int chunkPositionZ) Calculates the z block position within a given chunk position.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 providedVector3i's
.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 providedVector3i's
.static Vector3i
getChunkPosition
(float x, float y, float z) Calculates a chunk offset from a given global position and stores the result in aVector3i
.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 providedVector3i
.static Vector3i
getChunkPosition
(Vector3f globalPosition) Calculates a chunk offset from a given global position and stores the result in aVector3i
.static Vector3i
getChunkPosition
(Vector3f globalPosition, Vector3i storeTo) Calculates a chunk offset from a given global position and stores the result in the providedVector3i
.static int
getChunkPositionX
(float x) Calculates the x chunk offset from a given global position (x).static int
getChunkPositionY
(float y) Calculates the y chunk offset from a given global position (y).static int
getChunkPositionZ
(float z) Calculates the z chunk offset from a given global position (z).static Vector3i
getGlobalBlockPosition
(int cx, int cy, int cz, int bx, int by, int bz) static Vector3i
getGlobalBlockPosition
(Vector3i chunkPosition, Vector3i blockPosition) static Vector3f
getGlobalPosition
(Vector3i chunkPosition, Vector3i blockPosition) static Vector3f
getGlobalPosition
(Vector3i chunkPosition, Vector3i blockPosition, Vector3f storeTo) static float
getRelativePositionX
(float x, int cx) static float
getRelativePositionY
(float y, int cy) static float
getRelativePositionZ
(float z, int cz)
-
Felddetails
-
CHUNK_SIZE_X
public static final int CHUNK_SIZE_XHorizontal (x) size of a chunk (amount of blocks) -
CHUNK_SIZE_Y
public static final int CHUNK_SIZE_YVertical (y) size of a chunk (amount of blocks) -
CHUNK_SIZE_Z
public static final int CHUNK_SIZE_ZHorizontal (z) size of a chunk (amount of blocks) -
CHUNK_INV_SIZE_X
public static final float CHUNK_INV_SIZE_XInverse x size of a chunk (1.0 / size) -
CHUNK_INV_SIZE_Y
public static final float CHUNK_INV_SIZE_YInverse y size of a chunk (1.0 / size) -
CHUNK_INV_SIZE_Z
public static final float CHUNK_INV_SIZE_ZInverse z size of a chunk (1.0 / size)
-
-
Konstruktordetails
-
ChunkUtils
public ChunkUtils()
-
-
Methodendetails
-
getChunkPosition
Calculates a chunk offset from a given global position and stores the result in aVector3i
.- Parameter:
globalPosition
- the global position.- Gibt zurück:
- a new
Vector3i
containing the chunk offset.
-
getChunkPosition
Calculates a chunk offset from a given global position and stores the result in the providedVector3i
.- Parameter:
globalPosition
- the global position.storeTo
- theVector3i
you want to store the result in.- Gibt zurück:
- the
Vector3i
containing the chunk offset.
-
getChunkPosition
Calculates a chunk offset from a given global position and stores the result in aVector3i
.- 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
Calculates a chunk offset from a given global position and stores the result in the providedVector3i
.- Parameter:
x
- the global x position.y
- the global y position.z
- the global z position.storeTo
- theVector3i
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 providedVector3i'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 providedVector3i'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
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, seegetChunkPositionX(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, seegetChunkPositionY(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, seegetChunkPositionZ(float)
- Gibt zurück:
- the z block position.
-
getGlobalPosition
-
getGlobalPosition
-
getGlobalBlockPosition
-
getGlobalBlockPosition
-