]> git.localhorst.tv Git - blank.git/blobdiff - src/world/BlockLookup.hpp
special treatment for players
[blank.git] / src / world / BlockLookup.hpp
index 4c8b12ba41a6a50f14c4f5033b685ce42ddaeca3..122b3c76f7e76374eaf50aa264513d54564b43c6 100644 (file)
@@ -10,13 +10,13 @@ namespace blank {
 class BlockLookup {
 
 public:
-       // resolve chunk/position from oob coordinates
+       /// resolve chunk/position from oob coordinates
        BlockLookup(Chunk *c, const Chunk::Pos &p) noexcept;
 
-       // resolve chunk/position from ib coordinates and direction
+       /// resolve chunk/position from ib coordinates and direction
        BlockLookup(Chunk *c, const Chunk::Pos &p, Block::Face dir) noexcept;
 
-       // check if lookup was successful
+       /// check if lookup was successful
        operator bool() const { return chunk; }
 
        // only valid if lookup was successful
@@ -26,6 +26,8 @@ public:
        const BlockType &GetType() const noexcept { return GetChunk().Type(GetBlock()); }
        int GetLight() const noexcept { return GetChunk().GetLight(GetBlockPos()); }
 
+       void SetBlock(const Block &b) noexcept { GetChunk().SetBlock(GetBlockPos(), b); }
+
        // traverse in given direction
        BlockLookup Next(Block::Face f) const { return BlockLookup(chunk, pos, f); }