Botcraft 1.21.4
Loading...
Searching...
No Matches
Botcraft::ManagersClient Class Reference

A client containing the different managers, and performing client-side physics. More...

#include <ManagersClient.hpp>

Inheritance diagram for Botcraft::ManagersClient:
Botcraft::ConnectionClient ProtocolCraft::Handler ProtocolCraft::GenericHandler< Message, AllMessages > Botcraft::BehaviourClient Botcraft::TemplatedBehaviourClient< SimpleBehaviourClient > Botcraft::TemplatedBehaviourClient< TDerived > Botcraft::SimpleBehaviourClient

Public Member Functions

 ManagersClient (const bool use_renderer_)
 
virtual ~ManagersClient ()
 
virtual void Disconnect () override
 
void SetSharedWorld (const std::shared_ptr< World > world_)
 
bool GetAutoRespawn () const
 
void SetAutoRespawn (const bool b)
 
int SendInventoryTransaction (const std::shared_ptr< ProtocolCraft::ServerboundContainerClickPacket > &transaction)
 
std::shared_ptr< WorldGetWorld () const
 
std::shared_ptr< EntityManagerGetEntityManager () const
 
std::shared_ptr< LocalPlayerGetLocalPlayer () const
 
std::shared_ptr< InventoryManagerGetInventoryManager () const
 
std::shared_ptr< PhysicsManagerGetPhysicsManager () const
 
std::string GetPlayerName (const ProtocolCraft::UUID &uuid) const
 Get the name of a connected player.
 
int GetDayTime () const
 Get the current tick.
 
- Public Member Functions inherited from Botcraft::ConnectionClient
 ConnectionClient ()
 
virtual ~ConnectionClient ()
 
void Connect (const std::string &address, const std::string &login, const bool force_microsoft_account=false)
 Connect the client to the server at address.
 
bool GetShouldBeClosed () const
 
void SetShouldBeClosed (const bool b)
 
std::shared_ptr< NetworkManagerGetNetworkManager () const
 
void SendChatMessage (const std::string &msg)
 Send a message in the game chat.
 
void SendChatCommand (const std::string &command)
 Send a command in the game chat.
 
void Respawn ()
 Ask to respawn when dead.
 

Protected Member Functions

virtual void Handle (ProtocolCraft::ClientboundLoginFinishedPacket &msg) override
 
virtual void Handle (ProtocolCraft::ClientboundChangeDifficultyPacket &msg) override
 
virtual void Handle (ProtocolCraft::ClientboundLoginPacket &msg) override
 
virtual void Handle (ProtocolCraft::ClientboundSetHealthPacket &msg) override
 
virtual void Handle (ProtocolCraft::ClientboundPlayerAbilitiesPacket &msg) override
 
virtual void Handle (ProtocolCraft::ClientboundPlayerPositionPacket &msg) override
 
virtual void Handle (ProtocolCraft::ClientboundRespawnPacket &msg) override
 
virtual void Handle (ProtocolCraft::ClientboundSetTimePacket &msg) override
 
virtual void Handle (ProtocolCraft::ClientboundPlayerInfoRemovePacket &msg) override
 
virtual void Handle (ProtocolCraft::ClientboundPlayerInfoUpdatePacket &msg) override
 
virtual void Handle (ProtocolCraft::ClientboundLoginDisconnectPacket &msg) override
 
virtual void Handle (ProtocolCraft::ClientboundDisconnectPacket &msg) override
 
virtual void Handle (ProtocolCraft::ClientboundPlayerPositionPacket &msg) override
 
virtual void Handle (ProtocolCraft::ClientboundDisconnectConfigurationPacket &msg) override
 
virtual void Handle (ProtocolCraft::ClientboundLoginPacket &msg) override
 
virtual void Handle (ProtocolCraft::ClientboundRespawnPacket &msg) override
 

Protected Attributes

std::shared_ptr< Worldworld
 
std::shared_ptr< EntityManagerentity_manager
 
std::shared_ptr< InventoryManagerinventory_manager
 
std::shared_ptr< PhysicsManagerphysics_manager
 
bool use_renderer
 
std::shared_ptr< Renderer::RenderingManagerrendering_manager
 
bool auto_respawn
 
Difficulty difficulty
 
bool difficulty_locked
 
bool is_hardcore
 
std::atomic< int > day_time
 
std::map< ProtocolCraft::UUID, std::string > player_names
 Names of all connected players.
 
std::shared_mutex player_names_mutex
 
- Protected Attributes inherited from Botcraft::ConnectionClient
std::shared_ptr< NetworkManagernetwork_manager
 
bool should_be_closed
 

Detailed Description

A client containing the different managers, and performing client-side physics.

Can be inherited if you want to handle other packets without a need of any behaviour tree stuff.

Definition at line 30 of file ManagersClient.hpp.

Constructor & Destructor Documentation

◆ ManagersClient()

Botcraft::ManagersClient::ManagersClient ( const bool  use_renderer_)

◆ ~ManagersClient()

Botcraft::ManagersClient::~ManagersClient ( )
virtual

Definition at line 51 of file ManagersClient.cpp.

References Disconnect().

Member Function Documentation

◆ Disconnect()

◆ GetAutoRespawn()

bool Botcraft::ManagersClient::GetAutoRespawn ( ) const

Definition at line 120 of file ManagersClient.cpp.

References auto_respawn.

◆ GetDayTime()

int Botcraft::ManagersClient::GetDayTime ( ) const

Get the current tick.

Returns
An int representing the time of day

Definition at line 95 of file ManagersClient.cpp.

References day_time.

Referenced by Botcraft::IsNightTime().

◆ GetEntityManager()

std::shared_ptr< EntityManager > Botcraft::ManagersClient::GetEntityManager ( ) const

Definition at line 135 of file ManagersClient.cpp.

References entity_manager.

Referenced by Botcraft::InteractEntityImpl(), and Botcraft::PlaceBlockImpl().

◆ GetInventoryManager()

◆ GetLocalPlayer()

◆ GetPhysicsManager()

◆ GetPlayerName()

std::string Botcraft::ManagersClient::GetPlayerName ( const ProtocolCraft::UUID uuid) const

Get the name of a connected player.

Parameters
uuidUUID of the player
Returns
The name, or empty string if not present

Definition at line 155 of file ManagersClient.cpp.

References entity_manager, Botcraft::ConnectionClient::network_manager, player_names, and player_names_mutex.

◆ GetWorld()

std::shared_ptr< World > Botcraft::ManagersClient::GetWorld ( ) const

◆ Handle() [1/16]

void Botcraft::ManagersClient::Handle ( ProtocolCraft::ClientboundChangeDifficultyPacket msg)
overrideprotectedvirtual

Definition at line 208 of file ManagersClient.cpp.

References difficulty, and difficulty_locked.

◆ Handle() [2/16]

void Botcraft::ConnectionClient::Handle ( ProtocolCraft::ClientboundDisconnectConfigurationPacket msg)
overrideprotectedvirtual

Reimplemented from Botcraft::ConnectionClient.

Definition at line 49 of file ConnectionClient.cpp.

◆ Handle() [3/16]

void Botcraft::ConnectionClient::Handle ( ProtocolCraft::ClientboundDisconnectPacket msg)
overrideprotectedvirtual

Reimplemented from Botcraft::ConnectionClient.

Definition at line 46 of file ConnectionClient.cpp.

◆ Handle() [4/16]

void Botcraft::ConnectionClient::Handle ( ProtocolCraft::ClientboundLoginDisconnectPacket msg)
overrideprotectedvirtual

Reimplemented from Botcraft::ConnectionClient.

Definition at line 42 of file ConnectionClient.cpp.

◆ Handle() [5/16]

void Botcraft::ManagersClient::Handle ( ProtocolCraft::ClientboundLoginFinishedPacket msg)
overrideprotectedvirtual

Definition at line 178 of file ManagersClient.cpp.

References Botcraft::CHUNK_WIDTH.

◆ Handle() [6/16]

void Botcraft::ConnectionClient::Handle ( ProtocolCraft::ClientboundLoginPacket msg)
overrideprotectedvirtual

Reimplemented from Botcraft::ConnectionClient.

Definition at line 52 of file ConnectionClient.cpp.

◆ Handle() [7/16]

void Botcraft::ManagersClient::Handle ( ProtocolCraft::ClientboundLoginPacket msg)
overrideprotectedvirtual

Reimplemented from Botcraft::ConnectionClient.

Definition at line 216 of file ManagersClient.cpp.

References difficulty, Botcraft::ConnectionClient::Handle(), and is_hardcore.

◆ Handle() [8/16]

void Botcraft::ManagersClient::Handle ( ProtocolCraft::ClientboundPlayerAbilitiesPacket msg)
overrideprotectedvirtual

◆ Handle() [9/16]

void Botcraft::ManagersClient::Handle ( ProtocolCraft::ClientboundPlayerInfoRemovePacket msg)
overrideprotectedvirtual

Definition at line 329 of file ManagersClient.cpp.

References player_names, and player_names_mutex.

◆ Handle() [10/16]

void Botcraft::ManagersClient::Handle ( ProtocolCraft::ClientboundPlayerInfoUpdatePacket msg)
overrideprotectedvirtual

Definition at line 338 of file ManagersClient.cpp.

References player_names, and player_names_mutex.

◆ Handle() [11/16]

void Botcraft::ConnectionClient::Handle ( ProtocolCraft::ClientboundPlayerPositionPacket msg)
overrideprotectedvirtual

Reimplemented from Botcraft::ConnectionClient.

Definition at line 47 of file ConnectionClient.cpp.

◆ Handle() [12/16]

void Botcraft::ManagersClient::Handle ( ProtocolCraft::ClientboundPlayerPositionPacket msg)
overrideprotectedvirtual

Reimplemented from Botcraft::ConnectionClient.

Definition at line 268 of file ManagersClient.cpp.

◆ Handle() [13/16]

void Botcraft::ConnectionClient::Handle ( ProtocolCraft::ClientboundRespawnPacket msg)
overrideprotectedvirtual

Reimplemented from Botcraft::ConnectionClient.

Definition at line 53 of file ConnectionClient.cpp.

References Botcraft::ConnectionClient::network_manager.

◆ Handle() [14/16]

void Botcraft::ManagersClient::Handle ( ProtocolCraft::ClientboundRespawnPacket msg)
overrideprotectedvirtual

Reimplemented from Botcraft::ConnectionClient.

Definition at line 273 of file ManagersClient.cpp.

References difficulty, and Botcraft::ConnectionClient::Handle().

◆ Handle() [15/16]

void Botcraft::ManagersClient::Handle ( ProtocolCraft::ClientboundSetHealthPacket msg)
overrideprotectedvirtual

Definition at line 233 of file ManagersClient.cpp.

References auto_respawn, and Botcraft::ConnectionClient::Respawn().

◆ Handle() [16/16]

void Botcraft::ManagersClient::Handle ( ProtocolCraft::ClientboundSetTimePacket msg)
overrideprotectedvirtual

Definition at line 284 of file ManagersClient.cpp.

References day_time.

◆ SendInventoryTransaction()

int Botcraft::ManagersClient::SendInventoryTransaction ( const std::shared_ptr< ProtocolCraft::ServerboundContainerClickPacket > &  transaction)

◆ SetAutoRespawn()

void Botcraft::ManagersClient::SetAutoRespawn ( const bool  b)

Definition at line 125 of file ManagersClient.cpp.

References auto_respawn.

◆ SetSharedWorld()

void Botcraft::ManagersClient::SetSharedWorld ( const std::shared_ptr< World world_)

Definition at line 115 of file ManagersClient.cpp.

References world.

Member Data Documentation

◆ auto_respawn

bool Botcraft::ManagersClient::auto_respawn
protected

Definition at line 98 of file ManagersClient.hpp.

Referenced by GetAutoRespawn(), Handle(), ManagersClient(), and SetAutoRespawn().

◆ day_time

std::atomic<int> Botcraft::ManagersClient::day_time
protected

Definition at line 105 of file ManagersClient.hpp.

Referenced by GetDayTime(), and Handle().

◆ difficulty

Difficulty Botcraft::ManagersClient::difficulty
protected

Definition at line 100 of file ManagersClient.hpp.

Referenced by Disconnect(), Handle(), Handle(), Handle(), and ManagersClient().

◆ difficulty_locked

bool Botcraft::ManagersClient::difficulty_locked
protected

Definition at line 102 of file ManagersClient.hpp.

Referenced by Disconnect(), Handle(), and ManagersClient().

◆ entity_manager

std::shared_ptr<EntityManager> Botcraft::ManagersClient::entity_manager
protected

◆ inventory_manager

std::shared_ptr<InventoryManager> Botcraft::ManagersClient::inventory_manager
protected

◆ is_hardcore

bool Botcraft::ManagersClient::is_hardcore
protected

Definition at line 104 of file ManagersClient.hpp.

Referenced by Disconnect(), Handle(), and ManagersClient().

◆ physics_manager

std::shared_ptr<PhysicsManager> Botcraft::ManagersClient::physics_manager
protected

Definition at line 89 of file ManagersClient.hpp.

Referenced by Disconnect(), GetPhysicsManager(), and ManagersClient().

◆ player_names

std::map<ProtocolCraft::UUID, std::string> Botcraft::ManagersClient::player_names
protected

Names of all connected players.

Definition at line 108 of file ManagersClient.hpp.

Referenced by Disconnect(), GetPlayerName(), Handle(), and Handle().

◆ player_names_mutex

std::shared_mutex Botcraft::ManagersClient::player_names_mutex
mutableprotected

Definition at line 109 of file ManagersClient.hpp.

Referenced by Disconnect(), GetPlayerName(), Handle(), and Handle().

◆ rendering_manager

◆ use_renderer

bool Botcraft::ManagersClient::use_renderer
protected

Definition at line 94 of file ManagersClient.hpp.

Referenced by ManagersClient().

◆ world

std::shared_ptr<World> Botcraft::ManagersClient::world
protected

Definition at line 86 of file ManagersClient.hpp.

Referenced by Disconnect(), GetWorld(), ManagersClient(), and SetSharedWorld().


The documentation for this class was generated from the following files: