Merge branch 'itemframes' of https://github.com/mc-server/MCServer into itemframes
This commit is contained in:
commit
9c409fc65c
@ -23,23 +23,26 @@ public:
|
|||||||
{
|
{
|
||||||
if (a_Dir == BLOCK_FACE_NONE)
|
if (a_Dir == BLOCK_FACE_NONE)
|
||||||
{
|
{
|
||||||
|
// Client sends this if clicked on top or bottom face
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_Dir);
|
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_Dir); // Make sure block that will be occupied is free
|
||||||
BLOCKTYPE Block = a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ);
|
BLOCKTYPE Block = a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ);
|
||||||
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_Dir, true);
|
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_Dir, true); // We want the clicked block, so go back again
|
||||||
|
|
||||||
if (Block == E_BLOCK_AIR)
|
if (Block == E_BLOCK_AIR)
|
||||||
{
|
{
|
||||||
int Dir = 0;
|
int Dir = 0;
|
||||||
|
|
||||||
|
// The client uses different values for painting directions and block faces. Our constants are for the block faces, so we convert them here to painting faces
|
||||||
switch (a_Dir)
|
switch (a_Dir)
|
||||||
{
|
{
|
||||||
case BLOCK_FACE_SOUTH: break;
|
case BLOCK_FACE_ZP: break; // Initialised to zero
|
||||||
case BLOCK_FACE_NORTH: Dir = 2; break;
|
case BLOCK_FACE_ZM: Dir = 2; break;
|
||||||
case BLOCK_FACE_WEST: Dir = 1; break;
|
case BLOCK_FACE_XM: Dir = 1; break;
|
||||||
case BLOCK_FACE_EAST: Dir = 3; break;
|
case BLOCK_FACE_XP: Dir = 3; break;
|
||||||
default: return false;
|
default: ASSERT(!"Unhandled block face when trying spawn item frame!"); return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
cItemFrame * ItemFrame = new cItemFrame(Dir, a_BlockX, a_BlockY, a_BlockZ);
|
cItemFrame * ItemFrame = new cItemFrame(Dir, a_BlockX, a_BlockY, a_BlockZ);
|
||||||
|
Loading…
Reference in New Issue
Block a user