summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockHandler.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2020-04-21 22:19:22 +0200
committerGitHub <noreply@github.com>2020-04-21 22:19:22 +0200
commit487f9a2aa9b5497495cef1ac3b9c7a603e69f862 (patch)
tree054a846942f414060e29c72f4a717c8a89e70893 /src/Blocks/BlockHandler.cpp
parentDelet SpawnObject params (diff)
downloadcuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar
cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar.gz
cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar.bz2
cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar.lz
cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar.xz
cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.tar.zst
cuberite-487f9a2aa9b5497495cef1ac3b9c7a603e69f862.zip
Diffstat (limited to 'src/Blocks/BlockHandler.cpp')
-rw-r--r--src/Blocks/BlockHandler.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp
index f1df4db44..5d6609836 100644
--- a/src/Blocks/BlockHandler.cpp
+++ b/src/Blocks/BlockHandler.cpp
@@ -406,8 +406,9 @@ cBlockHandler::cBlockHandler(BLOCKTYPE a_BlockType)
bool cBlockHandler::GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface, cPlayer & a_Player,
- int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
- int a_CursorX, int a_CursorY, int a_CursorZ,
+ const Vector3i a_ClickedBlockPos,
+ eBlockFace a_ClickedBlockFace,
+ const Vector3i a_CursorPos,
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
)
{
@@ -437,7 +438,7 @@ void cBlockHandler::OnUpdate(
void cBlockHandler::OnPlacedByPlayer(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer & a_Player, const sSetBlock & a_BlockChange)
{
- OnPlaced(a_ChunkInterface, a_WorldInterface, a_BlockChange.GetPos(), a_BlockChange.m_BlockType, a_BlockChange.m_BlockMeta);
+ OnPlaced(a_ChunkInterface, a_WorldInterface, a_BlockChange.GetAbsolutePos(), a_BlockChange.m_BlockType, a_BlockChange.m_BlockMeta);
}
@@ -509,7 +510,7 @@ cItems cBlockHandler::ConvertToPickups(
-bool cBlockHandler::CanBeAt(cChunkInterface & a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ, const cChunk & a_Chunk)
+bool cBlockHandler::CanBeAt(cChunkInterface & a_ChunkInterface, const Vector3i a_RelPos, const cChunk & a_Chunk)
{
return true;
}
@@ -554,10 +555,10 @@ bool cBlockHandler::DoesDropOnUnsuitable(void)
-/* default functionality: only test for height, since we assume full voxels with varying height */
-bool cBlockHandler::IsInsideBlock(Vector3d a_Position, const BLOCKTYPE a_BlockType, const NIBBLETYPE a_BlockMeta)
+bool cBlockHandler::IsInsideBlock(const Vector3d a_RelPosition, const NIBBLETYPE a_BlockMeta)
{
- return a_Position.y < cBlockInfo::GetBlockHeight(a_BlockType);
+ // Default functionality: Test the height, since we assume full voxels with varying height
+ return (a_RelPosition.y < cBlockInfo::GetBlockHeight(m_BlockType));
}
@@ -584,7 +585,7 @@ void cBlockHandler::Check(
cChunk & a_Chunk
)
{
- if (!CanBeAt(a_ChunkInterface, a_RelPos.x, a_RelPos.y, a_RelPos.z, a_Chunk))
+ if (!CanBeAt(a_ChunkInterface, a_RelPos, a_Chunk))
{
if (DoesDropOnUnsuitable())
{