From f948551971752b637e7069e9efcdfc904619f53e Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 11 Nov 2012 08:48:38 +0000 Subject: 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 --- source/Chunk.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'source') diff --git a/source/Chunk.cpp b/source/Chunk.cpp index 03e007684..ab5cf3e91 100644 --- a/source/Chunk.cpp +++ b/source/Chunk.cpp @@ -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 } -- cgit v1.2.3