BlockType.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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,
  10. bool fluid,
  11. char maxFlowDistance)
  12. : ReferenceCounter(),
  13. id(id),
  14. needsInstance(needsInstance),
  15. model(model),
  16. initialMaxHP(initialMaxHP),
  17. needModelSubscription(needModelSubscription),
  18. fluid(fluid),
  19. maxFlowDistance(maxFlowDistance)
  20. {}
  21. BlockType::~BlockType() {}
  22. Block* BlockType::createBlock(Framework::Vec3<int> position)
  23. {
  24. return new Block(this,
  25. position,
  26. model.getModel(),
  27. model.getTexture(),
  28. initialMaxHP,
  29. model.isTransparent(),
  30. needModelSubscription);
  31. }
  32. int BlockType::getId() const
  33. {
  34. return id;
  35. }
  36. bool BlockType::doesNeedInstance() const
  37. {
  38. return needsInstance;
  39. }
  40. bool BlockType::doesNeedModelSubscription() const
  41. {
  42. return needModelSubscription;
  43. }
  44. bool BlockType::isFluid() const
  45. {
  46. return fluid;
  47. }
  48. char BlockType::getMaxFlowDistance() const
  49. {
  50. return maxFlowDistance;
  51. }
  52. const ModelInfo& BlockType::getModelInfo() const
  53. {
  54. return model;
  55. }