diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-11-11 09:48:38 +0100 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-11-11 09:48:38 +0100 |
commit | f948551971752b637e7069e9efcdfc904619f53e (patch) | |
tree | a0bc05c2318df768279ebc989b7db2dcc4fad870 | |
parent | Made settings.ini default to settings.example.ini when it doesn't exist (diff) | |
download | cuberite-f948551971752b637e7069e9efcdfc904619f53e.tar cuberite-f948551971752b637e7069e9efcdfc904619f53e.tar.gz cuberite-f948551971752b637e7069e9efcdfc904619f53e.tar.bz2 cuberite-f948551971752b637e7069e9efcdfc904619f53e.tar.lz cuberite-f948551971752b637e7069e9efcdfc904619f53e.tar.xz cuberite-f948551971752b637e7069e9efcdfc904619f53e.tar.zst cuberite-f948551971752b637e7069e9efcdfc904619f53e.zip |
-rw-r--r-- | source/Chunk.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
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 } |