diff options
author | peterbell10 <peterbell10@live.co.uk> | 2018-02-04 23:15:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-04 23:15:31 +0100 |
commit | 2df14a04962037b93352c2fc53349af54ab3b14d (patch) | |
tree | 8fe7096d0c5dd492fc98e9534f9fcd53c41f767a /src/ChunkDef.h | |
parent | Ocelots don't take fall damage (#4171) (diff) | |
download | cuberite-2df14a04962037b93352c2fc53349af54ab3b14d.tar cuberite-2df14a04962037b93352c2fc53349af54ab3b14d.tar.gz cuberite-2df14a04962037b93352c2fc53349af54ab3b14d.tar.bz2 cuberite-2df14a04962037b93352c2fc53349af54ab3b14d.tar.lz cuberite-2df14a04962037b93352c2fc53349af54ab3b14d.tar.xz cuberite-2df14a04962037b93352c2fc53349af54ab3b14d.tar.zst cuberite-2df14a04962037b93352c2fc53349af54ab3b14d.zip |
Diffstat (limited to 'src/ChunkDef.h')
-rw-r--r-- | src/ChunkDef.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ChunkDef.h b/src/ChunkDef.h index 188ad33d8..bdba4061f 100644 --- a/src/ChunkDef.h +++ b/src/ChunkDef.h @@ -144,6 +144,16 @@ public: return ((a_Width >= 0) && (a_Width < Width)); } + /** Validates a chunk relative coordinate. Returns false if the coordiante is out of bounds for a chunk. */ + inline static bool IsValidRelPos(Vector3i a_RelPos) + { + return ( + IsValidWidth(a_RelPos.x) && + IsValidHeight(a_RelPos.y) && + IsValidWidth(a_RelPos.z) + ); + } + /** Converts absolute block coords to chunk coords: */ inline static void BlockToChunk(int a_X, int a_Z, int & a_ChunkX, int & a_ChunkZ) { |