World.cpp 462 B

12345678910111213
  1. #include "common/world/World.h"
  2. void World::setBlock(u32 x, u32 y, u32 z, const Block& block) {
  3. u32 cx = (x >> Chunk::CHUNK_BIT_SIZE) & BITMASK;
  4. u32 cz = (z >> Chunk::CHUNK_BIT_SIZE) & BITMASK;
  5. chunks[cx][cz].setBlock(x, y, z, block);
  6. }
  7. const Block& World::getBlock(u32 x, u32 y, u32 z) const {
  8. u32 cx = (x >> Chunk::CHUNK_BIT_SIZE) & BITMASK;
  9. u32 cz = (z >> Chunk::CHUNK_BIT_SIZE) & BITMASK;
  10. return chunks[cx][cz].getBlock(x, y, z);
  11. }