21#include <unordered_map>
22#include <shared_mutex>
42 uint64_t my_player_id = 0
61 const uint64_t player_id,
63 const int8_t backward,
68 const double delta_time_second
71 const uint64_t player_id,
72 const double x_offset,
76 const uint64_t player_id
79 const uint64_t player_id,
83 const uint64_t player_id,
87 const uint64_t player_id
90 const double x_offset,
94 const uint64_t player_id,
95 std::function<
void(
Player &)> update
100 const double delta_time_second
102 void createBaseMob(
const glm::dvec3 & position, uint64_t player_id);
105 const glm::vec3 & position,
113 void addPlayer(
const uint64_t player_id,
const glm::dvec3 & position);
123 void addChunk(std::shared_ptr<Chunk> chunk);
124 void removeChunk(
const glm::ivec3 & chunkPosition);
128 std::shared_ptr<Chunk>
localGetChunk(
const glm::ivec3 & position)
const;
146 int m_render_distance = 16;
147 int m_server_load_distance = 0;
152 std::unordered_set<glm::ivec2> m_loaded_chunks;
153 TracyLockableN (std::mutex, m_loaded_chunks_mutex,
"Loaded Chunks");
158 std::unordered_set<glm::ivec2> m_chunks_to_mesh;
159 TracyLockableN (std::mutex, m_chunks_to_mesh_mutex,
"Chunks to mesh");
161 std::unordered_set<glm::ivec2> m_unload_set;
162 TracyLockableN (std::mutex, m_unload_set_mutex,
"Unload Set");
164 std::queue<std::pair<glm::vec3, BlockInfo::Type>> m_blocks_to_set;
165 TracyLockableN (std::mutex, m_blocks_to_set_mutex,
"Blocks to set");
167 std::queue<glm::ivec3> m_block_light_update;
168 TracyLockableN (std::mutex, m_block_light_update_mutex,
"Block light update");
183 void unloadChunk(
const glm::ivec3 & chunkPosition);
192 void meshChunks(
const glm::vec3 & playerPosition);
199 void meshChunk(
const glm::ivec2 & chunkPosition);
206 void updateChunks(
const glm::vec3 & playerPosition);
212 void setChunkNotMeshed(
const glm::ivec2 & chunkPosition);
218 bool hitboxCollisionWithBlock(
220 const glm::dvec3 & position,
221 const uint64_t block_properties
228 const glm::vec3 & origin,
229 const glm::vec3 & direction,
230 const double max_distance
236 void handleConnectionPacket(std::shared_ptr<ConnectionPacket> packet);
237 void handlePlayerMovePacket(std::shared_ptr<PlayerMovePacket> packet);
238 void handleDisconnectPacket(std::shared_ptr<DisconnectPacket> packet);
239 void handleBlockActionPacket(std::shared_ptr<BlockActionPacket> packet);
240 void handlePingPacket(std::shared_ptr<PingPacket> packet);
241 void handlePlayerListPacket(std::shared_ptr<PlayerListPacket> packet);
242 void handleChunkPacket(std::shared_ptr<ChunkPacket> packet);
243 void handleChunkUnloadPacket(std::shared_ptr<ChunkUnloadPacket> packet);
244 void handleLoadDistancePacket(std::shared_ptr<LoadDistancePacket> packet);
252 void MovementSystem(
const double delta_time_second);
Type
Definition: Block.hpp:33
A simple camera class.
Definition: Camera.hpp:41
Definition: ClientWorld.hpp:26
ClientWorld & operator=(ClientWorld &other)=delete
std::shared_ptr< Chunk > localGetChunk(const glm::ivec3 &position) const
Definition: ClientWorld.cpp:1155
void otherUpdate()
Definition: ClientWorld.cpp:419
PlayerUseResult playerUse(const uint64_t player_id, bool use)
Definition: ClientWorld.cpp:697
void applyPlayerMovement(const uint64_t &player_id, const glm::dvec3 &displacement)
Definition: ClientWorld.cpp:368
void addChunk(std::shared_ptr< Chunk > chunk)
Definition: ClientWorld.cpp:41
void updatePlayerTargetBlock(const uint64_t player_id)
Definition: ClientWorld.cpp:613
void handlePacket(std::shared_ptr< IPacket > packet)
Definition: ClientWorldNetwork.cpp:3
void setRenderDistance(const int &render_distance)
Definition: ClientWorld.cpp:1166
std::pair< glm::dvec3, glm::dvec3 > calculatePlayerMovement(const uint64_t player_id, const int8_t forward, const int8_t backward, const int8_t left, const int8_t right, const int8_t up, const int8_t down, const double delta_time_second)
Definition: ClientWorld.cpp:424
void setServerLoadDistance(const int &server_load_distance)
Definition: ClientWorld.cpp:1176
void updateBlock(glm::dvec3 position)
Definition: ClientWorld.cpp:27
ClientWorld(ClientWorld &other)=delete
void updatePlayerPosition(const uint64_t &player_id, const glm::dvec3 &position)
Definition: ClientWorld.cpp:384
void modifyBlock(const glm::vec3 &position, const BlockInfo::Type &block_id)
Definition: ClientWorld.cpp:1138
void updatePlayer(const uint64_t player_id, std::function< void(Player &)> update)
Definition: ClientWorld.cpp:792
void manageScroll(const double x_offset, const double y_offset)
Definition: ClientWorld.cpp:780
void updateMobs(const double delta_time_second)
Definition: ClientWorld.cpp:824
void updatePlayerCamera(const uint64_t player_id, const double x_offset, const double y_offset)
Definition: ClientWorld.cpp:739
int getServerLoadDistance() const
Definition: ClientWorld.cpp:1181
void updateSystems(const double delta_time_second)
Definition: ClientWorld.cpp:1258
std::pair< bool, glm::vec3 > playerAttack(const uint64_t player_id, bool attack)
Definition: ClientWorld.cpp:658
void addPlayer(const uint64_t player_id, const glm::dvec3 &position)
Definition: ClientWorld.cpp:1111
void changePlayerViewMode(const uint64_t player_id)
Definition: ClientWorld.cpp:760
~ClientWorld()
Definition: ClientWorld.cpp:23
glm::dvec3 getPlayerPosition(const uint64_t player_id)
Definition: ClientWorld.cpp:963
Camera getCamera(const uint64_t player_id)
Definition: ClientWorld.cpp:956
void removePlayer(const uint64_t player_id)
Definition: ClientWorld.cpp:1129
void removeChunk(const glm::ivec3 &chunkPosition)
Definition: ClientWorld.cpp:71
std::vector< glm::ivec3 > getNeededChunks(const glm::vec3 &playerPosition)
void createBaseMob(const glm::dvec3 &position, uint64_t player_id)
Definition: ClientWorld.cpp:1191
int getRenderDistance() const
Definition: ClientWorld.cpp:1171
void createMob()
Definition: ClientWorld.cpp:802
ClientWorld(ClientWorld &&other)=delete
ClientWorld & operator=(ClientWorld &&other)=delete
uint64_t m_my_player_id
Definition: ClientWorld.hpp:138
uint64_t createPlayer(const glm::vec3 &position)
The Client side interface with the network module.
Definition: Client.hpp:37
Definition: EventManager.hpp:63
Definition: HitBox.hpp:11
Type
Definition: Item.hpp:14
Definition: Player.hpp:32
Definition: RenderAPI.hpp:288
Definition: SoundEngine.hpp:42
This class is the main class of the ECS system you can use it to create entitites,...
Definition: Manager.hpp:34
Definition: ClientWorld.hpp:31
glm::vec3 block_position
Definition: ClientWorld.hpp:33
ItemInfo::Type used_item
Definition: ClientWorld.hpp:34
bool hit
Definition: ClientWorld.hpp:32
Definition: RenderAPI.hpp:168
Definition: Player.hpp:22
Definition: test_main.cpp:13