move Chunks from Level to Player

This commit is contained in:
MihailRis
2024-12-17 19:40:00 +03:00
parent b7664b4188
commit 1c18c02092
40 changed files with 450 additions and 220 deletions
+5 -4
View File
@@ -14,19 +14,20 @@ class Level;
class Chunk;
class Chunks;
class Lighting;
class GlobalChunks;
class ContentIndices;
enum class BlockInteraction { step, destruction, placing };
/// @brief Player argument is nullable
using on_block_interaction = std::function<
void(Player*, const glm::ivec3&, const Block&, BlockInteraction type)>;
void(Player*, const glm::ivec3&, const Block&, BlockInteraction)>;
/// BlocksController manages block updates and data (inventories, metadata)
class BlocksController {
const Level& level;
Chunks& chunks;
Lighting& lighting;
GlobalChunks& chunks;
Lighting* lighting;
util::Clock randTickClock;
util::Clock blocksTickClock;
util::Clock worldTickClock;
@@ -34,7 +35,7 @@ class BlocksController {
FastRandom random {};
std::vector<on_block_interaction> blockInteractionCallbacks;
public:
BlocksController(const Level& level, Lighting& lighting, uint padding);
BlocksController(const Level& level, Lighting* lighting, uint padding);
void updateSides(int x, int y, int z);
void updateSides(int x, int y, int z, int w, int h, int d);