From 365cbc6e1cea96741e26c9ce912b003f8fd2c62c Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sun, 29 Sep 2019 14:59:24 +0200 Subject: Refactored more of Entities and BlockEntities to use Vector3. (#4403) --- src/BlockArea.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/BlockArea.h') diff --git a/src/BlockArea.h b/src/BlockArea.h index 4a68f9a31..8f57c8e5e 100644 --- a/src/BlockArea.h +++ b/src/BlockArea.h @@ -388,6 +388,15 @@ public: NIBBLETYPE * GetBlockSkyLight(void) const { return m_BlockSkyLight.get(); } // NOTE: one byte per block! size_t GetBlockCount(void) const { return static_cast(m_Size.x * m_Size.y * m_Size.z); } static size_t MakeIndexForSize(Vector3i a_RelPos, Vector3i a_Size); + + /** Returns the index into the internal arrays for the specified coords */ + size_t MakeIndex(Vector3i a_RelPos) const + { + return MakeIndexForSize(a_RelPos, m_Size); + } + + /** OBSOLETE, use the Vector3i-based overload instead. + Returns the index into the internal arrays for the specified coords */ size_t MakeIndex(int a_RelX, int a_RelY, int a_RelZ) const { return MakeIndexForSize({ a_RelX, a_RelY, a_RelZ }, m_Size); -- cgit v1.2.3