![]() |
Botcraft 1.21.4
|
Classes | |
class | AnyParser |
struct | EnumMapperRange |
class | OnEndScope |
A class to execute a callback when destroyed. More... | |
class | ScopeLockedWrapper |
Mutex protected reference, will be locked until destroyed. More... | |
Functions | |
std::string | Demangle (const std::string &name, const bool simplify_output) |
Demangle a class name. | |
template<auto V> | |
constexpr auto | enum_value_name () noexcept |
template<class Enum > | |
constexpr std::underlying_type_t< Enum > | to_underlying (const Enum e) noexcept |
template<class Enum , Enum... pack> | |
constexpr std::array< std::pair< Enum, std::string_view >, sizeof...(pack)> | GetNamedEnum () |
std::string_view | EnchantmentToString (const Botcraft::Enchantment enchantment) |
short | GetEnchantmentLvl (const ProtocolCraft::Slot &item, const Botcraft::Enchantment enchantment) |
int | GetDamageCount (const ProtocolCraft::Slot &item) |
void | SleepUntil (const std::chrono::steady_clock::time_point &end) |
template<class _Rep , class _Period > | |
void | SleepFor (const std::chrono::duration< _Rep, _Period > &time) |
bool | WaitForCondition (const std::function< bool()> &condition, const long long int timeout_ms=0, const long long int check_interval_ms=10) |
bool | YieldForCondition (const std::function< bool()> &condition, BehaviourClient &client, const long long int timeout_ms=0) |
bool | StartsWith (const std::string &mainStr, const std::string &toMatch) |
bool | EndsWith (const std::string &mainStr, const std::string &toMatch) |
bool | Contains (const std::string &mainStr, const std::string &toFind) |
std::vector< std::string > | SplitString (const std::string &s, const char delimiter) |
std::vector< std::string > | SplitString (const std::string &s, const std::string &delimiter) |
std::vector< unsigned char > | DecodeBase64 (const std::string &s) |
std::vector< unsigned char > | RSAToBytes (const std::string &s) |
long long int | TimestampMilliFromISO8601 (const std::string &s) |
template<class T > | |
std::string | SimpleToString (const std::any &v) |
template<class T > | |
std::string | SimpleStreamOperatorToString (const std::any &v) |
std::string | CraftInputs (const std::any &v) |
int | IsLeap (const int year) |
int | DaysFrom0 (const int year) |
int | DaysFrom1970 (int32_t year) |
int | DaysFrom1Jan (const int year, const int month, const int day) |
bool Botcraft::Utilities::Contains | ( | const std::string & | mainStr, |
const std::string & | toFind | ||
) |
Definition at line 27 of file StringUtilities.cpp.
Referenced by Botcraft::Blockstate::MatchCondition().
std::string Botcraft::Utilities::CraftInputs | ( | const std::any & | v | ) |
Definition at line 27 of file StdAnyUtilities.cpp.
int Botcraft::Utilities::DaysFrom0 | ( | const int | year | ) |
Definition at line 148 of file StringUtilities.cpp.
Referenced by DaysFrom1970().
int Botcraft::Utilities::DaysFrom1970 | ( | int32_t | year | ) |
Definition at line 153 of file StringUtilities.cpp.
References DaysFrom0().
Referenced by TimestampMilliFromISO8601().
int Botcraft::Utilities::DaysFrom1Jan | ( | const int | year, |
const int | month, | ||
const int | day | ||
) |
Definition at line 158 of file StringUtilities.cpp.
References IsLeap().
Referenced by TimestampMilliFromISO8601().
std::vector< unsigned char > Botcraft::Utilities::DecodeBase64 | ( | const std::string & | s | ) |
Definition at line 63 of file StringUtilities.cpp.
References LOG_ERROR.
Referenced by Botcraft::NetworkManager::Handle(), Botcraft::NetworkManager::NetworkManager(), and RSAToBytes().
std::string Botcraft::Utilities::Demangle | ( | const std::string & | name, |
const bool | simplify_output | ||
) |
Demangle a class name.
name | Raw output of typeid().name() |
simplify_output | If true, will simplify the name to get only the class name without any template parameters or namespace prefix |
Definition at line 11 of file DemanglingUtilities.cpp.
Referenced by Botcraft::Node< SimpleBehaviourClient >::BaseNode(), and Botcraft::Utilities::AnyParser::DefaultToString().
std::string_view Botcraft::Utilities::EnchantmentToString | ( | const Botcraft::Enchantment | enchantment | ) |
Definition at line 13 of file ItemUtilities.cpp.
References Botcraft::AquaAffinity, Botcraft::BaneOfArthropods, Botcraft::BindingCurse, Botcraft::BlastProtection, Botcraft::Channeling, Botcraft::DepthStrider, Botcraft::Efficiency, Botcraft::FeatherFalling, Botcraft::FireAspect, Botcraft::FireProtection, Botcraft::Flame, Botcraft::Fortune, Botcraft::FrostWalker, Botcraft::Impaling, Botcraft::Infinity, Botcraft::Knockback, Botcraft::Looting, Botcraft::Loyalty, Botcraft::LuckOfTheSea, Botcraft::Lure, Botcraft::Mending, Botcraft::Multishot, Botcraft::Piercing, Botcraft::Power, Botcraft::ProjectileProtection, Botcraft::Protection, Botcraft::Punch, Botcraft::QuickCharge, Botcraft::Respiration, Botcraft::Riptide, Botcraft::Sharpness, Botcraft::SilkTouch, Botcraft::Smite, Botcraft::SoulSpeed, Botcraft::SweepingEdge, Botcraft::SwiftSneak, Botcraft::Thorns, Botcraft::Unbreaking, and Botcraft::VanishingCurse.
Referenced by GetEnchantmentLvl().
bool Botcraft::Utilities::EndsWith | ( | const std::string & | mainStr, |
const std::string & | toMatch | ||
) |
Definition at line 18 of file StringUtilities.cpp.
Referenced by Botcraft::CheckCondition(), Botcraft::AssetsManager::LoadBlocksFile(), and TimestampMilliFromISO8601().
|
constexprnoexcept |
Definition at line 13 of file EnumUtilities.hpp.
int Botcraft::Utilities::GetDamageCount | ( | const ProtocolCraft::Slot & | item | ) |
Definition at line 185 of file ItemUtilities.cpp.
References ProtocolCraft::NBT::Tag::contains(), ProtocolCraft::NBT::Tag::get(), ProtocolCraft::NBT::Value::HasData(), ProtocolCraft::NBT::Tag::is(), and ProtocolCraft::Slot::IsEmptySlot().
Referenced by Botcraft::PhysicsManager::InputsToFly().
short Botcraft::Utilities::GetEnchantmentLvl | ( | const ProtocolCraft::Slot & | item, |
const Botcraft::Enchantment | enchantment | ||
) |
Definition at line 108 of file ItemUtilities.cpp.
References ProtocolCraft::NBT::Tag::as_list_of(), ProtocolCraft::NBT::Tag::contains(), EnchantmentToString(), ProtocolCraft::NBT::Value::HasData(), ProtocolCraft::NBT::Tag::is_list_of(), and ProtocolCraft::Slot::IsEmptySlot().
Referenced by Botcraft::PhysicsManager::ApplyMovement(), Botcraft::DigImpl(), Botcraft::PhysicsManager::InputsToCrouch(), and Botcraft::PhysicsManager::MovePlayer().
|
constexpr |
Definition at line 62 of file EnumUtilities.hpp.
int Botcraft::Utilities::IsLeap | ( | const int | year | ) |
Definition at line 131 of file StringUtilities.cpp.
Referenced by DaysFrom1Jan().
std::vector< unsigned char > Botcraft::Utilities::RSAToBytes | ( | const std::string & | s | ) |
Definition at line 120 of file StringUtilities.cpp.
References DecodeBase64(), and SplitString().
Referenced by Botcraft::NetworkManager::Handle(), and Botcraft::NetworkManager::NetworkManager().
std::string Botcraft::Utilities::SimpleStreamOperatorToString | ( | const std::any & | v | ) |
Definition at line 20 of file StdAnyUtilities.cpp.
std::string Botcraft::Utilities::SimpleToString | ( | const std::any & | v | ) |
Definition at line 14 of file StdAnyUtilities.cpp.
void Botcraft::Utilities::SleepFor | ( | const std::chrono::duration< _Rep, _Period > & | time | ) |
Definition at line 16 of file SleepUtilities.hpp.
References SleepUntil().
Referenced by Botcraft::TemplatedBehaviourClient< TDerived >::StartBehaviour(), and WaitForCondition().
void Botcraft::Utilities::SleepUntil | ( | const std::chrono::steady_clock::time_point & | end | ) |
std::vector< std::string > Botcraft::Utilities::SplitString | ( | const std::string & | s, |
const char | delimiter | ||
) |
Definition at line 32 of file StringUtilities.cpp.
Referenced by Botcraft::Blockstate::Blockstate(), Botcraft::CheckCondition(), Botcraft::Blockstate::LoadProperties(), Botcraft::Item::LoadTypeAndMaterialFromName(), Botcraft::Blockstate::MatchCondition(), Botcraft::Renderer::BehaviourRenderer::RemoveBlackboardValue(), RSAToBytes(), Botcraft::TCP_Com::SetIPAndPortFromAddress(), TimestampMilliFromISO8601(), and Botcraft::Renderer::BehaviourRenderer::UpdateBlackboardValue().
std::vector< std::string > Botcraft::Utilities::SplitString | ( | const std::string & | s, |
const std::string & | delimiter | ||
) |
Definition at line 44 of file StringUtilities.cpp.
bool Botcraft::Utilities::StartsWith | ( | const std::string & | mainStr, |
const std::string & | toMatch | ||
) |
Definition at line 13 of file StringUtilities.cpp.
Referenced by Botcraft::CheckCondition(), Botcraft::Item::LoadTypeAndMaterialFromName(), and Botcraft::Model::Model().
long long int Botcraft::Utilities::TimestampMilliFromISO8601 | ( | const std::string & | s | ) |
Definition at line 169 of file StringUtilities.cpp.
References DaysFrom1970(), DaysFrom1Jan(), EndsWith(), LOG_ERROR, and SplitString().
Referenced by Botcraft::Authentifier::GetPlayerCertificates().
|
constexprnoexcept |
Definition at line 37 of file EnumUtilities.hpp.
bool Botcraft::Utilities::WaitForCondition | ( | const std::function< bool()> & | condition, |
const long long int | timeout_ms = 0 , |
||
const long long int | check_interval_ms = 10 |
||
) |
Definition at line 28 of file SleepUtilities.cpp.
References SleepFor().
Referenced by Botcraft::NetworkManager::NetworkManager(), and Botcraft::TemplatedBehaviourClient< TDerived >::SyncAction().
bool Botcraft::Utilities::YieldForCondition | ( | const std::function< bool()> & | condition, |
BehaviourClient & | client, | ||
const long long int | timeout_ms = 0 |
||
) |
Definition at line 42 of file SleepUtilities.cpp.
References Botcraft::BehaviourClient::Yield().
Referenced by Botcraft::AdjustPosSpeed(), Botcraft::GoToImpl(), Botcraft::Move(), Botcraft::StartFlying(), Botcraft::StopFlying(), and Botcraft::SyncPosRotToServer().