Block.cpp 471 B

12345678910111213141516171819202122
  1. #include "common/block/Block.h"
  2. Block::Block(BlockId id, const BlockName& registry)
  3. : id(id), registry(registry) {
  4. if(id > 0) {
  5. boxes.add(Vector3(1.0f, 1.0f, 1.0f));
  6. }
  7. }
  8. BlockId Block::getId() const {
  9. return id;
  10. }
  11. const BlockName& Block::getRegistry() const {
  12. return registry;
  13. }
  14. void Block::addBoxes(List<CollisionBox>& list, const Vector3& pos) const {
  15. for(const CollisionBox& box : boxes) {
  16. list.add(box.offset(pos));
  17. }
  18. }