World.cpp 557 B

1234567891011121314151617181920212223
  1. #include "common/world/World.h"
  2. #include "common/world/HighMap.h"
  3. #include "utils/Random.h"
  4. World::World(const BlockRegistry& blockRegistry)
  5. : blockRegistry(blockRegistry), blocks(7, 7), dirty(true) {
  6. }
  7. void World::setBlock(int x, int y, int z, const Block& block) {
  8. blocks.set(x, y, z, block.getId());
  9. }
  10. const Block& World::getBlock(int x, int y, int z) const {
  11. return blockRegistry.getBlock(blocks.get(x, y, z));
  12. }
  13. int World::getSize() const {
  14. return blocks.getSize();
  15. }
  16. int World::getHeight() const {
  17. return blocks.getHeight();
  18. }