BasicBlocks.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. #pragma once
  2. #include "Block.h"
  3. #include "BlockType.h"
  4. #include "Item.h"
  5. class BlockType;
  6. class ItemType;
  7. class BasicBlockType;
  8. class BasicBlock : public Block
  9. {
  10. public:
  11. BasicBlock(const BlockType* zType, ItemType* zTool, Framework::Vec3<int> pos);
  12. virtual bool onTick(TickQueue* zQueue, int numTicks, bool& blocked) override;
  13. virtual void onPostTick() override;
  14. friend BasicBlockType;
  15. };
  16. class BasicBlockType : public BlockType
  17. {
  18. private:
  19. int itemType;
  20. protected:
  21. bool transparent;
  22. bool passable;
  23. float hardness;
  24. ItemType* zTool;
  25. float speedModifier;
  26. bool interactable;
  27. BasicBlockType(int typeId, int itemTypeId, ModelInfo model);
  28. virtual void createSuperBlock(Block* zBlock, Item* zItem) const override;
  29. public:
  30. virtual Block* createBlock(Framework::Vec3<int> position) const override;
  31. virtual Item* createItem() const override;
  32. };
  33. // Dirt
  34. class DirtBlockItemType : public BasicBlockItemType
  35. {
  36. REGISTRABLE(DirtBlockItemType)
  37. protected:
  38. DirtBlockItemType();
  39. public:
  40. virtual Item* createItem() const override;
  41. };
  42. REGISTER(DirtBlockItemType, ItemType)
  43. class DirtBlockType : public BasicBlockType
  44. {
  45. REGISTRABLE(DirtBlockType)
  46. protected:
  47. DirtBlockType();
  48. };
  49. REGISTER(DirtBlockType, BlockType)
  50. // Stone
  51. class StoneBlockItemType : public BasicBlockItemType
  52. {
  53. REGISTRABLE(StoneBlockItemType)
  54. protected:
  55. StoneBlockItemType();
  56. public:
  57. virtual Item* createItem() const override;
  58. };
  59. REGISTER(StoneBlockItemType, ItemType)
  60. class StoneBlockType : public BasicBlockType
  61. {
  62. REGISTRABLE(StoneBlockType)
  63. protected:
  64. StoneBlockType();
  65. };
  66. REGISTER(StoneBlockType, BlockType)
  67. // Sand
  68. class SandBlockItemType : public BasicBlockItemType
  69. {
  70. REGISTRABLE(SandBlockItemType)
  71. protected:
  72. SandBlockItemType();
  73. public:
  74. virtual Item* createItem() const override;
  75. };
  76. REGISTER(SandBlockItemType, ItemType)
  77. class SandBlockType : public BasicBlockType
  78. {
  79. REGISTRABLE(SandBlockType)
  80. protected:
  81. SandBlockType();
  82. };
  83. REGISTER(SandBlockType, BlockType)
  84. // Oak Wood
  85. class OakBlockItemType : public BasicBlockItemType
  86. {
  87. REGISTRABLE(OakBlockItemType)
  88. protected:
  89. OakBlockItemType();
  90. public:
  91. virtual Item* createItem() const override;
  92. };
  93. REGISTER(OakBlockItemType, ItemType)
  94. class OakBlockType : public BasicBlockType
  95. {
  96. REGISTRABLE(OakBlockType)
  97. protected:
  98. OakBlockType();
  99. };
  100. REGISTER(OakBlockType, BlockType)
  101. // Leaves
  102. class LeavesBlockItemType : public BasicBlockItemType
  103. {
  104. REGISTRABLE(LeavesBlockItemType)
  105. protected:
  106. LeavesBlockItemType();
  107. public:
  108. virtual Item* createItem() const override;
  109. };
  110. REGISTER(LeavesBlockItemType, ItemType)
  111. class LeavesBlockType : public BasicBlockType
  112. {
  113. REGISTRABLE(LeavesBlockType)
  114. protected:
  115. LeavesBlockType();
  116. };
  117. REGISTER(LeavesBlockType, BlockType)
  118. // Gravel
  119. class GravelBlockItemType : public BasicBlockItemType
  120. {
  121. REGISTRABLE(GravelBlockItemType)
  122. protected:
  123. GravelBlockItemType();
  124. public:
  125. virtual Item* createItem() const override;
  126. };
  127. REGISTER(GravelBlockItemType, ItemType)
  128. class GravelBlockType : public BasicBlockType
  129. {
  130. REGISTRABLE(GravelBlockType)
  131. protected:
  132. GravelBlockType();
  133. };
  134. REGISTER(GravelBlockType, BlockType)
  135. // Granite
  136. class GraniteBlockItemType : public BasicBlockItemType
  137. {
  138. REGISTRABLE(GraniteBlockItemType)
  139. protected:
  140. GraniteBlockItemType();
  141. public:
  142. virtual Item* createItem() const override;
  143. };
  144. REGISTER(GraniteBlockItemType, ItemType)
  145. class GraniteBlockType : public BasicBlockType
  146. {
  147. REGISTRABLE(GraniteBlockType)
  148. protected:
  149. GraniteBlockType();
  150. };
  151. REGISTER(GraniteBlockType, BlockType)
  152. // Cobble
  153. class CobbleBlockItemType : public BasicBlockItemType
  154. {
  155. REGISTRABLE(CobbleBlockItemType)
  156. protected:
  157. CobbleBlockItemType();
  158. public:
  159. virtual Item* createItem() const override;
  160. };
  161. REGISTER(CobbleBlockItemType, ItemType)
  162. class CobbleBlockType : public BasicBlockType
  163. {
  164. REGISTRABLE(CobbleBlockType)
  165. protected:
  166. CobbleBlockType();
  167. };
  168. REGISTER(CobbleBlockType, BlockType)
  169. // Birch Wood
  170. class BirchBlockItemType : public BasicBlockItemType
  171. {
  172. REGISTRABLE(BirchBlockItemType)
  173. protected:
  174. BirchBlockItemType();
  175. public:
  176. virtual Item* createItem() const override;
  177. };
  178. REGISTER(BirchBlockItemType, ItemType)
  179. class BirchBlockType : public BasicBlockType
  180. {
  181. REGISTRABLE(BirchBlockType)
  182. protected:
  183. BirchBlockType();
  184. };
  185. REGISTER(BirchBlockType, BlockType)
  186. // Beech Wood
  187. class BeechBlockItemType : public BasicBlockItemType
  188. {
  189. REGISTRABLE(BeechBlockItemType)
  190. protected:
  191. BeechBlockItemType();
  192. public:
  193. virtual Item* createItem() const override;
  194. };
  195. REGISTER(BeechBlockItemType, ItemType)
  196. class BeechBlockType : public BasicBlockType
  197. {
  198. REGISTRABLE(BeechBlockType)
  199. protected:
  200. BeechBlockType();
  201. };
  202. REGISTER(BeechBlockType, BlockType)
  203. // Basalt
  204. class BasaltBlockItemType : public BasicBlockItemType
  205. {
  206. REGISTRABLE(BasaltBlockItemType)
  207. protected:
  208. BasaltBlockItemType();
  209. public:
  210. virtual Item* createItem() const override;
  211. };
  212. REGISTER(BasaltBlockItemType, ItemType)
  213. class BasaltBlockType : public BasicBlockType
  214. {
  215. REGISTRABLE(BasaltBlockType)
  216. protected:
  217. BasaltBlockType();
  218. };
  219. REGISTER(BasaltBlockType, BlockType)