1
0

Vector3 in Handlers (#4680)

Refactored all cBlockHandler and cItemHandler descendants to use Vector3.
This commit is contained in:
Mattes D
2020-04-21 22:19:22 +02:00
committed by GitHub
parent 246acb19f9
commit 487f9a2aa9
111 changed files with 2687 additions and 1510 deletions

View File

@@ -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())
{