summaryrefslogtreecommitdiffstats
path: root/src/Chunk.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-05-10 21:27:57 +0200
committerMattes D <github@xoft.cz>2014-05-10 21:27:57 +0200
commit28815252e6ff086c0fab7cf56be4839f3d8612a3 (patch)
tree4532e85cbcc873a2616147713e9f899ecf84d111 /src/Chunk.cpp
parentClient cert is not requested. (diff)
parentMerge pull request #993 from mc-server/GridStructGen (diff)
downloadcuberite-28815252e6ff086c0fab7cf56be4839f3d8612a3.tar
cuberite-28815252e6ff086c0fab7cf56be4839f3d8612a3.tar.gz
cuberite-28815252e6ff086c0fab7cf56be4839f3d8612a3.tar.bz2
cuberite-28815252e6ff086c0fab7cf56be4839f3d8612a3.tar.lz
cuberite-28815252e6ff086c0fab7cf56be4839f3d8612a3.tar.xz
cuberite-28815252e6ff086c0fab7cf56be4839f3d8612a3.tar.zst
cuberite-28815252e6ff086c0fab7cf56be4839f3d8612a3.zip
Diffstat (limited to 'src/Chunk.cpp')
-rw-r--r--src/Chunk.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index cd3bceda2..ca536e89a 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -380,12 +380,12 @@ void cChunk::SetLight(
{ // Compress blocklight
m_BlockLight.clear();
- m_BlockLight.insert(m_BlockLight.end(), &a_BlockLight[0], &a_BlockLight[m_BlockTypes.size()]);
+ m_BlockLight.insert(m_BlockLight.end(), &a_BlockLight[0], &a_BlockLight[m_BlockTypes.size() / 2]);
}
{ // Compress skylight
m_BlockSkyLight.clear();
- m_BlockSkyLight.insert(m_BlockSkyLight.end(), &a_SkyLight[0], &a_SkyLight[m_BlockTypes.size()]);
+ m_BlockSkyLight.insert(m_BlockSkyLight.end(), &a_SkyLight[0], &a_SkyLight[m_BlockTypes.size() / 2]);
}
m_IsLightValid = true;
@@ -749,7 +749,7 @@ void cChunk::ProcessQueuedSetBlocks(void)
{
if (itr->m_Tick <= CurrTick)
{
- if (itr->m_PreviousType != E_BLOCK_AIR) // PreviousType defaults to -1 if not specified
+ if (itr->m_PreviousType != E_BLOCK_AIR) // PreviousType defaults to 0 if not specified
{
if (GetBlock(itr->m_RelX, itr->m_RelY, itr->m_RelZ) == itr->m_PreviousType)
{
@@ -1638,6 +1638,24 @@ void cChunk::FastSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockT
+void cChunk::SetMeta(int a_BlockIdx, NIBBLETYPE a_Meta)
+{
+ if (GetNibble(m_BlockMeta, a_BlockIdx) == a_Meta)
+ {
+ return;
+ }
+
+ MarkDirty();
+ SetNibble(m_BlockMeta, a_BlockIdx, a_Meta);
+ Vector3i Coords(IndexToCoordinate(a_BlockIdx));
+
+ m_PendingSendBlocks.push_back(sSetBlock(m_PosX, m_PosZ, Coords.x, Coords.y, Coords.z, GetBlock(a_BlockIdx), a_Meta));
+}
+
+
+
+
+
void cChunk::SendBlockTo(int a_RelX, int a_RelY, int a_RelZ, cClientHandle * a_Client)
{
// The coords must be valid, because the upper level already does chunk lookup. No need to check them again.