27#if PROTOCOL_VERSION > 463
42 LOG_WARNING(
"Your version of botcraft hasn't been compiled with GUI enabled, setting use_renderer_ to false");
58 std::thread::id network_process_thread_id;
67#if PROTOCOL_VERSION > 463
85 world->UnloadAllChunks(network_process_thread_id);
103#if PROTOCOL_VERSION < 755
106 return transaction->GetUid();
175#if PROTOCOL_VERSION < 768
184 world = std::make_shared<World>(
false);
187 inventory_manager = std::make_shared<InventoryManager>();
188 entity_manager = std::make_shared<EntityManager>(network_manager);
190 network_manager->AddHandler(world.get());
191 network_manager->AddHandler(inventory_manager.get());
192 network_manager->AddHandler(entity_manager.get());
196 rendering_manager = std::make_shared<Renderer::RenderingManager>(world, inventory_manager, entity_manager, 800, 600,
CHUNK_WIDTH,
false);
197 network_manager->AddHandler(rendering_manager.get());
199 physics_manager = std::make_shared<PhysicsManager>(rendering_manager, inventory_manager, entity_manager, network_manager, world);
201 physics_manager = std::make_shared<PhysicsManager>(inventory_manager, entity_manager, network_manager, world);
203 network_manager->AddHandler(physics_manager.get());
205 physics_manager->StartPhysics();
211#if PROTOCOL_VERSION > 463
218#if PROTOCOL_VERSION > 768
222#if PROTOCOL_VERSION > 737
228#if PROTOCOL_VERSION < 464
243 std::shared_ptr<ServerboundClientInformationPacket> settings_packet = std::make_shared<ServerboundClientInformationPacket>();
244#if PROTOCOL_VERSION < 764
245 settings_packet->SetLanguage(
"fr_FR");
246 settings_packet->SetViewDistance(10);
248 settings_packet->SetChatColors(
true);
249 settings_packet->SetModelCustomisation(0xFF);
250 settings_packet->SetMainHand(1);
253 info.SetLanguage(
"fr_FR");
254 info.SetViewDistance(10);
256 info.SetChatColors(
true);
257 info.SetModelCustomisation(0xFF);
259#if PROTOCOL_VERSION > 767
260 info.SetParticleStatus(2);
262 settings_packet->SetClientInformation(info);
275#if PROTOCOL_VERSION > 768
279#if PROTOCOL_VERSION < 464
287 day_time = std::abs(packet.GetDayTime()) % 24000;
290#if PROTOCOL_VERSION < 761
293 if (packet.GetAction() == PlayerInfoAction::RemovePlayer)
296 for (
const auto& [uuid, infos] : packet.GetEntries())
301 else if (packet.GetAction() == PlayerInfoAction::AddPlayer)
304 for (
const auto& [uuid, infos] : packet.GetEntries())
306 if (infos.GetDisplayName().has_value())
308 player_names[uuid] = infos.GetDisplayName().value().GetText();
316 else if (packet.GetAction() == PlayerInfoAction::UpdateDisplayName)
319 for (
const auto& [uuid, infos] : packet.GetEntries())
321 if (infos.GetDisplayName().has_value())
323 player_names[uuid] = infos.GetDisplayName().value().GetText();
332 for (
const auto& uuid : packet.GetProfileIds())
340 for (
const auto& action : packet.GetActions())
342 if (action == PlayerInfoUpdateAction::AddPlayer)
345 for (
const auto& [uuid, infos] : packet.GetEntries())
351 if (action == PlayerInfoUpdateAction::UpdateDisplayName)
354 for (
const auto& [uuid, infos] : packet.GetEntries())
356 if (infos.display_name.has_value())
358 player_names[uuid] = infos.display_name.value().GetText();
#define LOG_WARNING(osstream)
static AssetsManager & getInstance()
void Respawn()
Ask to respawn when dead.
virtual void Handle(ProtocolCraft::ClientboundLoginDisconnectPacket &packet) override
virtual void Disconnect()
std::shared_ptr< NetworkManager > network_manager
std::atomic< int > day_time
std::map< ProtocolCraft::UUID, std::string > player_names
Names of all connected players.
std::shared_ptr< EntityManager > GetEntityManager() const
std::shared_ptr< PhysicsManager > GetPhysicsManager() const
virtual ~ManagersClient()
void SetSharedWorld(const std::shared_ptr< World > world_)
std::shared_ptr< Renderer::RenderingManager > rendering_manager
std::shared_ptr< LocalPlayer > GetLocalPlayer() const
void SetAutoRespawn(const bool b)
bool GetAutoRespawn() const
std::shared_ptr< InventoryManager > GetInventoryManager() const
virtual void Disconnect() override
ManagersClient(const bool use_renderer_)
std::shared_ptr< PhysicsManager > physics_manager
std::shared_ptr< InventoryManager > inventory_manager
std::shared_ptr< EntityManager > entity_manager
int SendInventoryTransaction(const std::shared_ptr< ProtocolCraft::ServerboundContainerClickPacket > &transaction)
std::shared_mutex player_names_mutex
std::shared_ptr< World > world
virtual void Handle(ProtocolCraft::ClientboundLoginFinishedPacket &packet) override
int GetDayTime() const
Get the current tick.
std::string GetPlayerName(const ProtocolCraft::UUID &uuid) const
Get the name of a connected player.
std::shared_ptr< World > GetWorld() const
static constexpr int CHUNK_WIDTH
std::array< unsigned char, 16 > UUID