| 523 | } |
| 524 | |
| 525 | List<BiomeItemPlacement> WorldTemplate::validBiomeItems(int x, int y, PotentialBiomeItems potentialBiomeItems) const { |
| 526 | if (y <= 0 || y >= (int)m_geometry.height() - 1) |
| 527 | return {}; |
| 528 | |
| 529 | x = m_geometry.xwrap(x); |
| 530 | |
| 531 | auto block = getBlockInfo(x, y); |
| 532 | |
| 533 | if (block.biomeTransition) |
| 534 | return {}; |
| 535 | List<BiomeItemPlacement> biomeItems; |
| 536 | |
| 537 | auto blockAbove = getBlockInfo(x, y + 1); |
| 538 | auto blockBelow = getBlockInfo(x, y - 1); |
| 539 | |
| 540 | if (!blockBelow.biomeTransition && blockBelow.terrain && !block.terrain && !blockBelow.foregroundCave) |
| 541 | biomeItems.appendAll(std::move(potentialBiomeItems.surfaceBiomeItems)); |
| 542 | |
| 543 | if (!blockBelow.biomeTransition && blockBelow.terrain && block.terrain && !blockBelow.foregroundCave && block.foregroundCave) |
| 544 | biomeItems.appendAll(std::move(potentialBiomeItems.caveSurfaceBiomeItems)); |
| 545 | |
| 546 | if (!blockAbove.biomeTransition && blockAbove.terrain && block.terrain && !blockAbove.foregroundCave && block.foregroundCave) |
| 547 | biomeItems.appendAll(std::move(potentialBiomeItems.caveCeilingBiomeItems)); |
| 548 | |
| 549 | if (block.terrain && block.foregroundCave && !block.backgroundCave) |
| 550 | biomeItems.appendAll(std::move(potentialBiomeItems.caveBackgroundBiomeItems)); |
| 551 | |
| 552 | if (block.oceanLiquid != EmptyLiquidId && y == block.oceanLiquidLevel) |
| 553 | biomeItems.appendAll(std::move(potentialBiomeItems.oceanItems)); |
| 554 | |
| 555 | return biomeItems; |
| 556 | } |
| 557 | |
| 558 | float WorldTemplate::gravity() const { |
| 559 | if (m_worldParameters) |
no test coverage detected