BlockType.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #include "BlockType.h"
  2. #include "Block.h"
  3. #include "Registries.h"
  4. using namespace Framework;
  5. BlockType::BlockType(int id,
  6. bool needsInstance,
  7. ModelInfo model,
  8. int initialMaxHP,
  9. bool needModelSubscription, bool fluid)
  10. : ReferenceCounter(),
  11. id(id),
  12. needsInstance(needsInstance),
  13. model(model),
  14. initialMaxHP(initialMaxHP),
  15. needModelSubscription(needModelSubscription),
  16. fluid(fluid)
  17. {}
  18. BlockType::~BlockType() {}
  19. Block* BlockType::createBlock(Framework::Vec3<int> position)
  20. {
  21. return new Block(this,
  22. position,
  23. model.getModel(),
  24. model.getTexture(),
  25. initialMaxHP,
  26. model.isTransparent(),
  27. needModelSubscription);
  28. }
  29. int BlockType::getId() const
  30. {
  31. return id;
  32. }
  33. bool BlockType::doesNeedInstance() const
  34. {
  35. return needsInstance;
  36. }
  37. bool BlockType::doesNeedModelSubscription() const
  38. {
  39. return needModelSubscription;
  40. }
  41. bool BlockType::isFluid() const
  42. {
  43. return fluid;
  44. }
  45. const ModelInfo& BlockType::getModelInfo() const
  46. {
  47. return model;
  48. }