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

Method SetChunkData

src/ChunkMap.cpp:892–938  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

890
891
892void cChunkMap::SetChunkData(
893 int a_ChunkX, int a_ChunkZ,
894 const BLOCKTYPE * a_BlockTypes,
895 const NIBBLETYPE * a_BlockMeta,
896 const NIBBLETYPE * a_BlockLight,
897 const NIBBLETYPE * a_BlockSkyLight,
898 const cChunkDef::HeightMap * a_HeightMap,
899 const cChunkDef::BiomeMap & a_BiomeMap,
900 cBlockEntityList & a_BlockEntities,
901 bool a_MarkDirty
902)
903{
904 {
905 cCSLock Lock(m_CSLayers);
906 cChunkPtr Chunk = GetChunkNoLoad(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ);
907 if (Chunk == NULL)
908 {
909 return;
910 }
911 Chunk->SetAllData(a_BlockTypes, a_BlockMeta, a_BlockLight, a_BlockSkyLight, a_HeightMap, a_BiomeMap, a_BlockEntities);
912
913 if (a_MarkDirty)
914 {
915 Chunk->MarkDirty();
916 }
917
918 // Notify relevant ChunkStays:
919 cChunkStays ToBeDisabled;
920 for (cChunkStays::iterator itr = m_ChunkStays.begin(), end = m_ChunkStays.end(); itr != end; ++itr)
921 {
922 if ((*itr)->ChunkAvailable(a_ChunkX, a_ChunkZ))
923 {
924 // The chunkstay wants to be disabled, add it to a list of to-be-disabled chunkstays for later processing:
925 ToBeDisabled.push_back(*itr);
926 }
927 } // for itr - m_ChunkStays[]
928
929 // Disable (and possibly remove) the chunkstays that chose to get disabled:
930 for (cChunkStays::iterator itr = ToBeDisabled.begin(), end = ToBeDisabled.end(); itr != end; ++itr)
931 {
932 (*itr)->Disable();
933 }
934 }
935
936 // Notify plugins of the chunk becoming available
937 cPluginManager::Get()->CallHookChunkAvailable(m_World, a_ChunkX, a_ChunkZ);
938}
939
940
941

Callers

nothing calls this directly

Calls 7

SetAllDataMethod · 0.80
MarkDirtyMethod · 0.80
beginMethod · 0.80
endMethod · 0.80
ChunkAvailableMethod · 0.80
DisableMethod · 0.45

Tested by

no test coverage detected