1
0
Fork 0

Fixed FS #268 - if a block entity breaking is disallowed by a plugin, the entire blockentity is sent back to the client

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1031 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2012-11-11 08:48:38 +00:00
parent 727446f6d5
commit f948551971
1 changed files with 12 additions and 6 deletions

View File

@ -1183,12 +1183,9 @@ void cChunk::FastSetBlock( int a_X, int a_Y, int a_Z, BLOCKTYPE a_BlockType, BLO
void cChunk::SendBlockTo(int a_RelX, int a_RelY, int a_RelZ, cClientHandle * a_Client)
{
unsigned int index = MakeIndex(a_RelX, a_RelY, a_RelZ);
if (index == INDEX_OUT_OF_RANGE)
{
LOGWARN("cChunk::SendBlockTo Index out of range!");
return;
}
// The coords must be valid, because the upper level already does chunk lookup. No need to check them again.
// There's an debug-time assert in MakeIndexNoCheck anyway
unsigned int index = MakeIndexNoCheck(a_RelX, a_RelY, a_RelZ);
if (a_Client == NULL)
{
@ -1199,6 +1196,15 @@ void cChunk::SendBlockTo(int a_RelX, int a_RelY, int a_RelZ, cClientHandle * a_C
Vector3i wp = PositionToWorldPosition(a_RelX, a_RelY, a_RelZ);
a_Client->SendBlockChange(wp.x, wp.y, wp.z, GetBlock(index), GetMeta(index));
// FS #268 - if a BlockEntity digging is cancelled by a plugin, the entire block entity must be re-sent to the client:
for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), end = m_BlockEntities.end(); itr != end; ++itr)
{
if (((*itr)->GetPosX() == wp.x) && ((*itr)->GetPosY() == wp.y) && ((*itr)->GetPosZ() == wp.z))
{
(*itr)->SendTo(*a_Client);
}
} // for itr - m_BlockEntities
}