Package com.plotsquared.core.util
Class ChunkUtil
java.lang.Object
com.plotsquared.core.util.ChunkUtil
This cache is used for world generation and just saves a bit of calculation time when checking if something is in the plot area.
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
getJ
(int x, int y, int z) Get the J value for Chunk block storage from the chunk xyz coordinates.static int
getX
(int j) Gets the x coordinate for a specific J value for a ChunkSection 16x16x16 xyz Array[4096].static int
getY
(int i, int j) Gets the y coordinate for specific I and J values for a Chunk Nx16x16x16 layerxyz Array[N][4096].static int
getZ
(int j) Gets the z coordinate for a specific J value for a ChunkSection 16x16x16 xyz Array[4096].static boolean
isWholeChunk
(@NonNull Location pos1, @NonNull Location pos2, @NonNull BlockVector2 chunk) Returns true if the region pos1-pos2 contains the chunk
-
Method Details
-
getJ
public static int getJ(int x, int y, int z) Get the J value for Chunk block storage from the chunk xyz coordinates. J is in the range 0 to 4095 where it represents a position in an array of 16x16x16 xyz (ChunkSection Array[4096]).- Parameters:
x
- Relative x coordinatey
- Relative y coordinatez
- Relative z coordinate- Returns:
- J value for xyz position in Array[4096].
-
getX
public static int getX(int j) Gets the x coordinate for a specific J value for a ChunkSection 16x16x16 xyz Array[4096].- Parameters:
j
- Position in the xyz Array[4096].- Returns:
- x coordinate within the chunk
-
getY
public static int getY(int i, int j) Gets the y coordinate for specific I and J values for a Chunk Nx16x16x16 layerxyz Array[N][4096].- Parameters:
i
- Relative layer of the position in the layerxyz Array[16][4096]. May be negative.j
- Position in the xyz Array[4096].- Returns:
- x coordinate within the chunk
-
getZ
public static int getZ(int j) Gets the z coordinate for a specific J value for a ChunkSection 16x16x16 xyz Array[4096].- Parameters:
j
- Position in the xyz Array[4096].- Returns:
- z coordinate within the chunk
-
isWholeChunk
public static boolean isWholeChunk(@NonNull Location pos1, @NonNull Location pos2, @NonNull BlockVector2 chunk) Returns true if the region pos1-pos2 contains the chunk- Parameters:
pos1
- Region minimum pointpos2
- Region maximum pointchunk
- BlockVector2 of chunk coordinates- Returns:
true
if the region pos1-pos2 contains the chunk
-