X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2Fchunk.cpp;h=c421be9d679fa45e0e715ab2c2feeddf7b3230cf;hb=2c2c02796e9df82d0cda12b59aad638d40b4e8b4;hp=ef3c5fc869d80acb94d4ec054462ce2d85c9cc64;hpb=46b18a88fdda816f3c2c547aba68b0a5ea7970f7;p=blank.git diff --git a/src/world/chunk.cpp b/src/world/chunk.cpp index ef3c5fc..c421be9 100644 --- a/src/world/chunk.cpp +++ b/src/world/chunk.cpp @@ -65,9 +65,13 @@ struct SetNode { int Get() const noexcept { return chunk->GetLight(pos); } void Set(int level) noexcept { chunk->SetLight(pos, level); } + const BlockType &GetType() const noexcept { return chunk->Type(Chunk::ToIndex(pos)); } + bool HasNext(Block::Face face) noexcept { + const BlockType &type = GetType(); + if (type.block_light && !type.luminosity) return false; const BlockLookup next(chunk, pos, face); - return next && !next.GetType().block_light; + return next; } SetNode GetNext(Block::Face face) noexcept { const BlockLookup next(chunk, pos, face);