MCPcopy Create free account
hub / github.com/cuberite/cuberite / SendBlockTo

Method SendBlockTo

src/Chunk.cpp:1580–1604  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1578
1579
1580void cChunk::SendBlockTo(int a_RelX, int a_RelY, int a_RelZ, cClientHandle * a_Client)
1581{
1582 // The coords must be valid, because the upper level already does chunk lookup. No need to check them again.
1583 // There's an debug-time assert in MakeIndexNoCheck anyway
1584 unsigned int index = MakeIndexNoCheck(a_RelX, a_RelY, a_RelZ);
1585
1586 if (a_Client == NULL)
1587 {
1588 // Queue the block for all clients in the chunk (will be sent in Tick())
1589 m_PendingSendBlocks.push_back(sSetBlock(m_PosX, m_PosZ, a_RelX, a_RelY, a_RelZ, GetBlock(index), GetMeta(index)));
1590 return;
1591 }
1592
1593 Vector3i wp = PositionToWorldPosition(a_RelX, a_RelY, a_RelZ);
1594 a_Client->SendBlockChange(wp.x, wp.y, wp.z, GetBlock(index), GetMeta(index));
1595
1596 // FS #268 - if a BlockEntity digging is cancelled by a plugin, the entire block entity must be re-sent to the client:
1597 for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), end = m_BlockEntities.end(); itr != end; ++itr)
1598 {
1599 if (((*itr)->GetPosX() == wp.x) && ((*itr)->GetPosY() == wp.y) && ((*itr)->GetPosZ() == wp.z))
1600 {
1601 (*itr)->SendTo(*a_Client);
1602 }
1603 } // for itr - m_BlockEntities
1604}
1605
1606
1607

Callers

nothing calls this directly

Calls 8

sSetBlockClass · 0.85
beginMethod · 0.80
endMethod · 0.80
SendBlockChangeMethod · 0.45
GetPosXMethod · 0.45
GetPosYMethod · 0.45
GetPosZMethod · 0.45
SendToMethod · 0.45

Tested by

no test coverage detected