2019-03-17 17:22:53 +01:00
|
|
|
/*
|
|
|
|
* =====================================================================================
|
|
|
|
*
|
|
|
|
* Filename: ClientCommandHandler.hpp
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
*
|
|
|
|
* Created: 17/03/2019 17:01:13
|
|
|
|
*
|
|
|
|
* Author: Quentin Bazin, <quent42340@gmail.com>
|
|
|
|
*
|
|
|
|
* =====================================================================================
|
|
|
|
*/
|
|
|
|
#ifndef CLIENTCOMMANDHANDLER_HPP_
|
|
|
|
#define CLIENTCOMMANDHANDLER_HPP_
|
|
|
|
|
|
|
|
#include <unordered_map>
|
|
|
|
|
|
|
|
#include "PlayerBox.hpp"
|
|
|
|
|
|
|
|
namespace gk {
|
|
|
|
class Camera;
|
|
|
|
}
|
|
|
|
|
|
|
|
class Client;
|
|
|
|
class ClientPlayer;
|
|
|
|
class ClientWorld;
|
|
|
|
|
|
|
|
class ClientCommandHandler {
|
|
|
|
public:
|
|
|
|
ClientCommandHandler(Client &client, ClientWorld &world, ClientPlayer &player, gk::Camera &camera, std::unordered_map<u16, PlayerBox> &playerBoxes)
|
|
|
|
: m_client(client), m_world(world), m_player(player), m_camera(camera), m_playerBoxes(playerBoxes) {}
|
|
|
|
|
2019-04-08 12:59:02 +02:00
|
|
|
void sendPlayerInvUpdate();
|
2019-04-08 15:29:19 +02:00
|
|
|
void sendPlayerPosUpdate();
|
2019-04-08 12:59:02 +02:00
|
|
|
void sendPlayerDigBlock(const glm::vec4 &selectedBlock);
|
|
|
|
void sendPlayerPlaceBlock(s32 x, s32 y, s32 z, u32 block);
|
2020-02-08 02:48:39 +09:00
|
|
|
void sendPlayerInventoryRequest();
|
2019-04-08 12:59:02 +02:00
|
|
|
void sendBlockActivated(const glm::vec4 &selectedBlock);
|
|
|
|
void sendBlockInvUpdate(Inventory &inventory);
|
2020-01-20 13:40:07 +09:00
|
|
|
void sendChunkRequest(s32 chunkX, s32 chunkY, s32 chunkZ);
|
2019-04-08 12:59:02 +02:00
|
|
|
|
2019-03-17 17:22:53 +01:00
|
|
|
void setupCallbacks();
|
|
|
|
|
|
|
|
bool isRegistryInitialized() const { return m_isRegistryInitialized; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
Client &m_client;
|
|
|
|
ClientWorld &m_world;
|
|
|
|
ClientPlayer &m_player;
|
|
|
|
gk::Camera &m_camera;
|
|
|
|
|
|
|
|
std::unordered_map<u16, PlayerBox> &m_playerBoxes;
|
|
|
|
|
|
|
|
bool m_isRegistryInitialized = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CLIENTCOMMANDHANDLER_HPP_
|