![]() |
Botcraft 1.21.4
|
Namespaces | |
namespace | Internal |
namespace | Renderer |
namespace | Utilities |
Typedefs | |
typedef Direction | PlayerDiggingFace |
using | ItemId = int |
typedef Vector3< int > | Position |
using | BlockstateId = unsigned int |
Functions | |
GENERATE_CHECK_HAS_FUNC (OnNodeStartTick) | |
GENERATE_CHECK_HAS_FUNC (OnNodeEndTick) | |
GENERATE_CHECK_HAS_FUNC (OnNodeTickChild) | |
Status | Yield (BehaviourClient &client) |
Just call client.Yield(). | |
Status | Disconnect (BehaviourClient &client) |
Ask this client to disconnect from the server by setting should_be_closed to true. | |
Status | Say (BehaviourClient &client, const std::string &msg) |
Send a message in the game chat. | |
Status | SayBlackboard (BehaviourClient &client) |
Same thing as Say, but reads its parameters from the blackboard. | |
Status | InteractWithBlock (BehaviourClient &client, const Position &pos, const PlayerDiggingFace face=PlayerDiggingFace::Up, const bool animation=true) |
Interact (right click) with the block at the given location. | |
Status | InteractWithBlockBlackboard (BehaviourClient &client) |
Same thing as InteractWithBlock, but reads its parameters from the blackboard. | |
Status | CheckBlackboardBoolData (BehaviourClient &client, const std::string &key) |
Check in the blackboard if the bool at key is true. | |
Status | CheckBlackboardBoolDataBlackboard (BehaviourClient &client) |
Same thing as CheckBlackboardBoolData, but reads its parameters from the blackboard. | |
template<typename T > | |
Status | SetBlackboardData (BehaviourClient &client, const std::string &key, const T &data) |
Set a value in the blackboard. | |
template<typename T > | |
Status | SetBlackboardDataBlackboard (BehaviourClient &client) |
Same thing as SetBlackboardData, but reads its parameters from the blackboard. | |
Status | RemoveBlackboardData (BehaviourClient &client, const std::string &key) |
Remove a value from the blackboard if exist. | |
Status | RemoveBlackboardDataBlackboard (BehaviourClient &client) |
Same thing as RemoveBlackboardData, but reads its parameters from the blackboard. | |
Status | IsHungry (BehaviourClient &client, const int threshold=20) |
Return success if player food is below a threshold. | |
Status | IsHungryBlackboard (BehaviourClient &client) |
Same thing as IsHungry, but reads its parameters from the blackboard. | |
Status | CopyBlackboardData (BehaviourClient &client, const std::string &src, const std::string &dst) |
Copy a blackboard data. | |
Status | CopyBlackboardDataBlackboard (BehaviourClient &client) |
Same thing as CopyBlackboardData, but reads its parameters from the blackboard. | |
Status | IsNightTime (BehaviourClient &client) |
Return Success if it's night time (sleep is possible) | |
Status | IsAlive (BehaviourClient &client) |
Return success if player is alive. | |
Status | Dig (BehaviourClient &c, const Position &pos, const bool send_swing=false, const PlayerDiggingFace face=PlayerDiggingFace::Up, const bool allow_pathfinding=true) |
Dig a block at a given location. | |
Status | DigBlackboard (BehaviourClient &c) |
Same thing as Dig, but reads its parameters from the blackboard. | |
Status | InteractEntity (BehaviourClient &client, const int entity_id, const Hand hand=Hand::Main, const bool swing=false) |
Interact with a given entity. | |
Status | InteractEntityBlackboard (BehaviourClient &client) |
Same thing as InteractEntity, but reads its parameters from the blackboard. | |
Status | ClickSlotInContainer (BehaviourClient &client, const short container_id, const short slot_id, const int click_type, const char button_num) |
Perform a click action on a container. | |
Status | ClickSlotInContainerBlackboard (BehaviourClient &client) |
Same thing as ClickSlotInContainer, but reads its parameters from the blackboard. | |
Status | SwapItemsInContainer (BehaviourClient &client, const short container_id, const short first_slot, const short second_slot) |
Swap two slots in a given container. | |
Status | SwapItemsInContainerBlackboard (BehaviourClient &client) |
Same thing as SwapItemsInContainer, but reads its parameters from the blackboard. | |
Status | DropItemsFromContainer (BehaviourClient &client, const short container_id, const short slot_id, const short num_to_keep=0) |
Drop item out of inventory. | |
Status | DropItemsFromContainerBlackboard (BehaviourClient &client) |
Same thing as DropItemsFromContainer, but reads its parameters from the blackboard. | |
Status | PutOneItemInContainerSlot (BehaviourClient &client, const short container_id, const short source_slot, const short destination_slot) |
Take one item from source_slot, and put it on destination_slot. | |
Status | PutOneItemInContainerSlotBlackboard (BehaviourClient &client) |
Same thing as PutOneItemInContainerSlot, but reads its parameters from the blackboard. | |
Status | SetItemIdInHand (BehaviourClient &client, const ItemId item_id, const Hand hand=Hand::Right) |
Try to set a given item in the given hand. | |
Status | SetItemIdInHandBlackboard (BehaviourClient &client) |
Same thing as SetItemIdInHand, but reads its parameters from the blackboard. | |
Status | SetItemInHand (BehaviourClient &client, const std::string &item_name, const Hand hand=Hand::Right) |
Try to set a given item in the given hand. | |
Status | SetItemInHandBlackboard (BehaviourClient &client) |
Same thing as SetItemInHand, but reads its parameters from the blackboard. | |
Status | PlaceBlock (BehaviourClient &client, const std::string &item_name, const Position &pos, std::optional< PlayerDiggingFace > face=std::nullopt, const bool wait_confirmation=false, const bool allow_midair_placing=false) |
Try to place the item at given pos. | |
Status | PlaceBlockBlackboard (BehaviourClient &client) |
Same thing as PlaceBlock, but reads its parameters from the blackboard. | |
Status | Eat (BehaviourClient &client, const std::string &food_name, const bool wait_confirmation=true) |
Search for food item in the inventory and eat it. | |
Status | EatBlackboard (BehaviourClient &client) |
Same thing as Eat, but reads its parameters from the blackboard. | |
Status | OpenContainer (BehaviourClient &client, const Position &pos) |
Open a container at a given position. | |
Status | OpenContainerBlackboard (BehaviourClient &client) |
Same thing as OpenContainer, but reads its parameters from the blackboard. | |
Status | CloseContainer (BehaviourClient &client, const short container_id=-1) |
Close an opened container. | |
Status | CloseContainerBlackboard (BehaviourClient &client) |
Same thing as CloseContainer, but reads its parameters from the blackboard. | |
Status | LogInventoryContent (BehaviourClient &client, const LogLevel level=LogLevel::Info) |
Log all the inventory content at given log level. | |
Status | LogInventoryContentBlackboard (BehaviourClient &client) |
Same thing as LogInventoryContent, but reads its parameters from the blackboard. | |
Status | Trade (BehaviourClient &client, const int item_id, const bool buy, const int trade_id=-1) |
Buy or sell an item, assuming a trading window is currently opened. | |
Status | TradeBlackboard (BehaviourClient &client) |
Same thing as Trade, but reads its parameters from the blackboard. | |
Status | TradeName (BehaviourClient &client, const std::string &item_name, const bool buy, const int trade_id=-1) |
Buy or sell an item, assuming a trading window is currently opened. | |
Status | TradeNameBlackboard (BehaviourClient &client) |
Same thing as TradeName, but reads its parameters from the blackboard. | |
Status | Craft (BehaviourClient &client, const std::array< std::array< ItemId, 3 >, 3 > &inputs, const bool allow_inventory_craft=true) |
Put item in a crafting container and click on the output, storing it in the inventory. | |
Status | CraftBlackboard (BehaviourClient &client) |
Same thing as Craft, but reads its parameters from the blackboard. | |
Status | CraftNamed (BehaviourClient &client, const std::array< std::array< std::string, 3 >, 3 > &inputs, const bool allow_inventory_craft=true) |
Put item in a crafting container and click on the output, storing it in the inventory. | |
Status | CraftNamedBlackboard (BehaviourClient &client) |
Same thing as CraftNamed, but reads its parameters from the blackboard. | |
Status | HasItemIdInInventory (BehaviourClient &client, const ItemId item_id, const int quantity=1) |
Check if item_id is present in inventory. | |
Status | HasItemIdInInventoryBlackboard (BehaviourClient &client) |
Same thing as HasItemIdInInventory, but reads its parameters from the blackboard. | |
Status | HasItemInInventory (BehaviourClient &client, const std::string &item_name, const int quantity=1) |
Check if item_name is present in inventory. | |
Status | HasItemInInventoryBlackboard (BehaviourClient &client) |
Same thing as HasItemInInventory, but reads its parameters from the blackboard. | |
Status | SortInventory (BehaviourClient &client) |
Clean the inventory stacking same items together. | |
std::vector< std::pair< Position, float > > | FindPath (const BehaviourClient &client, const Position &start, const Position &end, const int dist_tolerance, const int min_end_dist, const int min_end_dist_xz, const bool allow_jump) |
Not actually a task. | |
Status | GoTo (BehaviourClient &client, const Position &goal, const int dist_tolerance=0, const int min_end_dist=0, const int min_end_dist_xz=0, const bool allow_jump=true, const bool sprint=true, const float speed_factor=1.0f) |
Find a path to a block position and navigate to it. | |
Status | GoToBlackboard (BehaviourClient &client) |
Same thing as GoTo, but reads its parameters from the blackboard. | |
Status | GoToDouble (BehaviourClient &client, const Vector3< double > &goal, const bool allow_jump=true, const bool sprint=true, const float speed_factor=1.0f) |
Find a path to a position and navigate to it. | |
Status | GoToDoubleBlackboard (BehaviourClient &client) |
Same thing as GoToDouble, but reads its parameters from the blackboard. | |
Status | LookAt (BehaviourClient &client, const Vector3< double > &target, const bool set_pitch=true, const bool sync_to_server=true) |
Turn the camera to look at a given target and send the new rotation to the server. | |
Status | LookAtBlackboard (BehaviourClient &client) |
Same thing as LookAt, but reads its parameters from the blackboard. | |
Status | StartFlying (BehaviourClient &client) |
Make the current player fly (as in creative/spectator mode, NOT WITH ELYTRA) | |
Status | StopFlying (BehaviourClient &client) |
Make the current player not fly (as in creative/spectator mode, NOT WITH ELYTRA) | |
Status | SyncPosRotToServer (BehaviourClient &client) |
This task will make sure the current player position/orientation have been sent to the server This is important for example if you want to throw an item: you need to first look in the desired direction then throw the item. | |
std::ostream & | operator<< (std::ostream &os, const EntityAttribute::Type v) |
std::ostream & | operator<< (std::ostream &os, const Hand v) |
std::ostream & | operator<< (std::ostream &os, const Direction v) |
std::ostream & | operator<< (std::ostream &os, const LogLevel v) |
std::vector< unsigned char > | Compress (const std::vector< unsigned char > &raw) |
std::vector< unsigned char > | Decompress (const std::vector< unsigned char > &compressed, const int start=0) |
Status | SayImpl (BehaviourClient &client, const std::string &msg) |
Status | InteractWithBlockImpl (BehaviourClient &client, const Position &pos, const PlayerDiggingFace face, const bool animation) |
Status | CheckBlackboardBoolDataImpl (BehaviourClient &client, const std::string &key) |
Status | RemoveBlackboardDataImpl (BehaviourClient &client, const std::string &key) |
Status | IsHungryImpl (BehaviourClient &client, const int threshold) |
Status | CopyBlackboardDataImpl (BehaviourClient &client, const std::string &src, const std::string &dst) |
Status | DigImpl (BehaviourClient &c, const Position &pos, const bool send_swing, const PlayerDiggingFace face, const bool allow_pathfinding) |
Status | InteractEntityImpl (BehaviourClient &client, const int entity_id, const Hand hand, const bool swing) |
Status | ClickSlotInContainerImpl (BehaviourClient &client, const short container_id, const short slot_id, const int click_type, const char button_num) |
Status | SwapItemsInContainerImpl (BehaviourClient &client, const short container_id, const short first_slot, const short second_slot) |
Status | DropItemsFromContainerImpl (BehaviourClient &client, const short container_id, const short slot_id, const short num_to_keep) |
Status | PutOneItemInContainerSlotImpl (BehaviourClient &client, const short container_id, const short source_slot, const short destination_slot) |
Status | SetItemInHandImpl (BehaviourClient &client, const ItemId item_id, const Hand hand) |
Status | PlaceBlockImpl (BehaviourClient &client, const std::string &item_name, const Position &pos, std::optional< PlayerDiggingFace > face, const bool wait_confirmation, const bool allow_midair_placing) |
Status | EatImpl (BehaviourClient &client, const std::string &food_name, const bool wait_confirmation) |
Status | OpenContainerImpl (BehaviourClient &client, const Position &pos) |
Status | CloseContainerImpl (BehaviourClient &client, const short container_id) |
Status | LogInventoryContentImpl (BehaviourClient &client, const LogLevel level) |
Status | TradeImpl (BehaviourClient &client, const int item_id, const bool buy, const int trade_id) |
Status | TradeNameImpl (BehaviourClient &client, const std::string &item_name, const bool buy, const int trade_id) |
Status | CraftImpl (BehaviourClient &client, const std::array< std::array< ItemId, 3 >, 3 > &inputs, const bool allow_inventory_craft) |
Status | CraftNamedImpl (BehaviourClient &client, const std::array< std::array< std::string, 3 >, 3 > &inputs, const bool allow_inventory_craft) |
Status | HasItemInInventoryImpl (BehaviourClient &client, const ItemId item_id, const int quantity) |
bool | Move (BehaviourClient &client, std::shared_ptr< LocalPlayer > &local_player, const Vector3< double > &target_position, const float speed_factor, const bool sprint) |
void | AdjustPosSpeed (BehaviourClient &client, const Vector3< double > &target) |
Status | GoToImpl (BehaviourClient &client, const Vector3< double > &goal, const int dist_tolerance, const int min_end_dist, const int min_end_dist_xz, const bool allow_jump, const bool sprint, float speed_factor) |
Status | LookAtImpl (BehaviourClient &client, const Vector3< double > &target, const bool set_pitch, const bool sync_to_server) |
ToolMaterial | GetToolMaterialFromString (const std::string &s) |
ToolType | GetToolTypeFromString (const std::string &s) |
DEFINE_ENUM_STRINGIFYER_RANGE (EntityAttribute::Type, EntityAttribute::Type::Unknown, EntityAttribute::Type::NUM_ENTITY_ATTRIBUTES) | |
DEFINE_ENUM_STRINGIFYER_RANGE (PlayerDiggingFace, PlayerDiggingFace::Down, PlayerDiggingFace::East) | |
DEFINE_ENUM_STRINGIFYER_RANGE (Hand, Hand::Right, Hand::Left) | |
Model | ModelModificationFromJson (const Model &model, const Json::Value &json) |
std::string | ModelNameFromJson (const Json::Value &json) |
int | WeightFromJson (const Json::Value &json) |
bool | CheckCondition (const std::string &name, const std::string &value, const std::vector< std::string > &variables) |
DEFINE_ENUM_STRINGIFYER_RANGE (LogLevel, LogLevel::Trace, LogLevel::None) | |
Variables | |
static constexpr int | CHUNK_WIDTH = 16 |
static constexpr int | SECTION_HEIGHT = 16 |
static const std::string | botcraft_pathfinding_speed_key = "botcraft:speed" |
using Botcraft::BlockstateId = typedef unsigned int |
Definition at line 33 of file Blockstate.hpp.
using Botcraft::ItemId = typedef int |
typedef Direction Botcraft::PlayerDiggingFace |
typedef Vector3<int> Botcraft::Position |
Definition at line 282 of file Vector3.hpp.
|
strong |
Enumerator | |
---|---|
Tree | |
Leaf | |
Composite | |
Decorator |
Definition at line 7 of file BaseNode.hpp.
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
Enumerator | |
---|---|
OnFire | |
ShiftKeyDown | |
Sprinting | |
Swimming | |
Invisible | |
Glowing | |
FallFlying |
Definition at line 39 of file Entity.hpp.
|
strong |
Definition at line 279 of file Entity.hpp.
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
Enumerator | |
---|---|
Trace | |
Debug | |
Info | |
Warning | |
Error | |
Fatal | |
None | |
NUM_LOG_LEVEL |
Definition at line 50 of file Logger.hpp.
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
Enumerator | |
---|---|
Failure | |
Success |
Definition at line 5 of file Status.hpp.
|
strong |
|
strong |
|
strong |
void Botcraft::AdjustPosSpeed | ( | BehaviourClient & | client, |
const Vector3< double > & | target | ||
) |
Definition at line 1217 of file PathfindingTask.cpp.
References Botcraft::ManagersClient::GetLocalPlayer(), Botcraft::ManagersClient::GetPhysicsManager(), Botcraft::Vector3< T >::x, Botcraft::Utilities::YieldForCondition(), and Botcraft::Vector3< T >::z.
Referenced by GoToImpl().
Status Botcraft::CheckBlackboardBoolData | ( | BehaviourClient & | client, |
const std::string & | key | ||
) |
Check in the blackboard if the bool at key is true.
client | The client performing the action |
key | The key to get the bool from |
Definition at line 189 of file BaseTasks.cpp.
References CheckBlackboardBoolDataImpl(), Botcraft::BehaviourClient::GetBlackboard(), and Botcraft::Blackboard::Set().
Status Botcraft::CheckBlackboardBoolDataBlackboard | ( | BehaviourClient & | client | ) |
Same thing as CheckBlackboardBoolData, but reads its parameters from the blackboard.
client | The client performing the action |
Definition at line 202 of file BaseTasks.cpp.
References CheckBlackboardBoolDataImpl(), Botcraft::Blackboard::Get(), and Botcraft::BehaviourClient::GetBlackboard().
Status Botcraft::CheckBlackboardBoolDataImpl | ( | BehaviourClient & | client, |
const std::string & | key | ||
) |
Definition at line 184 of file BaseTasks.cpp.
References Failure, Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), and Success.
Referenced by CheckBlackboardBoolData(), and CheckBlackboardBoolDataBlackboard().
bool Botcraft::CheckCondition | ( | const std::string & | name, |
const std::string & | value, | ||
const std::vector< std::string > & | variables | ||
) |
Definition at line 215 of file Blockstate.cpp.
References Botcraft::Utilities::EndsWith(), Botcraft::Utilities::SplitString(), and Botcraft::Utilities::StartsWith().
Referenced by Botcraft::Blockstate::Blockstate().
Status Botcraft::ClickSlotInContainer | ( | BehaviourClient & | client, |
const short | container_id, | ||
const short | slot_id, | ||
const int | click_type, | ||
const char | button_num | ||
) |
Perform a click action on a container.
client | The client performing the action |
container_id | Container id |
slot_id | Clicked slot id |
click_type | Type of click (same as in ServerboundContainerClickPacket) |
button_num | Button clicked (same as in ServerboundContainerClickPacket) |
Definition at line 62 of file InventoryTasks.cpp.
References ClickSlotInContainerImpl(), Botcraft::BehaviourClient::GetBlackboard(), and Botcraft::Blackboard::Set().
Referenced by CraftImpl(), DropItemsFromContainerImpl(), PutOneItemInContainerSlotImpl(), SortInventory(), and SwapItemsInContainerImpl().
Status Botcraft::ClickSlotInContainerBlackboard | ( | BehaviourClient & | client | ) |
Same thing as ClickSlotInContainer, but reads its parameters from the blackboard.
client | The client performing the action |
Definition at line 82 of file InventoryTasks.cpp.
References ClickSlotInContainerImpl(), Botcraft::Blackboard::Get(), and Botcraft::BehaviourClient::GetBlackboard().
Status Botcraft::ClickSlotInContainerImpl | ( | BehaviourClient & | client, |
const short | container_id, | ||
const short | slot_id, | ||
const int | click_type, | ||
const char | button_num | ||
) |
Definition at line 21 of file InventoryTasks.cpp.
References Failure, Botcraft::ManagersClient::GetInventoryManager(), LOG_WARNING, Botcraft::ManagersClient::SendInventoryTransaction(), Success, and Botcraft::BehaviourClient::Yield().
Referenced by ClickSlotInContainer(), and ClickSlotInContainerBlackboard().
Status Botcraft::CloseContainer | ( | BehaviourClient & | client, |
const short | container_id = -1 |
||
) |
Close an opened container.
client | The client performing the action |
container_id | The id of the container to close, if -1, will close the first one found |
Definition at line 804 of file InventoryTasks.cpp.
References CloseContainerImpl(), Botcraft::BehaviourClient::GetBlackboard(), and Botcraft::Blackboard::Set().
Status Botcraft::CloseContainerBlackboard | ( | BehaviourClient & | client | ) |
Same thing as CloseContainer, but reads its parameters from the blackboard.
client | The client performing the action |
Definition at line 817 of file InventoryTasks.cpp.
References CloseContainerImpl(), Botcraft::Blackboard::Get(), and Botcraft::BehaviourClient::GetBlackboard().
Status Botcraft::CloseContainerImpl | ( | BehaviourClient & | client, |
const short | container_id | ||
) |
Definition at line 783 of file InventoryTasks.cpp.
References Botcraft::ManagersClient::GetInventoryManager(), Botcraft::ConnectionClient::GetNetworkManager(), and Success.
Referenced by CloseContainer(), and CloseContainerBlackboard().
std::vector< unsigned char > Botcraft::Compress | ( | const std::vector< unsigned char > & | raw | ) |
Definition at line 11 of file Compression.cpp.
Referenced by Botcraft::NetworkManager::Send().
Status Botcraft::CopyBlackboardData | ( | BehaviourClient & | client, |
const std::string & | src, | ||
const std::string & | dst | ||
) |
Copy a blackboard data.
client | The client performing the action |
src | Source blackboard key |
dst | Destination blackboard key |
Definition at line 292 of file BaseTasks.cpp.
References CopyBlackboardDataImpl(), Botcraft::BehaviourClient::GetBlackboard(), and Botcraft::Blackboard::Set().
Status Botcraft::CopyBlackboardDataBlackboard | ( | BehaviourClient & | client | ) |
Same thing as CopyBlackboardData, but reads its parameters from the blackboard.
client | The client performing the action |
Definition at line 307 of file BaseTasks.cpp.
References CopyBlackboardDataImpl(), Botcraft::Blackboard::Get(), and Botcraft::BehaviourClient::GetBlackboard().
Status Botcraft::CopyBlackboardDataImpl | ( | BehaviourClient & | client, |
const std::string & | src, | ||
const std::string & | dst | ||
) |
Definition at line 285 of file BaseTasks.cpp.
References Botcraft::Blackboard::Copy(), Botcraft::BehaviourClient::GetBlackboard(), and Success.
Referenced by CopyBlackboardData(), and CopyBlackboardDataBlackboard().
Status Botcraft::Craft | ( | BehaviourClient & | client, |
const std::array< std::array< ItemId, 3 >, 3 > & | inputs, | ||
const bool | allow_inventory_craft = true |
||
) |
Put item in a crafting container and click on the output, storing it in the inventory.
client | The client performing the action |
inputs | Input items IDs in a 3x3 grid, inputs[0][1] refers to first line, second column |
allow_inventory_craft | If true, the client will use the inventory small 2x2 grid to craft if possible |
Definition at line 1335 of file InventoryTasks.cpp.
References CraftImpl(), Botcraft::BehaviourClient::GetBlackboard(), and Botcraft::Blackboard::Set().
Referenced by CraftNamedImpl().
Status Botcraft::CraftBlackboard | ( | BehaviourClient & | client | ) |
Same thing as Craft, but reads its parameters from the blackboard.
client | The client performing the action |
Definition at line 1355 of file InventoryTasks.cpp.
References CraftImpl(), Botcraft::Blackboard::Get(), and Botcraft::BehaviourClient::GetBlackboard().
Status Botcraft::CraftImpl | ( | BehaviourClient & | client, |
const std::array< std::array< ItemId, 3 >, 3 > & | inputs, | ||
const bool | allow_inventory_craft | ||
) |
Definition at line 1133 of file InventoryTasks.cpp.
References ClickSlotInContainer(), Failure, Botcraft::AssetsManager::getInstance(), Botcraft::ManagersClient::GetInventoryManager(), Botcraft::Window::INVENTORY_STORAGE_START, Botcraft::AssetsManager::Items(), LOG_INFO, LOG_WARNING, Botcraft::Window::PLAYER_INVENTORY_INDEX, Success, and Botcraft::BehaviourClient::Yield().
Referenced by Craft(), and CraftBlackboard().
Status Botcraft::CraftNamed | ( | BehaviourClient & | client, |
const std::array< std::array< std::string, 3 >, 3 > & | inputs, | ||
const bool | allow_inventory_craft = true |
||
) |
Put item in a crafting container and click on the output, storing it in the inventory.
client | The client performing the action |
inputs | Input items names in a 3x3 grid, inputs[0][1] refers to first line, second column |
allow_inventory_craft | If true, the client will use the inventory small 2x2 grid to craft if possible |
Definition at line 1400 of file InventoryTasks.cpp.
References CraftNamedImpl(), Botcraft::BehaviourClient::GetBlackboard(), and Botcraft::Blackboard::Set().
Status Botcraft::CraftNamedBlackboard | ( | BehaviourClient & | client | ) |
Same thing as CraftNamed, but reads its parameters from the blackboard.
client | The client performing the action |
Definition at line 1415 of file InventoryTasks.cpp.
References CraftNamedImpl(), Botcraft::Blackboard::Get(), and Botcraft::BehaviourClient::GetBlackboard().
Status Botcraft::CraftNamedImpl | ( | BehaviourClient & | client, |
const std::array< std::array< std::string, 3 >, 3 > & | inputs, | ||
const bool | allow_inventory_craft | ||
) |
Definition at line 1378 of file InventoryTasks.cpp.
References Craft(), Botcraft::AssetsManager::getInstance(), and Botcraft::AssetsManager::GetItemID().
Referenced by CraftNamed(), and CraftNamedBlackboard().
std::vector< unsigned char > Botcraft::Decompress | ( | const std::vector< unsigned char > & | compressed, |
const int | start = 0 |
||
) |
Definition at line 28 of file Compression.cpp.
Referenced by Botcraft::NetworkManager::WaitForNewPackets().
Botcraft::DEFINE_ENUM_STRINGIFYER_RANGE | ( | EntityAttribute::Type | , |
EntityAttribute::Type::Unknown | , | ||
EntityAttribute::Type::NUM_ENTITY_ATTRIBUTES | |||
) |
Botcraft::DEFINE_ENUM_STRINGIFYER_RANGE | ( | Hand | , |
Hand::Right | , | ||
Hand::Left | |||
) |
Botcraft::DEFINE_ENUM_STRINGIFYER_RANGE | ( | LogLevel | , |
LogLevel::Trace | , | ||
LogLevel::None | |||
) |
Botcraft::DEFINE_ENUM_STRINGIFYER_RANGE | ( | PlayerDiggingFace | , |
PlayerDiggingFace::Down | , | ||
PlayerDiggingFace::East | |||
) |
Status Botcraft::Dig | ( | BehaviourClient & | c, |
const Position & | pos, | ||
const bool | send_swing = false , |
||
const PlayerDiggingFace | face = PlayerDiggingFace::Up , |
||
const bool | allow_pathfinding = true |
||
) |
Dig a block at a given location.
If too far, will try to pathfind toward it
c | The client performing the action |
pos | Location of block to dig |
send_swing | If true, will send swing packets to show other players digging in progress |
face | Digging direction |
allow_pathfinding | If true, the bot will try to pathfind toward the block if it's too far. If false the task will return Failure instead in this case. |
Definition at line 259 of file DigTask.cpp.
References DigImpl(), Botcraft::BehaviourClient::GetBlackboard(), and Botcraft::Blackboard::Set().
Status Botcraft::DigBlackboard | ( | BehaviourClient & | c | ) |
Same thing as Dig, but reads its parameters from the blackboard.
c | The client performing the action |
Definition at line 278 of file DigTask.cpp.
References DigImpl(), Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), and Up.
Status Botcraft::DigImpl | ( | BehaviourClient & | c, |
const Position & | pos, | ||
const bool | send_swing, | ||
const PlayerDiggingFace | face, | ||
const bool | allow_pathfinding | ||
) |
Definition at line 22 of file DigTask.cpp.
References Adventure, AquaAffinity, Creative, Efficiency, Failure, FinishDigging, Botcraft::Blockstate::GetClosestPoint(), Botcraft::Utilities::GetEnchantmentLvl(), Botcraft::Blockstate::GetHardness(), Botcraft::AssetsManager::getInstance(), Botcraft::ManagersClient::GetInventoryManager(), Botcraft::AssetsManager::GetItem(), Botcraft::ManagersClient::GetLocalPlayer(), Botcraft::Blockstate::GetMiningTimeSeconds(), Botcraft::ConnectionClient::GetNetworkManager(), Botcraft::ManagersClient::GetPhysicsManager(), Botcraft::Item::GetToolMaterial(), Botcraft::Item::GetToolType(), Botcraft::ManagersClient::GetWorld(), GoTo(), Haste, Botcraft::Window::INVENTORY_HEAD_ARMOR, Botcraft::Blockstate::IsAir(), ProtocolCraft::Slot::IsEmptySlot(), Botcraft::Blockstate::IsFluid(), LOG_INFO, LOG_WARNING, Main, MiningFatigue, None, Spectator, Botcraft::Vector3< T >::SqrDist(), StartDigging, Success, Botcraft::Vector3< T >::ToNetworkPosition(), Botcraft::Vector3< T >::x, Botcraft::Vector3< T >::y, Botcraft::BehaviourClient::Yield(), and Botcraft::Vector3< T >::z.
Referenced by Dig(), and DigBlackboard().
Status Botcraft::Disconnect | ( | BehaviourClient & | client | ) |
Ask this client to disconnect from the server by setting should_be_closed to true.
client | The client performing the action |
Definition at line 19 of file BaseTasks.cpp.
References Botcraft::ConnectionClient::SetShouldBeClosed(), and Success.
Status Botcraft::DropItemsFromContainer | ( | BehaviourClient & | client, |
const short | container_id, | ||
const short | slot_id, | ||
const short | num_to_keep = 0 |
||
) |
Drop item out of inventory.
client | The client performing the action |
container_id | Container ID |
slot_id | Slot ID |
num_to_keep | Number of items to keep in the input slot |
Definition at line 200 of file InventoryTasks.cpp.
References DropItemsFromContainerImpl(), Botcraft::BehaviourClient::GetBlackboard(), and Botcraft::Blackboard::Set().
Status Botcraft::DropItemsFromContainerBlackboard | ( | BehaviourClient & | client | ) |
Same thing as DropItemsFromContainer, but reads its parameters from the blackboard.
client | The client performing the action |
Definition at line 217 of file InventoryTasks.cpp.
References DropItemsFromContainerImpl(), Botcraft::Blackboard::Get(), and Botcraft::BehaviourClient::GetBlackboard().
Status Botcraft::DropItemsFromContainerImpl | ( | BehaviourClient & | client, |
const short | container_id, | ||
const short | slot_id, | ||
const short | num_to_keep | ||
) |
Definition at line 171 of file InventoryTasks.cpp.
References ClickSlotInContainer(), Failure, and Botcraft::ManagersClient::GetInventoryManager().
Referenced by DropItemsFromContainer(), and DropItemsFromContainerBlackboard().
Status Botcraft::Eat | ( | BehaviourClient & | client, |
const std::string & | food_name, | ||
const bool | wait_confirmation = true |
||
) |
Search for food item in the inventory and eat it.
client | The client performing the action |
food_name | The item to eat |
wait_confirmation | If true, waits for the eaten stack to be reduced by 1 before returning Success |
Definition at line 694 of file InventoryTasks.cpp.
References EatImpl(), Botcraft::BehaviourClient::GetBlackboard(), and Botcraft::Blackboard::Set().
Status Botcraft::EatBlackboard | ( | BehaviourClient & | client | ) |
Same thing as Eat, but reads its parameters from the blackboard.
client | The client performing the action |
Definition at line 709 of file InventoryTasks.cpp.
References EatImpl(), Botcraft::Blackboard::Get(), and Botcraft::BehaviourClient::GetBlackboard().
Status Botcraft::EatImpl | ( | BehaviourClient & | client, |
const std::string & | food_name, | ||
const bool | wait_confirmation | ||
) |
Definition at line 656 of file InventoryTasks.cpp.
References Failure, Botcraft::ManagersClient::GetInventoryManager(), Botcraft::ConnectionClient::GetNetworkManager(), Botcraft::ManagersClient::GetPhysicsManager(), Botcraft::ManagersClient::GetWorld(), Left, LOG_WARNING, SetItemInHand(), Success, and Botcraft::BehaviourClient::Yield().
Referenced by Eat(), and EatBlackboard().
std::vector< std::pair< Position, float > > Botcraft::FindPath | ( | const BehaviourClient & | client, |
const Position & | start, | ||
const Position & | end, | ||
const int | dist_tolerance, | ||
const int | min_end_dist, | ||
const int | min_end_dist_xz, | ||
const bool | allow_jump | ||
) |
Not actually a task.
Helper function to compute path between start and end. Does not perfom any movement.
client | Client used to do the pathfinding |
start | Start position |
end | End position |
dist_tolerance | Stop the search earlier if you get closer than dist_tolerance from the end position |
min_end_dist | Desired minimal checkboard distance between the final position and goal (useful if you want to place a block, you don't want to be at the exact spot, but close to it). |
min_end_dist_xz | Same as min_end_dist but only considering the XZ plane (allows to ask to stand next to a block, but above for example) |
allow_jump | If true, allow to jump above 1-wide gaps |
Definition at line 92 of file PathfindingTask.cpp.
References Botcraft::PathfindingBlockstate::GetHeight(), Botcraft::ManagersClient::GetLocalPlayer(), Botcraft::ManagersClient::GetWorld(), Botcraft::Blockstate::IsClimbable(), Botcraft::PathfindingBlockstate::IsClimbable(), Botcraft::Blockstate::IsSolid(), Botcraft::Vector3< T >::x, Botcraft::Vector3< T >::y, and Botcraft::Vector3< T >::z.
Referenced by GoToImpl().
Botcraft::GENERATE_CHECK_HAS_FUNC | ( | OnNodeEndTick | ) |
Botcraft::GENERATE_CHECK_HAS_FUNC | ( | OnNodeStartTick | ) |
Botcraft::GENERATE_CHECK_HAS_FUNC | ( | OnNodeTickChild | ) |
ToolMaterial Botcraft::GetToolMaterialFromString | ( | const std::string & | s | ) |
Definition at line 220 of file AssetsManager.cpp.
References Diamond, Gold, Iron, Netherite, None, Stone, and Wood.
Referenced by Botcraft::AssetsManager::LoadBlocksFile().
ToolType Botcraft::GetToolTypeFromString | ( | const std::string & | s | ) |
Definition at line 251 of file AssetsManager.cpp.
References Axe, Hoe, None, Pickaxe, Shears, Shovel, and Sword.
Referenced by Botcraft::AssetsManager::LoadBlocksFile().
Status Botcraft::GoTo | ( | BehaviourClient & | client, |
const Position & | goal, | ||
const int | dist_tolerance = 0 , |
||
const int | min_end_dist = 0 , |
||
const int | min_end_dist_xz = 0 , |
||
const bool | allow_jump = true , |
||
const bool | sprint = true , |
||
const float | speed_factor = 1.0f |
||
) |
Find a path to a block position and navigate to it.
client | The client performing the action |
goal | The end goal |
dist_tolerance | If != 0 and the distance between final position and goal is < dist_tolerance, return Success even if goal is not reached. |
min_end_dist | Desired minimal checkboard distance between the final position and goal (useful if you want to place a block, you don't want to be at the exact spot, but close to it). Should always be <= dist_tolerance. |
min_end_dist_xz | Same as min_end_dist but only considering the XZ plane (allows to ask to stand next to a block, but above for example) |
allow_jump | If true, allow to jump above 1-wide gaps |
sprint | If true, the bot will sprint/swim when possible |
speed_factor | Multiply vanilla speed if different from 1.0 |
Definition at line 1459 of file PathfindingTask.cpp.
References Botcraft::BehaviourClient::GetBlackboard(), GoToImpl(), Botcraft::Blackboard::Set(), Botcraft::Vector3< T >::x, Botcraft::Vector3< T >::y, and Botcraft::Vector3< T >::z.
Referenced by DigImpl(), InteractEntityImpl(), InteractWithBlockImpl(), and PlaceBlockImpl().
Status Botcraft::GoToBlackboard | ( | BehaviourClient & | client | ) |
Same thing as GoTo, but reads its parameters from the blackboard.
client | The client performing the action |
Definition at line 1484 of file PathfindingTask.cpp.
References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), GoToImpl(), Botcraft::Vector3< T >::x, Botcraft::Vector3< T >::y, and Botcraft::Vector3< T >::z.
Status Botcraft::GoToDouble | ( | BehaviourClient & | client, |
const Vector3< double > & | goal, | ||
const bool | allow_jump = true , |
||
const bool | sprint = true , |
||
const float | speed_factor = 1.0f |
||
) |
Find a path to a position and navigate to it.
Will first move to block center, then adjust to be as close as possible to goal on X/Z axis. Gravity may prevent reaching Y target.
client | The client performing the action |
goal | The end goal |
allow_jump | If true, allow to jump above 1-wide gaps |
sprint | If true, the bot will sprint/swim when possible |
speed_factor | Multiply vanilla speed if different from 1.0 |
Definition at line 1512 of file PathfindingTask.cpp.
References Botcraft::BehaviourClient::GetBlackboard(), GoToImpl(), and Botcraft::Blackboard::Set().
Status Botcraft::GoToDoubleBlackboard | ( | BehaviourClient & | client | ) |
Same thing as GoToDouble, but reads its parameters from the blackboard.
client | The client performing the action |
Definition at line 1531 of file PathfindingTask.cpp.
References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), and GoToImpl().
Status Botcraft::GoToImpl | ( | BehaviourClient & | client, |
const Vector3< double > & | goal, | ||
const int | dist_tolerance, | ||
const int | min_end_dist, | ||
const int | min_end_dist_xz, | ||
const bool | allow_jump, | ||
const bool | sprint, | ||
float | speed_factor | ||
) |
Definition at line 1283 of file PathfindingTask.cpp.
References AdjustPosSpeed(), Failure, FindPath(), Botcraft::ManagersClient::GetLocalPlayer(), Botcraft::ConnectionClient::GetNetworkManager(), Botcraft::ManagersClient::GetPhysicsManager(), Botcraft::ManagersClient::GetWorld(), Botcraft::Blockstate::IsAir(), Botcraft::Blockstate::IsClimbable(), Botcraft::Blockstate::IsFluid(), LOG_INFO, LOG_WARNING, Move(), Botcraft::Vector3< T >::Normalize(), Spectator, StopFlying(), Success, Botcraft::Vector3< T >::x, Botcraft::Vector3< T >::y, Botcraft::BehaviourClient::Yield(), Botcraft::Utilities::YieldForCondition(), and Botcraft::Vector3< T >::z.
Referenced by GoTo(), GoToBlackboard(), GoToDouble(), and GoToDoubleBlackboard().
Status Botcraft::HasItemIdInInventory | ( | BehaviourClient & | client, |
const ItemId | item_id, | ||
const int | quantity = 1 |
||
) |
Check if item_id is present in inventory.
client | The client performing the action |
item_id | Item id |
quantity | Min quantity to have |
Definition at line 1463 of file InventoryTasks.cpp.
References Botcraft::BehaviourClient::GetBlackboard(), HasItemInInventoryImpl(), and Botcraft::Blackboard::Set().
Status Botcraft::HasItemIdInInventoryBlackboard | ( | BehaviourClient & | client | ) |
Same thing as HasItemIdInInventory, but reads its parameters from the blackboard.
client | The client performing the action |
Definition at line 1477 of file InventoryTasks.cpp.
References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), and HasItemInInventoryImpl().
Status Botcraft::HasItemInInventory | ( | BehaviourClient & | client, |
const std::string & | item_name, | ||
const int | quantity = 1 |
||
) |
Check if item_name is present in inventory.
client | The client performing the action |
item_name | Item name |
quantity | Min quantity to have |
Definition at line 1495 of file InventoryTasks.cpp.
References Botcraft::BehaviourClient::GetBlackboard(), Botcraft::AssetsManager::getInstance(), Botcraft::AssetsManager::GetItemID(), HasItemInInventoryImpl(), and Botcraft::Blackboard::Set().
Status Botcraft::HasItemInInventoryBlackboard | ( | BehaviourClient & | client | ) |
Same thing as HasItemInInventory, but reads its parameters from the blackboard.
client | The client performing the action |
Definition at line 1511 of file InventoryTasks.cpp.
References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), Botcraft::AssetsManager::getInstance(), and HasItemInInventoryImpl().
Status Botcraft::HasItemInInventoryImpl | ( | BehaviourClient & | client, |
const ItemId | item_id, | ||
const int | quantity | ||
) |
Definition at line 1434 of file InventoryTasks.cpp.
References Failure, Botcraft::ManagersClient::GetInventoryManager(), Botcraft::Window::INVENTORY_STORAGE_START, and Success.
Referenced by HasItemIdInInventory(), HasItemIdInInventoryBlackboard(), HasItemInInventory(), and HasItemInInventoryBlackboard().
Status Botcraft::InteractEntity | ( | BehaviourClient & | client, |
const int | entity_id, | ||
const Hand | hand = Hand::Main , |
||
const bool | swing = false |
||
) |
Interact with a given entity.
If too far, will try to pathfind to it.
client | The client performing the action |
entity_id | The ID of the entity we want to interact with |
hand | The hand we want to use |
swing | If true, a swing packet will be sent too |
Definition at line 74 of file EntitiesTasks.cpp.
References Botcraft::BehaviourClient::GetBlackboard(), InteractEntityImpl(), and Botcraft::Blackboard::Set().
Status Botcraft::InteractEntityBlackboard | ( | BehaviourClient & | client | ) |
Same thing as InteractEntity, but reads its parameters from the blackboard.
client | The client performing the action |
Definition at line 91 of file EntitiesTasks.cpp.
References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), InteractEntityImpl(), and Main.
Status Botcraft::InteractEntityImpl | ( | BehaviourClient & | client, |
const int | entity_id, | ||
const Hand | hand, | ||
const bool | swing | ||
) |
Definition at line 17 of file EntitiesTasks.cpp.
References Failure, Botcraft::ManagersClient::GetEntityManager(), Botcraft::ConnectionClient::GetNetworkManager(), GoTo(), LOG_WARNING, Botcraft::Vector3< T >::SqrDist(), and Success.
Referenced by InteractEntity(), and InteractEntityBlackboard().
Status Botcraft::InteractWithBlock | ( | BehaviourClient & | client, |
const Position & | pos, | ||
const PlayerDiggingFace | face = PlayerDiggingFace::Up , |
||
const bool | animation = true |
||
) |
Interact (right click) with the block at the given location.
If too far, will try to pathfind toward it.
client | The client performing the action |
pos | The position of the block |
face | Face on which we want to clik on |
animation | Whether or not we should send an animation to the server (vanilla client does) |
Definition at line 146 of file BaseTasks.cpp.
References Botcraft::BehaviourClient::GetBlackboard(), InteractWithBlockImpl(), and Botcraft::Blackboard::Set().
Referenced by OpenContainerImpl().
Status Botcraft::InteractWithBlockBlackboard | ( | BehaviourClient & | client | ) |
Same thing as InteractWithBlock, but reads its parameters from the blackboard.
client | The client performing the action |
Definition at line 163 of file BaseTasks.cpp.
References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), InteractWithBlockImpl(), and Up.
Status Botcraft::InteractWithBlockImpl | ( | BehaviourClient & | client, |
const Position & | pos, | ||
const PlayerDiggingFace | face, | ||
const bool | animation | ||
) |
Definition at line 60 of file BaseTasks.cpp.
References Down, East, Failure, Botcraft::ManagersClient::GetLocalPlayer(), Botcraft::ConnectionClient::GetNetworkManager(), Botcraft::ManagersClient::GetWorld(), GoTo(), LookAt(), North, Right, South, Botcraft::Vector3< T >::SqrDist(), Success, Botcraft::Vector3< T >::ToNetworkPosition(), Up, and West.
Referenced by InteractWithBlock(), and InteractWithBlockBlackboard().
Status Botcraft::IsAlive | ( | BehaviourClient & | client | ) |
Return success if player is alive.
client | The client performing the action |
Definition at line 331 of file BaseTasks.cpp.
References Failure, Botcraft::ManagersClient::GetLocalPlayer(), and Success.
Status Botcraft::IsHungry | ( | BehaviourClient & | client, |
const int | threshold = 20 |
||
) |
Return success if player food is below a threshold.
client | The client performing the action |
threshold | Threshold under which the player is considered to be hungry |
Definition at line 257 of file BaseTasks.cpp.
References Botcraft::BehaviourClient::GetBlackboard(), IsHungryImpl(), and Botcraft::Blackboard::Set().
Status Botcraft::IsHungryBlackboard | ( | BehaviourClient & | client | ) |
Same thing as IsHungry, but reads its parameters from the blackboard.
client | The client performing the action |
Definition at line 270 of file BaseTasks.cpp.
References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), and IsHungryImpl().
Status Botcraft::IsHungryImpl | ( | BehaviourClient & | client, |
const int | threshold | ||
) |
Definition at line 252 of file BaseTasks.cpp.
References Failure, Botcraft::ManagersClient::GetLocalPlayer(), and Success.
Referenced by IsHungry(), and IsHungryBlackboard().
Status Botcraft::IsNightTime | ( | BehaviourClient & | client | ) |
Return Success if it's night time (sleep is possible)
client | The client performing the action |
Definition at line 324 of file BaseTasks.cpp.
References Failure, Botcraft::ManagersClient::GetDayTime(), and Success.
Status Botcraft::LogInventoryContent | ( | BehaviourClient & | client, |
const LogLevel | level = LogLevel::Info |
||
) |
Log all the inventory content at given log level.
client | The client performing the action |
level | Desired log level |
Definition at line 850 of file InventoryTasks.cpp.
References Botcraft::BehaviourClient::GetBlackboard(), LogInventoryContentImpl(), and Botcraft::Blackboard::Set().
Status Botcraft::LogInventoryContentBlackboard | ( | BehaviourClient & | client | ) |
Same thing as LogInventoryContent, but reads its parameters from the blackboard.
client | The client performing the action |
Definition at line 863 of file InventoryTasks.cpp.
References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), Info, and LogInventoryContentImpl().
Status Botcraft::LogInventoryContentImpl | ( | BehaviourClient & | client, |
const LogLevel | level | ||
) |
Definition at line 833 of file InventoryTasks.cpp.
References Botcraft::ManagersClient::GetInventoryManager(), LOG, and Success.
Referenced by LogInventoryContent(), and LogInventoryContentBlackboard().
Status Botcraft::LookAt | ( | BehaviourClient & | client, |
const Vector3< double > & | target, | ||
const bool | set_pitch = true , |
||
const bool | sync_to_server = true |
||
) |
Turn the camera to look at a given target and send the new rotation to the server.
client | The client performing the action |
target | The target to look at |
set_pitch | If false, only the yaw will be changed |
sync_to_server | If true, will wait for the new orientation to be sent to the server |
Definition at line 1566 of file PathfindingTask.cpp.
References Botcraft::BehaviourClient::GetBlackboard(), LookAtImpl(), and Botcraft::Blackboard::Set().
Referenced by InteractWithBlockImpl(), and PlaceBlockImpl().
Status Botcraft::LookAtBlackboard | ( | BehaviourClient & | client | ) |
Same thing as LookAt, but reads its parameters from the blackboard.
client | The client performing the action |
Definition at line 1583 of file PathfindingTask.cpp.
References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), and LookAtImpl().
Status Botcraft::LookAtImpl | ( | BehaviourClient & | client, |
const Vector3< double > & | target, | ||
const bool | set_pitch, | ||
const bool | sync_to_server | ||
) |
Definition at line 1554 of file PathfindingTask.cpp.
References Botcraft::ManagersClient::GetLocalPlayer(), Success, and SyncPosRotToServer().
Referenced by LookAt(), and LookAtBlackboard().
Model Botcraft::ModelModificationFromJson | ( | const Model & | model, |
const Json::Value & | json | ||
) |
Definition at line 20 of file Blockstate.cpp.
References Bottom, ProtocolCraft::Json::Value::contains(), East, ProtocolCraft::Json::Value::get(), ProtocolCraft::Json::Value::get_number(), Botcraft::Model::GetColliders(), Botcraft::Model::GetFaces(), LOG_ERROR, North, Botcraft::Model::SetColliders(), South, Top, West, Botcraft::Vector3< T >::x, Botcraft::Vector3< T >::y, and Botcraft::Vector3< T >::z.
Referenced by Botcraft::Blockstate::Blockstate().
std::string Botcraft::ModelNameFromJson | ( | const Json::Value & | json | ) |
Definition at line 190 of file Blockstate.cpp.
References ProtocolCraft::Json::Value::get_string().
Referenced by Botcraft::Blockstate::Blockstate().
bool Botcraft::Move | ( | BehaviourClient & | client, |
std::shared_ptr< LocalPlayer > & | local_player, | ||
const Vector3< double > & | target_position, | ||
const float | speed_factor, | ||
const bool | sprint | ||
) |
Definition at line 984 of file PathfindingTask.cpp.
References botcraft_pathfinding_speed_key, Botcraft::ManagersClient::GetPhysicsManager(), Botcraft::ManagersClient::GetWorld(), Botcraft::Blockstate::IsAir(), Botcraft::Blockstate::IsFluidOrWaterlogged(), Botcraft::Blockstate::IsScaffolding(), Botcraft::EntityAttribute::MovementSpeed, Botcraft::EntityAttribute::Modifier::MultiplyTotal, Botcraft::Vector3< T >::SqrDist(), Botcraft::Vector3< T >::x, Botcraft::Vector3< T >::y, Botcraft::Utilities::YieldForCondition(), and Botcraft::Vector3< T >::z.
Referenced by GoToImpl().
Status Botcraft::OpenContainer | ( | BehaviourClient & | client, |
const Position & | pos | ||
) |
Open a container at a given position.
client | The client performing the action |
pos | The position of the container |
Definition at line 754 of file InventoryTasks.cpp.
References Botcraft::BehaviourClient::GetBlackboard(), OpenContainerImpl(), and Botcraft::Blackboard::Set().
Status Botcraft::OpenContainerBlackboard | ( | BehaviourClient & | client | ) |
Same thing as OpenContainer, but reads its parameters from the blackboard.
client | The client performing the action |
Definition at line 767 of file InventoryTasks.cpp.
References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), and OpenContainerImpl().
Status Botcraft::OpenContainerImpl | ( | BehaviourClient & | client, |
const Position & | pos | ||
) |
Definition at line 729 of file InventoryTasks.cpp.
References Failure, Botcraft::ManagersClient::GetInventoryManager(), InteractWithBlock(), LOG_WARNING, Success, Up, and Botcraft::BehaviourClient::Yield().
Referenced by OpenContainer(), and OpenContainerBlackboard().
std::ostream & Botcraft::operator<< | ( | std::ostream & | os, |
const Direction | v | ||
) |
std::ostream & Botcraft::operator<< | ( | std::ostream & | os, |
const EntityAttribute::Type | v | ||
) |
std::ostream & Botcraft::operator<< | ( | std::ostream & | os, |
const Hand | v | ||
) |
std::ostream & Botcraft::operator<< | ( | std::ostream & | os, |
const LogLevel | v | ||
) |
Status Botcraft::PlaceBlock | ( | BehaviourClient & | client, |
const std::string & | item_name, | ||
const Position & | pos, | ||
std::optional< PlayerDiggingFace > | face = std::nullopt , |
||
const bool | wait_confirmation = false , |
||
const bool | allow_midair_placing = false |
||
) |
Try to place the item at given pos.
If too far, will try to pathfind toward the position first.
client | The client performing the action |
item_name | The item to place |
pos | The location where we want to place the block |
face | The face on which the block is placed. If not specified the optimal placing face will be automatically detected using the position of the block relative to the player eyes |
wait_confirmation | If true, waits for the server to send the new block in pos |
allow_midair_placing | If false, task will fail if the neighbour block matching face is air |
Definition at line 609 of file InventoryTasks.cpp.
References Botcraft::BehaviourClient::GetBlackboard(), PlaceBlockImpl(), and Botcraft::Blackboard::Set().
Status Botcraft::PlaceBlockBlackboard | ( | BehaviourClient & | client | ) |
Same thing as PlaceBlock, but reads its parameters from the blackboard.
client | The client performing the action |
Definition at line 630 of file InventoryTasks.cpp.
References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), PlaceBlockImpl(), and Up.
Status Botcraft::PlaceBlockImpl | ( | BehaviourClient & | client, |
const std::string & | item_name, | ||
const Position & | pos, | ||
std::optional< PlayerDiggingFace > | face, | ||
const bool | wait_confirmation, | ||
const bool | allow_midair_placing | ||
) |
Definition at line 410 of file InventoryTasks.cpp.
References Down, East, Failure, Botcraft::ManagersClient::GetEntityManager(), Botcraft::ManagersClient::GetInventoryManager(), Botcraft::Blockstate::GetName(), Botcraft::ConnectionClient::GetNetworkManager(), Botcraft::ManagersClient::GetPhysicsManager(), Botcraft::ManagersClient::GetWorld(), GoTo(), Botcraft::Window::INVENTORY_HOTBAR_START, Botcraft::Blockstate::IsAir(), Botcraft::Blockstate::IsFluid(), Botcraft::Blockstate::IsSolid(), LOG_WARNING, LookAt(), North, Right, SetItemInHand(), South, Botcraft::Vector3< T >::SqrDist(), Success, Botcraft::Vector3< T >::ToNetworkPosition(), Up, West, and Botcraft::BehaviourClient::Yield().
Referenced by PlaceBlock(), and PlaceBlockBlackboard().
Status Botcraft::PutOneItemInContainerSlot | ( | BehaviourClient & | client, |
const short | container_id, | ||
const short | source_slot, | ||
const short | destination_slot | ||
) |
Take one item from source_slot, and put it on destination_slot.
client | The client performing the action |
container_id | Container ID |
source_slot | Slot from which the item is taken |
destination_slot | Slot receiving the item |
Definition at line 264 of file InventoryTasks.cpp.
References Botcraft::BehaviourClient::GetBlackboard(), PutOneItemInContainerSlotImpl(), and Botcraft::Blackboard::Set().
Status Botcraft::PutOneItemInContainerSlotBlackboard | ( | BehaviourClient & | client | ) |
Same thing as PutOneItemInContainerSlot, but reads its parameters from the blackboard.
client | The client performing the action |
Definition at line 281 of file InventoryTasks.cpp.
References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), and PutOneItemInContainerSlotImpl().
Status Botcraft::PutOneItemInContainerSlotImpl | ( | BehaviourClient & | client, |
const short | container_id, | ||
const short | source_slot, | ||
const short | destination_slot | ||
) |
Definition at line 238 of file InventoryTasks.cpp.
References ClickSlotInContainer(), Failure, LOG_WARNING, and Success.
Referenced by PutOneItemInContainerSlot(), and PutOneItemInContainerSlotBlackboard().
Status Botcraft::RemoveBlackboardData | ( | BehaviourClient & | client, |
const std::string & | key | ||
) |
Remove a value from the blackboard if exist.
client | The client performing the action |
key | The key to clear |
Definition at line 224 of file BaseTasks.cpp.
References Botcraft::BehaviourClient::GetBlackboard(), RemoveBlackboardDataImpl(), and Botcraft::Blackboard::Set().
Status Botcraft::RemoveBlackboardDataBlackboard | ( | BehaviourClient & | client | ) |
Same thing as RemoveBlackboardData, but reads its parameters from the blackboard.
client | The client performing the action |
Definition at line 237 of file BaseTasks.cpp.
References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), and RemoveBlackboardDataImpl().
Status Botcraft::RemoveBlackboardDataImpl | ( | BehaviourClient & | client, |
const std::string & | key | ||
) |
Definition at line 217 of file BaseTasks.cpp.
References Botcraft::Blackboard::Erase(), Botcraft::BehaviourClient::GetBlackboard(), and Success.
Referenced by RemoveBlackboardData(), and RemoveBlackboardDataBlackboard().
Status Botcraft::Say | ( | BehaviourClient & | client, |
const std::string & | msg | ||
) |
Send a message in the game chat.
client | The client performing the action |
msg | The message to send |
Definition at line 32 of file BaseTasks.cpp.
References Botcraft::BehaviourClient::GetBlackboard(), SayImpl(), and Botcraft::Blackboard::Set().
Status Botcraft::SayBlackboard | ( | BehaviourClient & | client | ) |
Same thing as Say, but reads its parameters from the blackboard.
client | The client performing the action |
Definition at line 45 of file BaseTasks.cpp.
References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), and SayImpl().
Status Botcraft::SayImpl | ( | BehaviourClient & | client, |
const std::string & | msg | ||
) |
Definition at line 26 of file BaseTasks.cpp.
References Botcraft::ConnectionClient::SendChatMessage(), and Success.
Referenced by Say(), and SayBlackboard().
Status Botcraft::SetBlackboardData | ( | BehaviourClient & | client, |
const std::string & | key, | ||
const T & | data | ||
) |
Set a value in the blackboard.
T | Any type |
client | The client performing the action |
key | The key in the blackboard |
data | The data to store |
Definition at line 77 of file BaseTasks.hpp.
References Botcraft::BehaviourClient::GetBlackboard(), and Botcraft::Blackboard::Set().
Status Botcraft::SetBlackboardDataBlackboard | ( | BehaviourClient & | client | ) |
Same thing as SetBlackboardData, but reads its parameters from the blackboard.
T | Any type |
client | The client performing the action |
Definition at line 97 of file BaseTasks.hpp.
References Botcraft::Blackboard::Get(), and Botcraft::BehaviourClient::GetBlackboard().
Status Botcraft::SetItemIdInHand | ( | BehaviourClient & | client, |
const ItemId | item_id, | ||
const Hand | hand = Hand::Right |
||
) |
Try to set a given item in the given hand.
client | The client performing the action |
item_id | Item id to place in hand |
hand | Left or right hand |
Definition at line 343 of file InventoryTasks.cpp.
References Botcraft::BehaviourClient::GetBlackboard(), Botcraft::Blackboard::Set(), and SetItemInHandImpl().
Status Botcraft::SetItemIdInHandBlackboard | ( | BehaviourClient & | client | ) |
Same thing as SetItemIdInHand, but reads its parameters from the blackboard.
client | The client performing the action |
Definition at line 358 of file InventoryTasks.cpp.
References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), Right, and SetItemInHandImpl().
Status Botcraft::SetItemInHand | ( | BehaviourClient & | client, |
const std::string & | item_name, | ||
const Hand | hand = Hand::Right |
||
) |
Try to set a given item in the given hand.
client | The client performing the action |
item_name | Item name to place in hand |
hand | Left or right hand |
Definition at line 374 of file InventoryTasks.cpp.
References Botcraft::BehaviourClient::GetBlackboard(), Botcraft::AssetsManager::getInstance(), Botcraft::AssetsManager::GetItemID(), Botcraft::Blackboard::Set(), and SetItemInHandImpl().
Referenced by EatImpl(), and PlaceBlockImpl().
Status Botcraft::SetItemInHandBlackboard | ( | BehaviourClient & | client | ) |
Same thing as SetItemInHand, but reads its parameters from the blackboard.
client | The client performing the action |
Definition at line 391 of file InventoryTasks.cpp.
References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), Botcraft::AssetsManager::getInstance(), Botcraft::AssetsManager::GetItemID(), Right, and SetItemInHandImpl().
Status Botcraft::SetItemInHandImpl | ( | BehaviourClient & | client, |
const ItemId | item_id, | ||
const Hand | hand | ||
) |
Definition at line 300 of file InventoryTasks.cpp.
References Failure, Botcraft::ManagersClient::GetInventoryManager(), Botcraft::Window::INVENTORY_HOTBAR_START, Botcraft::Window::INVENTORY_OFFHAND_INDEX, Botcraft::Window::INVENTORY_STORAGE_START, ProtocolCraft::Slot::IsEmptySlot(), Left, Botcraft::Window::PLAYER_INVENTORY_INDEX, Success, and SwapItemsInContainer().
Referenced by SetItemIdInHand(), SetItemIdInHandBlackboard(), SetItemInHand(), and SetItemInHandBlackboard().
Status Botcraft::SortInventory | ( | BehaviourClient & | client | ) |
Clean the inventory stacking same items together.
client | The client performing the action |
Definition at line 1530 of file InventoryTasks.cpp.
References ClickSlotInContainer(), Failure, Botcraft::AssetsManager::getInstance(), Botcraft::ManagersClient::GetInventoryManager(), Botcraft::Window::INVENTORY_OFFHAND_INDEX, Botcraft::Window::INVENTORY_STORAGE_START, ProtocolCraft::Slot::IsEmptySlot(), Botcraft::AssetsManager::Items(), LOG_WARNING, Botcraft::Window::PLAYER_INVENTORY_INDEX, ProtocolCraft::Slot::SameItem(), and Success.
Status Botcraft::StartFlying | ( | BehaviourClient & | client | ) |
Make the current player fly (as in creative/spectator mode, NOT WITH ELYTRA)
client | The client performing the action |
Definition at line 1603 of file PathfindingTask.cpp.
References Failure, Botcraft::ManagersClient::GetLocalPlayer(), Botcraft::ManagersClient::GetPhysicsManager(), Success, and Botcraft::Utilities::YieldForCondition().
Status Botcraft::StopFlying | ( | BehaviourClient & | client | ) |
Make the current player not fly (as in creative/spectator mode, NOT WITH ELYTRA)
client | The client performing the action |
Definition at line 1645 of file PathfindingTask.cpp.
References Failure, Botcraft::ManagersClient::GetLocalPlayer(), Botcraft::ManagersClient::GetPhysicsManager(), Success, and Botcraft::Utilities::YieldForCondition().
Referenced by GoToImpl().
Status Botcraft::SwapItemsInContainer | ( | BehaviourClient & | client, |
const short | container_id, | ||
const short | first_slot, | ||
const short | second_slot | ||
) |
Swap two slots in a given container.
client | The client performing the action |
container_id | Container ID |
first_slot | First slot index |
second_slot | Second slot index |
Definition at line 135 of file InventoryTasks.cpp.
References Botcraft::BehaviourClient::GetBlackboard(), Botcraft::Blackboard::Set(), and SwapItemsInContainerImpl().
Referenced by SetItemInHandImpl(), and TradeImpl().
Status Botcraft::SwapItemsInContainerBlackboard | ( | BehaviourClient & | client | ) |
Same thing as SwapItemsInContainer, but reads its parameters from the blackboard.
client | The client performing the action |
Definition at line 152 of file InventoryTasks.cpp.
References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), and SwapItemsInContainerImpl().
Status Botcraft::SwapItemsInContainerImpl | ( | BehaviourClient & | client, |
const short | container_id, | ||
const short | first_slot, | ||
const short | second_slot | ||
) |
Definition at line 103 of file InventoryTasks.cpp.
References ClickSlotInContainer(), Failure, LOG_WARNING, and Success.
Referenced by SwapItemsInContainer(), and SwapItemsInContainerBlackboard().
Status Botcraft::SyncPosRotToServer | ( | BehaviourClient & | client | ) |
This task will make sure the current player position/orientation have been sent to the server This is important for example if you want to throw an item: you need to first look in the desired direction then throw the item.
But if the new orientation is not registered server side, the items won't be instantiated in the right direction
client | The client performing the action |
Definition at line 1682 of file PathfindingTask.cpp.
References Failure, Botcraft::ManagersClient::GetLocalPlayer(), Botcraft::ManagersClient::GetPhysicsManager(), Success, and Botcraft::Utilities::YieldForCondition().
Referenced by LookAtImpl().
Status Botcraft::Trade | ( | BehaviourClient & | client, |
const int | item_id, | ||
const bool | buy, | ||
const int | trade_id = -1 |
||
) |
Buy or sell an item, assuming a trading window is currently opened.
client | The client performing the action |
item_id | Id of the item to buy/sell |
buy | If true, the item is bought, otherwise is sold |
trade_id | If > -1, specify which trade we want to use in the list (useful when the villager sells multiple variants of the same item like enchanted books or bows) |
Definition at line 1044 of file InventoryTasks.cpp.
References Botcraft::BehaviourClient::GetBlackboard(), Botcraft::Blackboard::Set(), and TradeImpl().
Status Botcraft::TradeBlackboard | ( | BehaviourClient & | client | ) |
Same thing as Trade, but reads its parameters from the blackboard.
client | The client performing the action |
Definition at line 1061 of file InventoryTasks.cpp.
References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), and TradeImpl().
Status Botcraft::TradeImpl | ( | BehaviourClient & | client, |
const int | item_id, | ||
const bool | buy, | ||
const int | trade_id | ||
) |
Definition at line 879 of file InventoryTasks.cpp.
References Failure, Botcraft::AssetsManager::getInstance(), Botcraft::ManagersClient::GetInventoryManager(), Botcraft::ConnectionClient::GetNetworkManager(), ProtocolCraft::Slot::IsEmptySlot(), LOG_WARNING, Success, SwapItemsInContainer(), and Botcraft::BehaviourClient::Yield().
Referenced by Trade(), TradeBlackboard(), and TradeNameImpl().
Status Botcraft::TradeName | ( | BehaviourClient & | client, |
const std::string & | item_name, | ||
const bool | buy, | ||
const int | trade_id = -1 |
||
) |
Buy or sell an item, assuming a trading window is currently opened.
client | The client performing the action |
item_name | Item to buy/sell |
buy | If true, the item is bought, otherwise is sold |
trade_id | If > -1, specify which trade we want to use in the list (useful when the villager sells multiple variants of the same item like enchanted books or bows) |
Definition at line 1095 of file InventoryTasks.cpp.
References Botcraft::BehaviourClient::GetBlackboard(), Botcraft::Blackboard::Set(), and TradeNameImpl().
Status Botcraft::TradeNameBlackboard | ( | BehaviourClient & | client | ) |
Same thing as TradeName, but reads its parameters from the blackboard.
client | The client performing the action |
Definition at line 1112 of file InventoryTasks.cpp.
References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), and TradeNameImpl().
Status Botcraft::TradeNameImpl | ( | BehaviourClient & | client, |
const std::string & | item_name, | ||
const bool | buy, | ||
const int | trade_id | ||
) |
Definition at line 1082 of file InventoryTasks.cpp.
References Failure, Botcraft::AssetsManager::getInstance(), Botcraft::AssetsManager::GetItemID(), LOG_WARNING, and TradeImpl().
Referenced by TradeName(), and TradeNameBlackboard().
int Botcraft::WeightFromJson | ( | const Json::Value & | json | ) |
Definition at line 203 of file Blockstate.cpp.
References ProtocolCraft::Json::Value::contains(), and ProtocolCraft::Json::Value::get_number().
Referenced by Botcraft::Blockstate::Blockstate().
Status Botcraft::Yield | ( | BehaviourClient & | client | ) |
Just call client.Yield().
Can be used to Idle the behaviour.
client | The client performing the action |
Definition at line 11 of file BaseTasks.cpp.
References Success, and Botcraft::BehaviourClient::Yield().
|
static |
Definition at line 981 of file PathfindingTask.cpp.
Referenced by Move().
|
staticconstexpr |
Definition at line 21 of file Chunk.hpp.
Referenced by Botcraft::Renderer::WorldRenderer::AddFace(), Botcraft::Chunk::BlockCoordsToChunkCoords(), Botcraft::Chunk::Chunk(), Botcraft::Section::CoordsToBlockIndex(), Botcraft::Section::CoordsToLightIndex(), Botcraft::Renderer::WorldRenderer::DistanceToCamera(), Botcraft::World::GetBiome(), Botcraft::World::GetBlockEntityData(), Botcraft::World::GetBlockImpl(), Botcraft::World::GetBlockLight(), Botcraft::World::GetSkyLight(), Botcraft::ManagersClient::Handle(), Botcraft::World::Handle(), Botcraft::Chunk::IsInsideChunk(), Botcraft::World::IsLoaded(), Botcraft::Chunk::LoadChunkBlockEntitiesData(), Botcraft::Chunk::LoadChunkData(), Botcraft::Chunk::LoadSectionBiomeData(), Botcraft::Renderer::WorldRenderer::RenderFaces(), Botcraft::Section::Section(), Botcraft::World::SetBiomeImpl(), Botcraft::World::SetBlockEntityData(), Botcraft::World::SetBlockImpl(), Botcraft::World::SetBlockLight(), Botcraft::World::SetSkyLight(), Botcraft::World::UpdateChunk(), Botcraft::Renderer::WorldRenderer::UpdateChunk(), Botcraft::World::UpdateChunkLight(), and Botcraft::Chunk::UpdateNeighbour().
|
staticconstexpr |
Definition at line 22 of file Chunk.hpp.
Referenced by Botcraft::Chunk::Chunk(), Botcraft::Chunk::Chunk(), Botcraft::Chunk::GetBlock(), Botcraft::Chunk::GetBlockLight(), Botcraft::Chunk::GetSkyLight(), Botcraft::World::Handle(), Botcraft::Chunk::LoadBiomesData(), Botcraft::Chunk::LoadChunkData(), Botcraft::Chunk::LoadSectionBiomeData(), Botcraft::Section::Section(), Botcraft::Chunk::SetBiomes(), Botcraft::Chunk::SetBlock(), Botcraft::Chunk::SetBlockLight(), Botcraft::Chunk::SetSkyLight(), and Botcraft::World::UpdateChunkLight().