diff options
author | Samuel Barney <samjbarney@gmail.com> | 2013-10-28 23:40:13 +0100 |
---|---|---|
committer | Samuel Barney <samjbarney@gmail.com> | 2013-10-28 23:40:13 +0100 |
commit | d7a490a99205d69abce52c77854fafee52b4e82b (patch) | |
tree | 92e68ff622fc89bd94e11c7ed7fc548ed3129047 /source/Chunk.cpp | |
parent | Got spiders and other mobs respecting night and day for spawning (diff) | |
parent | ProtoProxy: Implemented 1.7.2 status request / response / ping. (diff) | |
download | cuberite-d7a490a99205d69abce52c77854fafee52b4e82b.tar cuberite-d7a490a99205d69abce52c77854fafee52b4e82b.tar.gz cuberite-d7a490a99205d69abce52c77854fafee52b4e82b.tar.bz2 cuberite-d7a490a99205d69abce52c77854fafee52b4e82b.tar.lz cuberite-d7a490a99205d69abce52c77854fafee52b4e82b.tar.xz cuberite-d7a490a99205d69abce52c77854fafee52b4e82b.tar.zst cuberite-d7a490a99205d69abce52c77854fafee52b4e82b.zip |
Diffstat (limited to '')
-rw-r--r-- | source/Chunk.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/source/Chunk.cpp b/source/Chunk.cpp index 038831896..c419cf7f2 100644 --- a/source/Chunk.cpp +++ b/source/Chunk.cpp @@ -1152,6 +1152,29 @@ bool cChunk::UnboundedRelGetBlockSkyLight(int a_RelX, int a_RelY, int a_RelZ, NI +bool cChunk::UnboundedRelGetBlockLights(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE & a_BlockLight, NIBBLETYPE & a_SkyLight) const +{ + if ((a_RelY < 0) || (a_RelY >= cChunkDef::Height)) + { + LOGWARNING("%s: requesting a block with a_RelY out of range: %d", __FUNCTION__, a_RelY); + return false; + } + cChunk * Chunk = GetRelNeighborChunkAdjustCoords(a_RelX, a_RelZ); + if ((Chunk == NULL) || !Chunk->IsValid()) + { + // The chunk is not available, bail out + return false; + } + int idx = Chunk->MakeIndex(a_RelX, a_RelY, a_RelZ); + a_BlockLight = Chunk->GetBlockLight(idx); + a_SkyLight = Chunk->GetSkyLight(idx); + return true; +} + + + + + bool cChunk::UnboundedRelSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) { if ((a_RelY < 0) || (a_RelY > cChunkDef::Height)) |