StaticInitializerOrder.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. #include "BlockType.h"
  2. #include "ItemType.h"
  3. #include "StaticRegistry.h"
  4. // block types
  5. #include "BasicBlocks.h"
  6. #include "Grass.h"
  7. #include "GrowingPlant.h"
  8. #include "NoBlock.h"
  9. #include "TreeSeblingBlock.h"
  10. // fluid blocks
  11. #include "FluidBlock.h"
  12. // dimensions
  13. #include "OverworldDimension.h"
  14. // entities
  15. #include "ItemEntity.h"
  16. #include "Player.h"
  17. // item skills
  18. #include "BasicItems.h"
  19. #include "PlayerHand.h"
  20. #include "StoneTool.h"
  21. // world updates
  22. #include "AddEntityUpdate.h"
  23. #include "EntityRemovedUpdate.h"
  24. // Multiblocks
  25. #include "Game.h"
  26. #include "Hoe.h"
  27. #include "LightSources.h"
  28. #include "MultiblockTree.h"
  29. using namespace Framework;
  30. void initializeBlockTypes()
  31. {
  32. new NoBlockBlockType(BlockTypeEnum::NO_BLOCK, &NoBlock::INSTANCE);
  33. new NoBlockBlockType(BlockTypeEnum::AIR, &AirBlock::INSTANCE);
  34. (new BasicBlockType(BlockTypeEnum::DIRT,
  35. ItemTypeEnum::DIRT,
  36. ModelInfo("cube",
  37. {"blocks.ltdb/dirt.png",
  38. "blocks.ltdb/dirt.png",
  39. "blocks.ltdb/dirt.png",
  40. "blocks.ltdb/dirt.png",
  41. "blocks.ltdb/lawn.png",
  42. "blocks.ltdb/dirt.png"}),
  43. "Dirt"))
  44. ->initializeDefault();
  45. (new BasicBlockType(BlockTypeEnum::STONE,
  46. ItemTypeEnum::STONE,
  47. ModelInfo("cube", "blocks.ltdb/stone.png", 6),
  48. "Stone"))
  49. ->setHardness(2.f)
  50. ->initializeDefault();
  51. (new BasicBlockType(BlockTypeEnum::SAND,
  52. ItemTypeEnum::SAND,
  53. ModelInfo("cube", "blocks.ltdb/sand.png", 6),
  54. "Sand"))
  55. ->setHardness(0.5f)
  56. ->initializeDefault();
  57. (new BasicBlockType(BlockTypeEnum::WOOD_OAK,
  58. ItemTypeEnum::WOOD_OAK,
  59. ModelInfo("cube", "blocks.ltdb/oak.png", 6),
  60. "Oak Wood"))
  61. ->setHardness(1.5f)
  62. ->initializeDefault();
  63. (new BasicBlockType(
  64. BlockTypeEnum::LEAVES_WOOD_OAK,
  65. ItemTypeEnum::LEAVES_WOOD_OAK,
  66. ModelInfo("cube", "blocks.ltdb/leaves.png", 6),
  67. [](Vec3<int> pos) {
  68. AdditionalItemSpawningBlock* block
  69. = new AdditionalItemSpawningBlock(
  70. BlockTypeEnum::LEAVES_WOOD_OAK, 0, pos);
  71. block->addSpawn({1, 1, 0.015, ItemTypeEnum::SEBLING_WOOD_OAK});
  72. return (Block*)block;
  73. },
  74. "Oak Wood Leaves"))
  75. ->setHardness(0.1f)
  76. ->initializeDefault();
  77. (new BasicBlockType(BlockTypeEnum::GRAVEL,
  78. ItemTypeEnum::GRAVEL,
  79. ModelInfo("cube", "blocks.ltdb/gravel.png", 6),
  80. "Gravel"))
  81. ->setHardness(0.75f)
  82. ->initializeDefault();
  83. (new BasicBlockType(BlockTypeEnum::STONE_GRANITE,
  84. ItemTypeEnum::STONE_GRANITE,
  85. ModelInfo("cube", "blocks.ltdb/granite.png", 6),
  86. "Granite Stone"))
  87. ->setHardness(3.f)
  88. ->initializeDefault();
  89. (new BasicBlockType(BlockTypeEnum::STONE_COBBLE,
  90. ItemTypeEnum::STONE_COBBLE,
  91. ModelInfo("cube", "blocks.ltdb/cobble.png", 6),
  92. "Cobble Stone"))
  93. ->setHardness(1.f)
  94. ->initializeDefault();
  95. (new BasicBlockType(BlockTypeEnum::WOOD_BIRCH,
  96. ItemTypeEnum::WOOD_BIRCH,
  97. ModelInfo("cube", "blocks.ltdb/birch.png", 6),
  98. "Birch Wood"))
  99. ->setHardness(1.5f)
  100. ->initializeDefault();
  101. (new BasicBlockType(
  102. BlockTypeEnum::LEAVES_WOOD_BIRCH,
  103. ItemTypeEnum::LEAVES_WOOD_BIRCH,
  104. ModelInfo("cube", "blocks.ltdb/leaves.png", 6),
  105. [](Vec3<int> pos) {
  106. AdditionalItemSpawningBlock* block
  107. = new AdditionalItemSpawningBlock(
  108. BlockTypeEnum::LEAVES_WOOD_BIRCH, 0, pos);
  109. block->addSpawn({1, 1, 0.03, ItemTypeEnum::SEBLING_WOOD_BIRCH});
  110. return (Block*)block;
  111. },
  112. "Birch Wood Leaves"))
  113. ->setHardness(0.1f)
  114. ->initializeDefault();
  115. (new BasicBlockType(BlockTypeEnum::WOOD_BEECH,
  116. ItemTypeEnum::WOOD_BEECH,
  117. ModelInfo("cube", "blocks.ltdb/beech.png", 6),
  118. "Beech Wood"))
  119. ->setHardness(1.5f)
  120. ->initializeDefault();
  121. (new BasicBlockType(
  122. BlockTypeEnum::LEAVES_WOOD_BEECH,
  123. ItemTypeEnum::LEAVES_WOOD_BEECH,
  124. ModelInfo("cube", "blocks.ltdb/leaves.png", 6),
  125. [](Vec3<int> pos) {
  126. AdditionalItemSpawningBlock* block
  127. = new AdditionalItemSpawningBlock(
  128. BlockTypeEnum::LEAVES_WOOD_BEECH, 0, pos);
  129. block->addSpawn({1, 1, 0.02, ItemTypeEnum::SEBLING_WOOD_BEECH});
  130. return (Block*)block;
  131. },
  132. "Beech Wood Leaves"))
  133. ->setHardness(0.1f)
  134. ->initializeDefault();
  135. (new BasicBlockType(BlockTypeEnum::STONE_BASALT,
  136. ItemTypeEnum::STONE_BASALT,
  137. ModelInfo("cube", "blocks.ltdb/basalt.png", 6),
  138. "Basalt Stone"))
  139. ->setHardness(2.f)
  140. ->initializeDefault();
  141. (new BasicBlockType(BlockTypeEnum::WOOD_PINE,
  142. ItemTypeEnum::WOOD_PINE,
  143. ModelInfo("cube", "blocks.ltdb/pine.png", 6),
  144. "Pine Wood"))
  145. ->setHardness(1.4f)
  146. ->initializeDefault();
  147. (new BasicBlockType(
  148. BlockTypeEnum::LEAVES_WOOD_PINE,
  149. ItemTypeEnum::LEAVES_WOOD_PINE,
  150. ModelInfo("cube", "blocks.ltdb/leaves.png", 6),
  151. [](Vec3<int> pos) {
  152. AdditionalItemSpawningBlock* block
  153. = new AdditionalItemSpawningBlock(
  154. BlockTypeEnum::LEAVES_WOOD_PINE, 0, pos);
  155. block->addSpawn({1, 1, 0.025, ItemTypeEnum::SEBLING_WOOD_PINE});
  156. return (Block*)block;
  157. },
  158. "Pine Wood Leaves"))
  159. ->setHardness(0.1f)
  160. ->initializeDefault();
  161. (new BasicLightSourceBlockType(BlockTypeEnum::TORCH,
  162. ItemTypeEnum::TORCH,
  163. ModelInfo("blocks.m3/torch", "blocks.ltdb/torch.png", 6),
  164. "Torch"))
  165. ->setHardness(0.f)
  166. ->setColor(0x00F69A54)
  167. ->initializeDefault();
  168. (new TreeSeblingBlockType(BlockTypeEnum::SEBLING_WOOD_OAK,
  169. ItemTypeEnum::SEBLING_WOOD_OAK,
  170. ModelInfo("blocks.m3/sebling", "blocks.ltdb/sebling.png", 1),
  171. BlockTypeEnum::WOOD_OAK,
  172. BlockTypeEnum::LEAVES_WOOD_OAK,
  173. "Oak Wood Sebling"))
  174. ->setHardness(0.1f)
  175. ->initializeDefault();
  176. (new TreeSeblingBlockType(BlockTypeEnum::SEBLING_WOOD_BIRCH,
  177. ItemTypeEnum::SEBLING_WOOD_BIRCH,
  178. ModelInfo("blocks.m3/sebling", "blocks.ltdb/sebling.png", 1),
  179. BlockTypeEnum::WOOD_BIRCH,
  180. BlockTypeEnum::LEAVES_WOOD_BIRCH,
  181. "Birch Wood Sebling"))
  182. ->setHardness(0.1f)
  183. ->initializeDefault();
  184. (new TreeSeblingBlockType(BlockTypeEnum::SEBLING_WOOD_BEECH,
  185. ItemTypeEnum::SEBLING_WOOD_BEECH,
  186. ModelInfo("blocks.m3/sebling", "blocks.ltdb/sebling.png", 1),
  187. BlockTypeEnum::WOOD_BEECH,
  188. BlockTypeEnum::LEAVES_WOOD_BEECH,
  189. "Beech Wood Sebling"))
  190. ->setHardness(0.1f)
  191. ->initializeDefault();
  192. (new TreeSeblingBlockType(BlockTypeEnum::SEBLING_WOOD_PINE,
  193. ItemTypeEnum::SEBLING_WOOD_PINE,
  194. ModelInfo("blocks.m3/sebling", "blocks.ltdb/sebling.png", 1),
  195. BlockTypeEnum::WOOD_PINE,
  196. BlockTypeEnum::LEAVES_WOOD_PINE,
  197. "Pine Wood Sebling"))
  198. ->setHardness(0.1f)
  199. ->initializeDefault();
  200. (new GrassBlockType(BlockTypeEnum::GRASS,
  201. ItemTypeEnum::GRASS,
  202. ModelInfo("grass", "blocks.ltdb/grass.png", 16).setTransparent(),
  203. "Grass"))
  204. ->initializeDefault();
  205. (new BasicBlockType(BlockTypeEnum::FARMLAND,
  206. ItemTypeEnum::DIRT,
  207. ModelInfo("cube",
  208. {"blocks.ltdb/dirt.png",
  209. "blocks.ltdb/dirt.png",
  210. "blocks.ltdb/dirt.png",
  211. "blocks.ltdb/dirt.png",
  212. "blocks.ltdb/farmland.png",
  213. "blocks.ltdb/dirt.png"}),
  214. "Farmland"))
  215. ->setTransparent(1)
  216. ->setHardness(0.1f)
  217. ->initializeDefault();
  218. (new GrowingPlantBlockType(BlockTypeEnum::WHEAT_SEED,
  219. ModelInfo("grass", "plants.ltdb/wheatseeds.png", 16).setTransparent(),
  220. "WheatSeeds",
  221. BlockTypeEnum::WHEAT,
  222. "Growing wheat",
  223. 18000))
  224. ->addGrowthState(0.2f,
  225. ModelInfo("grass", "plants.ltdb/wheatseedsa.png", 16)
  226. .setTransparent())
  227. ->addGrowthState(0.4f,
  228. ModelInfo("grass", "plants.ltdb/wheatseedsb.png", 16)
  229. .setTransparent())
  230. ->addGrowthState(0.6f,
  231. ModelInfo("grass", "plants.ltdb/wheatseedsc.png", 16)
  232. .setTransparent())
  233. ->addGrowthState(0.8f,
  234. ModelInfo("grass", "plants.ltdb/wheatseedsd.png", 16)
  235. .setTransparent())
  236. ->initializeDefault();
  237. (new BasicBlockType(
  238. BlockTypeEnum::WHEAT,
  239. ItemTypeEnum::WHEAT,
  240. ModelInfo("grass", "plants.ltdb/wheat.png", 16).setTransparent(),
  241. [](Vec3<int> pos) {
  242. AdditionalItemSpawningBlock* block
  243. = new AdditionalItemSpawningBlock(
  244. BlockTypeEnum::WHEAT, 0, pos);
  245. block->addSpawn({0, 4, 1.0, ItemTypeEnum::WHEAT});
  246. return (Block*)block;
  247. },
  248. "Wheat"))
  249. ->initializeDefault();
  250. (new FluidBlockType(BlockTypeEnum::WATER,
  251. ModelInfo("fluid", "fluids.ltdb/water.png", 6),
  252. "Water"))
  253. ->initializeDefault();
  254. }
  255. void initializeItemTypes()
  256. {
  257. (new BasicBlockItemType(ItemTypeEnum::DIRT,
  258. "Dirt",
  259. 0,
  260. 0,
  261. ModelInfo("itemCube", "blocks.ltdb/dirt.png", 6),
  262. BlockTypeEnum::DIRT));
  263. (new BasicBlockItemType(ItemTypeEnum::STONE,
  264. "Stone",
  265. 0,
  266. 0,
  267. ModelInfo("itemCube", "blocks.ltdb/stone.png", 6),
  268. BlockTypeEnum::STONE))
  269. ->setHardness(2.f);
  270. (new BasicBlockItemType(ItemTypeEnum::SAND,
  271. "Sand",
  272. 0,
  273. 0,
  274. ModelInfo("itemCube", "blocks.ltdb/sand.png", 6),
  275. BlockTypeEnum::SAND))
  276. ->setHardness(0.5f);
  277. (new BasicBlockItemType(ItemTypeEnum::WOOD_OAK,
  278. "Oak",
  279. 0,
  280. 0,
  281. ModelInfo("itemCube", "blocks.ltdb/oak.png", 6),
  282. BlockTypeEnum::WOOD_OAK))
  283. ->setHardness(1.5f);
  284. (new BasicBlockItemType(ItemTypeEnum::LEAVES_WOOD_OAK,
  285. "Oak Leaves",
  286. 0,
  287. 0,
  288. ModelInfo("itemCube", "blocks.ltdb/leaves.png", 6),
  289. BlockTypeEnum::LEAVES_WOOD_OAK))
  290. ->setHardness(0.1f);
  291. (new BasicBlockItemType(ItemTypeEnum::SEBLING_WOOD_OAK,
  292. "Oak Sebling",
  293. 0,
  294. 0,
  295. ModelInfo("blocks.m3/sebling", "blocks.ltdb/sebling.png", 1),
  296. BlockTypeEnum::SEBLING_WOOD_OAK))
  297. ->setHardness(0.1f);
  298. (new BasicBlockItemType(ItemTypeEnum::GRAVEL,
  299. "Gravel",
  300. 0,
  301. 0,
  302. ModelInfo("itemCube", "blocks.ltdb/gravel.png", 6),
  303. BlockTypeEnum::GRAVEL))
  304. ->setHardness(0.75f);
  305. (new BasicBlockItemType(ItemTypeEnum::STONE_GRANITE,
  306. "Granite",
  307. 0,
  308. 0,
  309. ModelInfo("itemCube", "blocks.ltdb/granite.png", 6),
  310. BlockTypeEnum::STONE_GRANITE))
  311. ->setHardness(3.f);
  312. (new BasicBlockItemType(ItemTypeEnum::STONE_COBBLE,
  313. "Cobble",
  314. 0,
  315. 0,
  316. ModelInfo("itemCube", "blocks.ltdb/cobble.png", 6),
  317. BlockTypeEnum::STONE_COBBLE))
  318. ->setHardness(1.f);
  319. (new BasicBlockItemType(ItemTypeEnum::WOOD_BIRCH,
  320. "Birch",
  321. 0,
  322. 0,
  323. ModelInfo("itemCube", "blocks.ltdb/birch.png", 6),
  324. BlockTypeEnum::WOOD_BIRCH))
  325. ->setHardness(1.5f);
  326. (new BasicBlockItemType(ItemTypeEnum::LEAVES_WOOD_BIRCH,
  327. "Birch Leaves",
  328. 0,
  329. 0,
  330. ModelInfo("itemCube", "blocks.ltdb/leaves.png", 6),
  331. BlockTypeEnum::LEAVES_WOOD_BIRCH))
  332. ->setHardness(0.1f);
  333. (new BasicBlockItemType(ItemTypeEnum::SEBLING_WOOD_BIRCH,
  334. "Birch Sebling",
  335. 0,
  336. 0,
  337. ModelInfo("blocks.m3/sebling", "blocks.ltdb/sebling.png", 1),
  338. BlockTypeEnum::SEBLING_WOOD_BIRCH))
  339. ->setHardness(0.1f);
  340. (new BasicBlockItemType(ItemTypeEnum::WOOD_BEECH,
  341. "Beech",
  342. 0,
  343. 0,
  344. ModelInfo("itemCube", "blocks.ltdb/beech.png", 6),
  345. BlockTypeEnum::WOOD_BEECH))
  346. ->setHardness(1.5f);
  347. (new BasicBlockItemType(ItemTypeEnum::LEAVES_WOOD_BEECH,
  348. "Beech Leaves",
  349. 0,
  350. 0,
  351. ModelInfo("itemCube", "blocks.ltdb/leaves.png", 6),
  352. BlockTypeEnum::LEAVES_WOOD_BEECH))
  353. ->setHardness(0.1f);
  354. (new BasicBlockItemType(ItemTypeEnum::SEBLING_WOOD_BEECH,
  355. "Beech Sebling",
  356. 0,
  357. 0,
  358. ModelInfo("blocks.m3/sebling", "blocks.ltdb/sebling.png", 1),
  359. BlockTypeEnum::SEBLING_WOOD_BEECH))
  360. ->setHardness(0.1f);
  361. (new BasicBlockItemType(ItemTypeEnum::STONE_BASALT,
  362. "Basalt",
  363. 0,
  364. 0,
  365. ModelInfo("itemCube", "blocks.ltdb/basalt.png", 6),
  366. BlockTypeEnum::STONE_BASALT))
  367. ->setHardness(2.f);
  368. (new BasicBlockItemType(ItemTypeEnum::WOOD_PINE,
  369. "Pine",
  370. 0,
  371. 0,
  372. ModelInfo("itemCube", "blocks.ltdb/pine.png", 6),
  373. BlockTypeEnum::WOOD_PINE))
  374. ->setHardness(1.4f);
  375. (new BasicBlockItemType(ItemTypeEnum::LEAVES_WOOD_PINE,
  376. "Pine Leaves",
  377. 0,
  378. 0,
  379. ModelInfo("itemCube", "blocks.ltdb/leaves.png", 6),
  380. BlockTypeEnum::LEAVES_WOOD_PINE))
  381. ->setHardness(0.1f);
  382. (new BasicBlockItemType(ItemTypeEnum::SEBLING_WOOD_PINE,
  383. "Pine Sebling",
  384. 0,
  385. 0,
  386. ModelInfo("blocks.m3/sebling", "blocks.ltdb/sebling.png", 1),
  387. BlockTypeEnum::SEBLING_WOOD_PINE))
  388. ->setHardness(0.1f);
  389. (new LightSourceItemType(ItemTypeEnum::TORCH,
  390. "Torch",
  391. ModelInfo("items.m3/stick", "blocks.ltdb/torch.png", 6),
  392. BlockTypeEnum::TORCH))
  393. ->setColor(0x00F69A54);
  394. new PlayerHandItemType();
  395. new StoneToolItemType();
  396. (new NoBlockItemType(ItemTypeEnum::WOOD_STICK,
  397. "WoodenStick",
  398. 0,
  399. 0,
  400. ModelInfo("items.m3/stick", "items.ltdb/stick.png", 1),
  401. []() {
  402. return ItemType::createBasicItem(ItemTypeEnum::WOOD_STICK,
  403. "Wooden Stick",
  404. 1.f,
  405. 1.f,
  406. 10.f,
  407. 10.f,
  408. 0,
  409. 0,
  410. 0,
  411. 1,
  412. 0,
  413. 50);
  414. }));
  415. (new NoBlockItemType(ItemTypeEnum::RESIN,
  416. "Resin",
  417. 0,
  418. 0,
  419. ModelInfo("itemCube", "items.ltdb/resin.png", 6),
  420. []() {
  421. return ItemType::createBasicItem(ItemTypeEnum::RESIN,
  422. "Resin",
  423. 1.f,
  424. 1.f,
  425. 10.f,
  426. 10.f,
  427. 0,
  428. 0,
  429. 0,
  430. 1,
  431. 0,
  432. 50);
  433. }));
  434. (new NoBlockItemType(ItemTypeEnum::STONE_TOOL_BROKEN,
  435. "BrokenStoneTool",
  436. 0,
  437. 0,
  438. ModelInfo("itemCube", "blocks.ltdb/stone.png", 6),
  439. []() {
  440. return ItemType::createBasicItem(ItemTypeEnum::STONE_TOOL_BROKEN,
  441. "Broken Stone Tool",
  442. 100.f,
  443. 100.f,
  444. 100.f,
  445. 100.f,
  446. 0,
  447. 0,
  448. 0,
  449. 1,
  450. 0,
  451. 10);
  452. }));
  453. new HoeToolItemType();
  454. new NoBlockItemType(ItemTypeEnum::BROKEN_HOE,
  455. "BrokenHoe",
  456. 0,
  457. 0,
  458. ModelInfo("tools.m3/hoe", "tools.ltdb/stonehoe", 1),
  459. []() {
  460. return ItemType::createBasicItem(ItemTypeEnum::STONE_TOOL_BROKEN,
  461. "Broken Hoe",
  462. 100.f,
  463. 100.f,
  464. 100.f,
  465. 100.f,
  466. 0,
  467. 0,
  468. 0,
  469. 1,
  470. 0,
  471. 10);
  472. });
  473. (new NoBlockItemType(ItemTypeEnum::FLINT,
  474. "Flint",
  475. 0,
  476. 0,
  477. ModelInfo("items.m3/flint", "items.ltdb/flint.png", 1),
  478. []() {
  479. return ItemType::createBasicItem(ItemTypeEnum::FLINT,
  480. "Flint",
  481. 1.f,
  482. 1.f,
  483. 10.f,
  484. 10.f,
  485. 0,
  486. 0,
  487. 0,
  488. 1,
  489. 0,
  490. 50);
  491. }));
  492. (new BasicBlockItemType(ItemTypeEnum::WHEAT_SEED,
  493. "Wheat Seeds",
  494. 0,
  495. 0,
  496. ModelInfo("grass", "plants.ltdb/wheatseeds.png", 16),
  497. BlockTypeEnum::WHEAT_SEED))
  498. ->setHardness(0.1f)
  499. ->setPlacableProof(
  500. [](const Item* self,
  501. int dimensionId,
  502. Framework::Vec3<int> worldPos) {
  503. if (worldPos.z > 0)
  504. {
  505. auto below = Game::INSTANCE->zBlockAt(
  506. worldPos + getDirection(Direction::BOTTOM),
  507. dimensionId);
  508. return (below.isA()
  509. && below.getA()->zBlockType()->getId()
  510. == BlockTypeEnum::FARMLAND)
  511. || (below.isB()
  512. && below.getB() == BlockTypeEnum::FARMLAND);
  513. }
  514. return (bool)0;
  515. },
  516. 1);
  517. (new NoBlockItemType(ItemTypeEnum::WHEAT,
  518. "Wheat",
  519. 0,
  520. 0,
  521. ModelInfo("grass", "plants.ltdb/wheat.png", 16),
  522. []() {
  523. Item *item = ItemType::createBasicItem(ItemTypeEnum::WHEAT,
  524. "Wheat",
  525. 1.f,
  526. 1.f,
  527. 10.f,
  528. 10.f,
  529. 1,
  530. 0,
  531. 0,
  532. 1,
  533. 0,
  534. 50);
  535. item->setFoodEffect([](Entity* zEntity) {
  536. zEntity->setHunger(zEntity->getHunger() + 0.5f);
  537. zEntity->setThirst(zEntity->getThirst() + 1.f); // TODO: remove thirst addition when water exists
  538. });
  539. return item;
  540. }));
  541. }
  542. void initializeEntityTypes()
  543. {
  544. new PlayerEntityType();
  545. new ItemEntityType();
  546. }
  547. void initializeDimensions()
  548. {
  549. new OverworldDimension();
  550. }
  551. void initializeMultiblockTypes()
  552. {
  553. new MultiblockTreeStructureType();
  554. }