Botcraft 1.21.4
Loading...
Searching...
No Matches
Botcraft Namespace Reference

Namespaces

namespace  Internal
 
namespace  Renderer
 
namespace  Utilities
 

Classes

class  AABB
 
class  AbstractArrowEntity
 
class  AbstractBoatEntity
 
class  AbstractChestBoatEntity
 
class  AbstractChestedHorseEntity
 
class  AbstractFishEntity
 
class  AbstractGolemEntity
 
class  AbstractHorseEntity
 
class  AbstractHurtingProjectileEntity
 
class  AbstractIllagerEntity
 
class  AbstractMinecartContainerEntity
 
class  AbstractMinecartEntity
 
class  AbstractPiglinEntity
 
class  AbstractSchoolingFishEntity
 
class  AbstractSkeletonEntity
 
class  AbstractVillagerEntity
 
class  AbstractWindChargeEntity
 
class  AESEncrypter
 
class  AgeableMobEntity
 
class  AgeableWaterCreatureEntity
 
class  AllayEntity
 
class  AmbientCreatureEntity
 
class  AnimalEntity
 
class  AreaEffectCloudEntity
 
class  ArmadilloEntity
 
class  ArmorStandEntity
 
class  ArrowEntity
 
class  AssetsManager
 
class  Authentifier
 
class  AxolotlEntity
 
class  BaseNode
 
class  BatEntity
 
class  BeeEntity
 
class  BehaviourClient
 A ManagersClient extended with a blackboard that can store any kind of data and a virtual Yield function. More...
 
class  BehaviourTree
 
struct  BestTool
 
class  Biome
 
class  Blackboard
 A map wrapper to store arbitrary data. More...
 
class  BlackboardObserver
 
class  BlazeEntity
 
class  BlockAttachedEntity
 
class  Blockstate
 
struct  BlockstateProperties
 
class  BoatEntity
 
class  BoggedEntity
 
class  BreezeEntity
 
class  BreezeWindChargeEntity
 
class  Builder
 
class  CamelEntity
 
class  CatEntity
 
class  CaveSpiderEntity
 
class  ChestBoatEntity
 
class  ChestRaftEntity
 
class  ChickenEntity
 
class  Chunk
 
class  CodEntity
 
class  Composite
 
class  CompositeBuilder
 
class  ConnectionClient
 The base client handling connection with a server. More...
 
class  CowEntity
 
class  CreakingEntity
 
class  CreeperEntity
 
class  Decorator
 
class  DecoratorBuilder
 
class  DisplayBlockDisplayEntity
 
class  DisplayEntity
 
class  DisplayItemDisplayEntity
 
class  DisplayTextDisplayEntity
 
class  DNSMessage
 
class  DNSQuestion
 
class  DNSResourceRecord
 
class  DNSSrvData
 
class  DolphinEntity
 
class  DonkeyEntity
 
class  DragonFireballEntity
 
class  DrownedEntity
 
class  ElderGuardianEntity
 
class  EndCrystalEntity
 
class  EnderDragonEntity
 
class  EnderManEntity
 
class  EndermiteEntity
 
class  Entity
 
class  EntityAttribute
 
struct  EntityEffect
 
class  EntityManager
 
class  EvokerEntity
 
class  EvokerFangsEntity
 
class  ExperienceOrbEntity
 
class  EyeOfEnderEntity
 
struct  FaceDescriptor
 
class  FallingBlockEntity
 
class  FireballEntity
 
class  FireworkRocketEntity
 
class  FishingHookEntity
 
class  FlyingMobEntity
 
class  FoxEntity
 
class  FrogEntity
 
class  GhastEntity
 
class  GiantEntity
 
struct  GlobalPos
 
class  GlowItemFrameEntity
 
class  GlowSquidEntity
 
class  GoatEntity
 
class  GuardianEntity
 
class  HangingEntity
 
class  HoglinEntity
 
class  HorseEntity
 
class  HuskEntity
 
class  IllusionerEntity
 
class  InteractionEntity
 
class  InventoryManager
 
struct  InventoryTransaction
 
class  Inverter
 A Decorator that inverts the result of its child. More...
 
class  IronGolemEntity
 
class  Item
 
class  ItemEntity
 
class  ItemFrameEntity
 
struct  ItemProperties
 
class  LargeFireballEntity
 
class  LastSeenMessagesTracker
 
class  Leaf
 
class  LeashFenceKnotEntity
 
class  LightningBoltEntity
 
class  LivingEntity
 
class  LlamaEntity
 
class  LlamaSpitEntity
 
class  LocalPlayer
 
class  Logger
 
class  MagmaCubeEntity
 
class  ManagersClient
 A client containing the different managers, and performing client-side physics. More...
 
class  MarkerEntity
 
class  MinecartChestEntity
 
class  MinecartCommandBlockEntity
 
class  MinecartEntity
 
class  MinecartFurnaceEntity
 
class  MinecartHopperEntity
 
class  MinecartSpawnerEntity
 
class  MinecartTNTEntity
 
class  MobEntity
 
class  Model
 
class  MonsterEntity
 
class  MuleEntity
 
class  MushroomCowEntity
 
class  NetworkManager
 
class  Node
 
class  NotifyOnEndUseRef
 Wrapper around a reference that will run a callback on destruct. More...
 
class  OcelotEntity
 
class  OminousItemSpawnerEntity
 
class  PaintingEntity
 
class  PandaEntity
 
class  ParrotEntity
 
class  PathfinderMobEntity
 
class  PathfindingBlockstate
 
class  PatrollingMonsterEntity
 
class  PhantomEntity
 
class  PhysicsManager
 
class  PigEntity
 
class  PiglinBruteEntity
 
class  PiglinEntity
 
class  PillagerEntity
 
class  PlayerEntity
 
struct  PlayerInputs
 
class  PolarBearEntity
 
struct  PosFloatPairHash
 
class  PrimedTntEntity
 
class  ProjectileEntity
 
class  PufferfishEntity
 
class  RabbitEntity
 
class  RaftEntity
 
class  RaiderEntity
 
class  RavagerEntity
 
class  Repeater
 A Decorator that ticks its child n times (repeat until first success if n == 0). More...
 
class  SalmonEntity
 
struct  Section
 
class  Selector
 Selector implementation. More...
 
class  Sequence
 Sequence implementation. More...
 
class  SheepEntity
 
class  ShoulderRidingEntity
 
class  ShulkerBulletEntity
 
class  ShulkerEntity
 
class  SilverfishEntity
 
class  SimpleBehaviourClient
 A client you can use if you only want to use behaviour trees and don't need to add any custom Handle functions. More...
 
class  SkeletonEntity
 
class  SkeletonHorseEntity
 
class  SlimeEntity
 
class  SmallFireballEntity
 
class  SnifferEntity
 
class  SnowballEntity
 
class  SnowGolemEntity
 
class  SpectralArrowEntity
 
class  SpellcasterIllagerEntity
 
class  SpiderEntity
 
class  SquidEntity
 
class  StrayEntity
 
class  StriderEntity
 
class  Succeeder
 A Decorator that always return success, independently of the result of its child. More...
 
class  TadpoleEntity
 
class  TamableAnimalEntity
 
class  TCP_Com
 
class  TemplatedBehaviourClient
 The base class you should inherit if you need to implement some custom Handle functions AND need to add custom fields to your derived class. More...
 
class  ThrowableItemProjectileEntity
 
class  ThrowableProjectileEntity
 
class  ThrownEggEntity
 
class  ThrownEnderpearlEntity
 
class  ThrownExperienceBottleEntity
 
class  ThrownPotionEntity
 
class  ThrownTridentEntity
 
class  TraderLlamaEntity
 
class  TropicalFishEntity
 
class  TurtleEntity
 
class  UnknownEntity
 
struct  Vector3
 
class  VehicleEntity
 
class  VexEntity
 
struct  VillagerData
 
class  VillagerEntity
 
class  VindicatorEntity
 
class  WanderingTraderEntity
 
class  WardenEntity
 
class  WaterAnimalEntity
 
struct  WebRequestResponse
 
class  WindChargeEntity
 
class  Window
 
class  WitchEntity
 
class  WitherBossEntity
 
class  WitherSkeletonEntity
 
class  WitherSkullEntity
 
class  WolfEntity
 
class  World
 
class  ZoglinEntity
 
class  ZombieEntity
 
class  ZombieHorseEntity
 
class  ZombieVillagerEntity
 
class  ZombifiedPiglinEntity
 

Typedefs

typedef Direction PlayerDiggingFace
 
using ItemId = int
 
typedef Vector3< int > Position
 
using BlockstateId = unsigned int
 

Enumerations

enum class  BehaviourNodeType { Tree , Leaf , Composite , Decorator }
 
enum class  Status { Failure , Success }
 
enum class  EntitySharedFlagsId : char {
  OnFire = 0 , ShiftKeyDown = 1 , Sprinting = 3 , Swimming = 4 ,
  Invisible = 5 , Glowing = 6 , FallFlying = 7
}
 
enum class  EntityType {
  None = -1 , AcaciaBoat = 0 , AcaciaChestBoat = 1 , Allay = 2 ,
  AreaEffectCloud = 3 , Armadillo = 4 , ArmorStand = 5 , Arrow = 6 ,
  Axolotl = 7 , ChestRaft = 8 , Raft = 9 , Bat = 10 ,
  Bee = 11 , BirchBoat = 12 , BirchChestBoat = 13 , Blaze = 14 ,
  DisplayBlockDisplay = 15 , Bogged = 16 , Breeze = 17 , BreezeWindCharge = 18 ,
  Camel = 19 , Cat = 20 , CaveSpider = 21 , CherryBoat = 22 ,
  CherryChestBoat = 23 , MinecartChest = 24 , Chicken = 25 , Cod = 26 ,
  MinecartCommandBlock = 27 , Cow = 28 , Creaking = 29 , Creeper = 30 ,
  DarkOakBoat = 31 , DarkOakChestBoat = 32 , Dolphin = 33 , Donkey = 34 ,
  DragonFireball = 35 , Drowned = 36 , ThrownEgg = 37 , ElderGuardian = 38 ,
  EnderMan = 39 , Endermite = 40 , EnderDragon = 41 , ThrownEnderpearl = 42 ,
  EndCrystal = 43 , Evoker = 44 , EvokerFangs = 45 , ThrownExperienceBottle = 46 ,
  ExperienceOrb = 47 , EyeOfEnder = 48 , FallingBlockEntity = 49 , LargeFireball = 50 ,
  FireworkRocketEntity = 51 , Fox = 52 , Frog = 53 , MinecartFurnace = 54 ,
  Ghast = 55 , Giant = 56 , GlowItemFrame = 57 , GlowSquid = 58 ,
  Goat = 59 , Guardian = 60 , Hoglin = 61 , MinecartHopper = 62 ,
  Horse = 63 , Husk = 64 , Illusioner = 65 , Interaction = 66 ,
  IronGolem = 67 , ItemEntity = 68 , DisplayItemDisplay = 69 , ItemFrame = 70 ,
  JungleBoat = 71 , JungleChestBoat = 72 , LeashFenceKnotEntity = 73 , LightningBolt = 74 ,
  Llama = 75 , LlamaSpit = 76 , MagmaCube = 77 , MangroveBoat = 78 ,
  MangroveChestBoat = 79 , Marker = 80 , Minecart = 81 , MushroomCow = 82 ,
  Mule = 83 , OakBoat = 84 , OakChestBoat = 85 , Ocelot = 86 ,
  OminousItemSpawner = 87 , Painting = 88 , PaleOakBoat = 89 , PaleOakChestBoat = 90 ,
  Panda = 91 , Parrot = 92 , Phantom = 93 , Pig = 94 ,
  Piglin = 95 , PiglinBrute = 96 , Pillager = 97 , PolarBear = 98 ,
  ThrownPotion = 99 , Pufferfish = 100 , Rabbit = 101 , Ravager = 102 ,
  Salmon = 103 , Sheep = 104 , Shulker = 105 , ShulkerBullet = 106 ,
  Silverfish = 107 , Skeleton = 108 , SkeletonHorse = 109 , Slime = 110 ,
  SmallFireball = 111 , Sniffer = 112 , Snowball = 113 , SnowGolem = 114 ,
  MinecartSpawner = 115 , SpectralArrow = 116 , Spider = 117 , SpruceBoat = 118 ,
  SpruceChestBoat = 119 , Squid = 120 , Stray = 121 , Strider = 122 ,
  Tadpole = 123 , DisplayTextDisplay = 124 , PrimedTnt = 125 , MinecartTNT = 126 ,
  TraderLlama = 127 , ThrownTrident = 128 , TropicalFish = 129 , Turtle = 130 ,
  Vex = 131 , Villager = 132 , Vindicator = 133 , WanderingTrader = 134 ,
  Warden = 135 , WindCharge = 136 , Witch = 137 , WitherBoss = 138 ,
  WitherSkeleton = 139 , WitherSkull = 140 , Wolf = 141 , Zoglin = 142 ,
  Zombie = 143 , ZombieHorse = 144 , ZombieVillager = 145 , ZombifiedPiglin = 146 ,
  Player = 147 , FishingHook = 148 , MaxEntityIndex
}
 
enum class  ChatMode { Enabled , CommandsOnly , Hidden }
 
enum class  Difficulty {
  None = -1 , Peaceful , Easy , Normal ,
  Hard
}
 
enum class  SoundSource {
  Null = -1 , Master = 0 , Music , Records ,
  Weather , Blocks , Hostile , Neutral ,
  Players , Ambient , Voice
}
 
enum class  GameType {
  None = -1 , Survival , Creative , Adventure ,
  Spectator
}
 
enum class  Enchantment {
  None = -1 , Protection , FireProtection , FeatherFalling ,
  BlastProtection , ProjectileProtection , Respiration , AquaAffinity ,
  Thorns , DepthStrider , FrostWalker , BindingCurse ,
  SoulSpeed , SwiftSneak , Sharpness , Smite ,
  BaneOfArthropods , Knockback , FireAspect , Looting ,
  SweepingEdge , Efficiency , SilkTouch , Unbreaking ,
  Fortune , Power , Punch , Flame ,
  Infinity , LuckOfTheSea , Lure , Loyalty ,
  Impaling , Riptide , Channeling , Multishot ,
  QuickCharge , Piercing , Density , Breach ,
  WindBurst , Mending , VanishingCurse
}
 
enum class  Hand { Right = 0 , Main = 0 , Left = 1 , Off = 1 }
 
enum class  TintType : char {
  None , Water , Redstone , Grass ,
  Leaves
}
 
enum class  Orientation {
  None = -1 , Bottom = 0 , North , West ,
  East , South , Top
}
 
enum class  PlayerDiggingStatus {
  StartDigging = 0 , CancelDigging , FinishDigging , DropItemStack ,
  DropItem , ShootArrow , FinishEating = ShootArrow , SwapItemHand
}
 
enum class  Direction {
  Down = 0 , Up , North , South ,
  West , East
}
 
enum class  InventoryType {
  PlayerInventory = -2 , Default = -1 , Generic9x1 = 0 , Generic9x2 ,
  Generic9x3 , Generic9x4 , Generic9x5 , Generic9x6 ,
  Generic3x3 , Crafter3x3 , Anvil , Beacon ,
  BlastFurnace , BrewingStand , Crafting , Enchantment ,
  Furnace , Grindstone , Hopper , Lectern ,
  Loom , Merchant , ShulkerBox , Smithing ,
  Smoker , CartographyTable , StoneCutter
}
 
enum class  Pose {
  Standing , FallFlying , Sleeping , Swimming ,
  SpinAttack , Crouching , LongJumping , Dying ,
  Croaking , UsingTongue , Sitting , Roaring ,
  Sniffing , Emerging , Digging , Sliding ,
  Shooting , Inhaling
}
 
enum class  EquipmentSlot {
  MainHand = 0 , OffHand , Boots , Leggings ,
  ChestPlate , Helmet , BodyAnimalArmor
}
 
enum class  ToolMaterial : char {
  None = 0 , Wood , Gold , Stone ,
  Iron , Diamond , Netherite , NUM_TOOL_MATERIAL
}
 
enum class  ToolType : char {
  None = 0 , Axe , Hoe , Pickaxe ,
  Shears , Shovel , Sword , NUM_TOOL_TYPE
}
 
enum class  EntityEffectType {
  None = -1 , Speed , Slowness , Haste ,
  MiningFatigue , Strength , InstantHealth , InstantDamage ,
  JumpBoost , Nausea , Regeneration , Resistance ,
  FireResistance , WaterBreathing , Invisibility , Blindness ,
  NightVision , Hunger , Weakness , Poison ,
  Wither , HealthBoost , Absorption , Saturation ,
  Glowing , Levitation , Luck , Unluck ,
  SlowFalling , ConduitPower , DolphinsGrace , BadOmen ,
  HeroOfTheVillage , Darkness , TrialOmen , RaidOmen ,
  WindCharged , Weaving , Oozing , Infested
}
 
enum class  PlayerCommandAction {
  PressShiftKey , ReleaseShifKey , StopSleeping , StartSprinting ,
  StopSprinting , StartRidingJump , StopRidingJump , OpenInventory ,
  StartFallFlying
}
 
enum class  BiomeType {
  Classic , Swamp , DarkForest , Badlands ,
  WarmOcean , LukewarmOcean , ColdOcean , FrozenOcean ,
  PaleGarden
}
 Enum for biomes with special color processing. More...
 
enum class  LogLevel {
  Trace , Debug , Info , Warning ,
  Error , Fatal , None , NUM_LOG_LEVEL
}
 
enum class  Palette { SingleValue , SectionPalette , GlobalPalette }
 

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"
 

Typedef Documentation

◆ BlockstateId

using Botcraft::BlockstateId = typedef unsigned int

Definition at line 33 of file Blockstate.hpp.

◆ ItemId

using Botcraft::ItemId = typedef int

Definition at line 15 of file Item.hpp.

◆ PlayerDiggingFace

Definition at line 211 of file Enums.hpp.

◆ Position

Definition at line 282 of file Vector3.hpp.

Enumeration Type Documentation

◆ BehaviourNodeType

enum class Botcraft::BehaviourNodeType
strong
Enumerator
Tree 
Leaf 
Composite 
Decorator 

Definition at line 7 of file BaseNode.hpp.

◆ BiomeType

enum class Botcraft::BiomeType
strong

Enum for biomes with special color processing.

Enumerator
Classic 
Swamp 
DarkForest 
Badlands 
WarmOcean 
LukewarmOcean 
ColdOcean 
FrozenOcean 
PaleGarden 

Definition at line 8 of file Biome.hpp.

◆ ChatMode

enum class Botcraft::ChatMode
strong
Enumerator
Enabled 
CommandsOnly 
Hidden 

Definition at line 8 of file Enums.hpp.

◆ Difficulty

enum class Botcraft::Difficulty
strong
Enumerator
None 
Peaceful 
Easy 
Normal 
Hard 

Definition at line 25 of file Enums.hpp.

◆ Direction

enum class Botcraft::Direction
strong
Enumerator
Down 

-Y

Up 

+Y

North 

-Z

South 

+Z

West 

-X

East 

+X

Definition at line 196 of file Enums.hpp.

◆ Enchantment

enum class Botcraft::Enchantment
strong
Enumerator
None 
Protection 
FireProtection 
FeatherFalling 
BlastProtection 
ProjectileProtection 
Respiration 
AquaAffinity 
Thorns 
DepthStrider 
FrostWalker 
BindingCurse 
SoulSpeed 
SwiftSneak 
Sharpness 
Smite 
BaneOfArthropods 
Knockback 
FireAspect 
Looting 
SweepingEdge 
Efficiency 
SilkTouch 
Unbreaking 
Fortune 
Power 
Punch 
Flame 
Infinity 
LuckOfTheSea 
Lure 
Loyalty 
Impaling 
Riptide 
Channeling 
Multishot 
QuickCharge 
Piercing 
Density 
Breach 
WindBurst 
Mending 
VanishingCurse 

Definition at line 93 of file Enums.hpp.

◆ EntityEffectType

enum class Botcraft::EntityEffectType
strong
Enumerator
None 
Speed 
Slowness 
Haste 
MiningFatigue 
Strength 
InstantHealth 
InstantDamage 
JumpBoost 
Nausea 
Regeneration 
Resistance 
FireResistance 
WaterBreathing 
Invisibility 
Blindness 
NightVision 
Hunger 
Weakness 
Poison 
Wither 
HealthBoost 
Absorption 
Saturation 
Glowing 
Levitation 
Luck 
Unluck 
SlowFalling 
ConduitPower 
DolphinsGrace 
BadOmen 
HeroOfTheVillage 
Darkness 
TrialOmen 
RaidOmen 
WindCharged 
Weaving 
Oozing 
Infested 

Definition at line 314 of file Enums.hpp.

◆ EntitySharedFlagsId

enum class Botcraft::EntitySharedFlagsId : char
strong
Enumerator
OnFire 
ShiftKeyDown 
Sprinting 
Swimming 
Invisible 
Glowing 
FallFlying 

Definition at line 39 of file Entity.hpp.

◆ EntityType

enum class Botcraft::EntityType
strong
Enumerator
None 
AcaciaBoat 
AcaciaChestBoat 
Allay 
AreaEffectCloud 
Armadillo 
ArmorStand 
Arrow 
Axolotl 
ChestRaft 
Raft 
Bat 
Bee 
BirchBoat 
BirchChestBoat 
Blaze 
DisplayBlockDisplay 
Bogged 
Breeze 
BreezeWindCharge 
Camel 
Cat 
CaveSpider 
CherryBoat 
CherryChestBoat 
MinecartChest 
Chicken 
Cod 
MinecartCommandBlock 
Cow 
Creaking 
Creeper 
DarkOakBoat 
DarkOakChestBoat 
Dolphin 
Donkey 
DragonFireball 
Drowned 
ThrownEgg 
ElderGuardian 
EnderMan 
Endermite 
EnderDragon 
ThrownEnderpearl 
EndCrystal 
Evoker 
EvokerFangs 
ThrownExperienceBottle 
ExperienceOrb 
EyeOfEnder 
FallingBlockEntity 
LargeFireball 
FireworkRocketEntity 
Fox 
Frog 
MinecartFurnace 
Ghast 
Giant 
GlowItemFrame 
GlowSquid 
Goat 
Guardian 
Hoglin 
MinecartHopper 
Horse 
Husk 
Illusioner 
Interaction 
IronGolem 
ItemEntity 
DisplayItemDisplay 
ItemFrame 
JungleBoat 
JungleChestBoat 
LeashFenceKnotEntity 
LightningBolt 
Llama 
LlamaSpit 
MagmaCube 
MangroveBoat 
MangroveChestBoat 
Marker 
Minecart 
MushroomCow 
Mule 
OakBoat 
OakChestBoat 
Ocelot 
OminousItemSpawner 
Painting 
PaleOakBoat 
PaleOakChestBoat 
Panda 
Parrot 
Phantom 
Pig 
Piglin 
PiglinBrute 
Pillager 
PolarBear 
ThrownPotion 
Pufferfish 
Rabbit 
Ravager 
Salmon 
Sheep 
Shulker 
ShulkerBullet 
Silverfish 
Skeleton 
SkeletonHorse 
Slime 
SmallFireball 
Sniffer 
Snowball 
SnowGolem 
MinecartSpawner 
SpectralArrow 
Spider 
SpruceBoat 
SpruceChestBoat 
Squid 
Stray 
Strider 
Tadpole 
DisplayTextDisplay 
PrimedTnt 
MinecartTNT 
TraderLlama 
ThrownTrident 
TropicalFish 
Turtle 
Vex 
Villager 
Vindicator 
WanderingTrader 
Warden 
WindCharge 
Witch 
WitherBoss 
WitherSkeleton 
WitherSkull 
Wolf 
Zoglin 
Zombie 
ZombieHorse 
ZombieVillager 
ZombifiedPiglin 
Player 
FishingHook 
MaxEntityIndex 

Definition at line 279 of file Entity.hpp.

◆ EquipmentSlot

enum class Botcraft::EquipmentSlot
strong
Enumerator
MainHand 
OffHand 
Boots 
Leggings 
ChestPlate 
Helmet 
BodyAnimalArmor 

Definition at line 275 of file Enums.hpp.

◆ GameType

enum class Botcraft::GameType
strong
Enumerator
None 
Survival 
Creative 
Adventure 
Spectator 

Definition at line 49 of file Enums.hpp.

◆ Hand

enum class Botcraft::Hand
strong
Enumerator
Right 
Main 
Left 
Off 

Definition at line 149 of file Enums.hpp.

◆ InventoryType

enum class Botcraft::InventoryType
strong
Enumerator
PlayerInventory 
Default 
Generic9x1 
Generic9x2 
Generic9x3 
Generic9x4 
Generic9x5 
Generic9x6 
Generic3x3 
Crafter3x3 
Anvil 
Beacon 
BlastFurnace 
BrewingStand 
Crafting 
Enchantment 
Furnace 
Grindstone 
Hopper 
Lectern 
Loom 
Merchant 
ShulkerBox 
Smithing 
Smoker 
CartographyTable 
StoneCutter 

Definition at line 216 of file Enums.hpp.

◆ LogLevel

enum class Botcraft::LogLevel
strong
Enumerator
Trace 
Debug 
Info 
Warning 
Error 
Fatal 
None 
NUM_LOG_LEVEL 

Definition at line 50 of file Logger.hpp.

◆ Orientation

enum class Botcraft::Orientation
strong
Enumerator
None 
Bottom 

y = -1

North 

z = -1

West 

x = -1

East 

x = 1

South 

z = 1

Top 

y = 1

Definition at line 167 of file Enums.hpp.

◆ Palette

enum class Botcraft::Palette
strong
Enumerator
SingleValue 
SectionPalette 
GlobalPalette 

Definition at line 10 of file Chunk.cpp.

◆ PlayerCommandAction

enum class Botcraft::PlayerCommandAction
strong
Enumerator
PressShiftKey 
ReleaseShifKey 
StopSleeping 
StartSprinting 
StopSprinting 
StartRidingJump 
StopRidingJump 
OpenInventory 
StartFallFlying 

Definition at line 370 of file Enums.hpp.

◆ PlayerDiggingStatus

enum class Botcraft::PlayerDiggingStatus
strong
Enumerator
StartDigging 
CancelDigging 
FinishDigging 
DropItemStack 
DropItem 
ShootArrow 
FinishEating 
SwapItemHand 

Definition at line 184 of file Enums.hpp.

◆ Pose

enum class Botcraft::Pose
strong
Enumerator
Standing 
FallFlying 
Sleeping 
Swimming 
SpinAttack 
Crouching 
LongJumping 
Dying 
Croaking 
UsingTongue 
Sitting 
Roaring 
Sniffing 
Emerging 
Digging 
Sliding 
Shooting 
Inhaling 

Definition at line 249 of file Enums.hpp.

◆ SoundSource

enum class Botcraft::SoundSource
strong
Enumerator
Null 
Master 
Music 
Records 
Weather 
Blocks 
Hostile 
Neutral 
Players 
Ambient 
Voice 

Definition at line 34 of file Enums.hpp.

◆ Status

enum class Botcraft::Status
strong
Enumerator
Failure 
Success 

Definition at line 5 of file Status.hpp.

◆ TintType

enum class Botcraft::TintType : char
strong
Enumerator
None 
Water 
Redstone 
Grass 
Leaves 

Definition at line 158 of file Enums.hpp.

◆ ToolMaterial

enum class Botcraft::ToolMaterial : char
strong
Enumerator
None 
Wood 
Gold 
Stone 
Iron 
Diamond 
Netherite 
NUM_TOOL_MATERIAL 

Definition at line 288 of file Enums.hpp.

◆ ToolType

enum class Botcraft::ToolType : char
strong
Enumerator
None 
Axe 
Hoe 
Pickaxe 
Shears 
Shovel 
Sword 
NUM_TOOL_TYPE 

Definition at line 302 of file Enums.hpp.

Function Documentation

◆ AdjustPosSpeed()

◆ CheckBlackboardBoolData()

Status Botcraft::CheckBlackboardBoolData ( BehaviourClient client,
const std::string &  key 
)

Check in the blackboard if the bool at key is true.

Parameters
clientThe client performing the action
keyThe key to get the bool from
Returns
Success if true, failure if false or not found

Definition at line 189 of file BaseTasks.cpp.

References CheckBlackboardBoolDataImpl(), Botcraft::BehaviourClient::GetBlackboard(), and Botcraft::Blackboard::Set().

◆ CheckBlackboardBoolDataBlackboard()

Status Botcraft::CheckBlackboardBoolDataBlackboard ( BehaviourClient client)

Same thing as CheckBlackboardBoolData, but reads its parameters from the blackboard.

Parameters
clientThe client performing the action
Returns
Success if true, failure if false or not found

Definition at line 202 of file BaseTasks.cpp.

References CheckBlackboardBoolDataImpl(), Botcraft::Blackboard::Get(), and Botcraft::BehaviourClient::GetBlackboard().

◆ CheckBlackboardBoolDataImpl()

Status Botcraft::CheckBlackboardBoolDataImpl ( BehaviourClient client,
const std::string &  key 
)

◆ CheckCondition()

bool Botcraft::CheckCondition ( const std::string &  name,
const std::string &  value,
const std::vector< std::string > &  variables 
)

◆ ClickSlotInContainer()

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.

Parameters
clientThe client performing the action
container_idContainer id
slot_idClicked slot id
click_typeType of click (same as in ServerboundContainerClickPacket)
button_numButton clicked (same as in ServerboundContainerClickPacket)
Returns
Success if the slots is clicked (for versions < 1.17 and the server confirms it), Failure otherwise

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().

◆ ClickSlotInContainerBlackboard()

Status Botcraft::ClickSlotInContainerBlackboard ( BehaviourClient client)

Same thing as ClickSlotInContainer, but reads its parameters from the blackboard.

Parameters
clientThe client performing the action
Returns
Success if the slots is clicked (for versions < 1.17 and the server confirms it), Failure otherwise

Definition at line 82 of file InventoryTasks.cpp.

References ClickSlotInContainerImpl(), Botcraft::Blackboard::Get(), and Botcraft::BehaviourClient::GetBlackboard().

◆ ClickSlotInContainerImpl()

Status Botcraft::ClickSlotInContainerImpl ( BehaviourClient client,
const short  container_id,
const short  slot_id,
const int  click_type,
const char  button_num 
)

◆ CloseContainer()

Status Botcraft::CloseContainer ( BehaviourClient client,
const short  container_id = -1 
)

Close an opened container.

Parameters
clientThe client performing the action
container_idThe id of the container to close, if -1, will close the first one found
Returns
Always return Success

Definition at line 804 of file InventoryTasks.cpp.

References CloseContainerImpl(), Botcraft::BehaviourClient::GetBlackboard(), and Botcraft::Blackboard::Set().

◆ CloseContainerBlackboard()

Status Botcraft::CloseContainerBlackboard ( BehaviourClient client)

Same thing as CloseContainer, but reads its parameters from the blackboard.

Parameters
clientThe client performing the action
Returns
Always return Success

Definition at line 817 of file InventoryTasks.cpp.

References CloseContainerImpl(), Botcraft::Blackboard::Get(), and Botcraft::BehaviourClient::GetBlackboard().

◆ CloseContainerImpl()

Status Botcraft::CloseContainerImpl ( BehaviourClient client,
const short  container_id 
)

◆ Compress()

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().

◆ CopyBlackboardData()

Status Botcraft::CopyBlackboardData ( BehaviourClient client,
const std::string &  src,
const std::string &  dst 
)

Copy a blackboard data.

Parameters
clientThe client performing the action
srcSource blackboard key
dstDestination blackboard key
Returns
Always return Success

Definition at line 292 of file BaseTasks.cpp.

References CopyBlackboardDataImpl(), Botcraft::BehaviourClient::GetBlackboard(), and Botcraft::Blackboard::Set().

◆ CopyBlackboardDataBlackboard()

Status Botcraft::CopyBlackboardDataBlackboard ( BehaviourClient client)

Same thing as CopyBlackboardData, but reads its parameters from the blackboard.

Parameters
clientThe client performing the action
Returns
Always return Success

Definition at line 307 of file BaseTasks.cpp.

References CopyBlackboardDataImpl(), Botcraft::Blackboard::Get(), and Botcraft::BehaviourClient::GetBlackboard().

◆ CopyBlackboardDataImpl()

Status Botcraft::CopyBlackboardDataImpl ( BehaviourClient client,
const std::string &  src,
const std::string &  dst 
)

◆ Craft()

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.

Parameters
clientThe client performing the action
inputsInput items IDs in a 3x3 grid, inputs[0][1] refers to first line, second column
allow_inventory_craftIf true, the client will use the inventory small 2x2 grid to craft if possible
Returns
Success if item is crafted, Failure otherwise

Definition at line 1335 of file InventoryTasks.cpp.

References CraftImpl(), Botcraft::BehaviourClient::GetBlackboard(), and Botcraft::Blackboard::Set().

Referenced by CraftNamedImpl().

◆ CraftBlackboard()

Status Botcraft::CraftBlackboard ( BehaviourClient client)

Same thing as Craft, but reads its parameters from the blackboard.

Parameters
clientThe client performing the action
Returns
Success if item is crafted, Failure otherwise

Definition at line 1355 of file InventoryTasks.cpp.

References CraftImpl(), Botcraft::Blackboard::Get(), and Botcraft::BehaviourClient::GetBlackboard().

◆ CraftImpl()

◆ CraftNamed()

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.

Parameters
clientThe client performing the action
inputsInput items names in a 3x3 grid, inputs[0][1] refers to first line, second column
allow_inventory_craftIf true, the client will use the inventory small 2x2 grid to craft if possible
Returns
Success if item is crafted, Failure otherwise

Definition at line 1400 of file InventoryTasks.cpp.

References CraftNamedImpl(), Botcraft::BehaviourClient::GetBlackboard(), and Botcraft::Blackboard::Set().

◆ CraftNamedBlackboard()

Status Botcraft::CraftNamedBlackboard ( BehaviourClient client)

Same thing as CraftNamed, but reads its parameters from the blackboard.

Parameters
clientThe client performing the action
Returns
Success if item is crafted, Failure otherwise

Definition at line 1415 of file InventoryTasks.cpp.

References CraftNamedImpl(), Botcraft::Blackboard::Get(), and Botcraft::BehaviourClient::GetBlackboard().

◆ CraftNamedImpl()

Status Botcraft::CraftNamedImpl ( BehaviourClient client,
const std::array< std::array< std::string, 3 >, 3 > &  inputs,
const bool  allow_inventory_craft 
)

◆ Decompress()

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().

◆ DEFINE_ENUM_STRINGIFYER_RANGE() [1/4]

◆ DEFINE_ENUM_STRINGIFYER_RANGE() [2/4]

Botcraft::DEFINE_ENUM_STRINGIFYER_RANGE ( Hand  ,
Hand::Right  ,
Hand::Left   
)

◆ DEFINE_ENUM_STRINGIFYER_RANGE() [3/4]

Botcraft::DEFINE_ENUM_STRINGIFYER_RANGE ( LogLevel  ,
LogLevel::Trace  ,
LogLevel::None   
)

◆ DEFINE_ENUM_STRINGIFYER_RANGE() [4/4]

Botcraft::DEFINE_ENUM_STRINGIFYER_RANGE ( PlayerDiggingFace  ,
PlayerDiggingFace::Down  ,
PlayerDiggingFace::East   
)

◆ Dig()

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

Parameters
cThe client performing the action
posLocation of block to dig
send_swingIf true, will send swing packets to show other players digging in progress
faceDigging direction
allow_pathfindingIf 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.
Returns
Success if the block is broken, Failure otherwise

Definition at line 259 of file DigTask.cpp.

References DigImpl(), Botcraft::BehaviourClient::GetBlackboard(), and Botcraft::Blackboard::Set().

◆ DigBlackboard()

Status Botcraft::DigBlackboard ( BehaviourClient c)

Same thing as Dig, but reads its parameters from the blackboard.

Parameters
cThe client performing the action
Returns
Success if the block is broken, Failure otherwise

Definition at line 278 of file DigTask.cpp.

References DigImpl(), Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), and Up.

◆ DigImpl()

◆ Disconnect()

Status Botcraft::Disconnect ( BehaviourClient client)

Ask this client to disconnect from the server by setting should_be_closed to true.

Parameters
clientThe client performing the action
Returns
Always return Success

Definition at line 19 of file BaseTasks.cpp.

References Botcraft::ConnectionClient::SetShouldBeClosed(), and Success.

◆ DropItemsFromContainer()

Status Botcraft::DropItemsFromContainer ( BehaviourClient client,
const short  container_id,
const short  slot_id,
const short  num_to_keep = 0 
)

Drop item out of inventory.

Parameters
clientThe client performing the action
container_idContainer ID
slot_idSlot ID
num_to_keepNumber of items to keep in the input slot
Returns
Success if items were correctly dropped, Failure otherwise

Definition at line 200 of file InventoryTasks.cpp.

References DropItemsFromContainerImpl(), Botcraft::BehaviourClient::GetBlackboard(), and Botcraft::Blackboard::Set().

◆ DropItemsFromContainerBlackboard()

Status Botcraft::DropItemsFromContainerBlackboard ( BehaviourClient client)

Same thing as DropItemsFromContainer, but reads its parameters from the blackboard.

Parameters
clientThe client performing the action
Returns
Success if items were correctly dropped, Failure otherwise

Definition at line 217 of file InventoryTasks.cpp.

References DropItemsFromContainerImpl(), Botcraft::Blackboard::Get(), and Botcraft::BehaviourClient::GetBlackboard().

◆ DropItemsFromContainerImpl()

Status Botcraft::DropItemsFromContainerImpl ( BehaviourClient client,
const short  container_id,
const short  slot_id,
const short  num_to_keep 
)

◆ Eat()

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.

Parameters
clientThe client performing the action
food_nameThe item to eat
wait_confirmationIf true, waits for the eaten stack to be reduced by 1 before returning Success
Returns
Success if the item was eaten (and confirmed if wait_confirmation is true), Failure otherwise

Definition at line 694 of file InventoryTasks.cpp.

References EatImpl(), Botcraft::BehaviourClient::GetBlackboard(), and Botcraft::Blackboard::Set().

◆ EatBlackboard()

Status Botcraft::EatBlackboard ( BehaviourClient client)

Same thing as Eat, but reads its parameters from the blackboard.

Parameters
clientThe client performing the action
Returns
Success if the item was eaten (and confirmed if wait_confirmation is true), Failure otherwise

Definition at line 709 of file InventoryTasks.cpp.

References EatImpl(), Botcraft::Blackboard::Get(), and Botcraft::BehaviourClient::GetBlackboard().

◆ EatImpl()

◆ FindPath()

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.

Parameters
clientClient used to do the pathfinding
startStart position
endEnd position
dist_toleranceStop the search earlier if you get closer than dist_tolerance from the end position
min_end_distDesired 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_xzSame as min_end_dist but only considering the XZ plane (allows to ask to stand next to a block, but above for example)
allow_jumpIf true, allow to jump above 1-wide gaps
Returns
A vector of <feet block position, Y position> to go through to reach end +/- min_end_dist. If not possible, will return a path to get as close as possible

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().

◆ GENERATE_CHECK_HAS_FUNC() [1/3]

Botcraft::GENERATE_CHECK_HAS_FUNC ( OnNodeEndTick  )

◆ GENERATE_CHECK_HAS_FUNC() [2/3]

Botcraft::GENERATE_CHECK_HAS_FUNC ( OnNodeStartTick  )

◆ GENERATE_CHECK_HAS_FUNC() [3/3]

Botcraft::GENERATE_CHECK_HAS_FUNC ( OnNodeTickChild  )

◆ GetToolMaterialFromString()

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().

◆ GetToolTypeFromString()

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().

◆ GoTo()

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.

Parameters
clientThe client performing the action
goalThe end goal
dist_toleranceIf != 0 and the distance between final position and goal is < dist_tolerance, return Success even if goal is not reached.
min_end_distDesired 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_xzSame as min_end_dist but only considering the XZ plane (allows to ask to stand next to a block, but above for example)
allow_jumpIf true, allow to jump above 1-wide gaps
sprintIf true, the bot will sprint/swim when possible
speed_factorMultiply vanilla speed if different from 1.0
Returns
Success if goal is reached, Failure otherwise

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().

◆ GoToBlackboard()

Status Botcraft::GoToBlackboard ( BehaviourClient client)

Same thing as GoTo, but reads its parameters from the blackboard.

Parameters
clientThe client performing the action
Returns
Success if goal is reached, Failure otherwise

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.

◆ GoToDouble()

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.

Parameters
clientThe client performing the action
goalThe end goal
allow_jumpIf true, allow to jump above 1-wide gaps
sprintIf true, the bot will sprint/swim when possible
speed_factorMultiply vanilla speed if different from 1.0
Returns
Success if goal is reached, Failure otherwise

Definition at line 1512 of file PathfindingTask.cpp.

References Botcraft::BehaviourClient::GetBlackboard(), GoToImpl(), and Botcraft::Blackboard::Set().

◆ GoToDoubleBlackboard()

Status Botcraft::GoToDoubleBlackboard ( BehaviourClient client)

Same thing as GoToDouble, but reads its parameters from the blackboard.

Parameters
clientThe client performing the action
Returns
Success if goal is reached, Failure otherwise

Definition at line 1531 of file PathfindingTask.cpp.

References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), and GoToImpl().

◆ GoToImpl()

◆ HasItemIdInInventory()

Status Botcraft::HasItemIdInInventory ( BehaviourClient client,
const ItemId  item_id,
const int  quantity = 1 
)

Check if item_id is present in inventory.

Parameters
clientThe client performing the action
item_idItem id
quantityMin quantity to have
Returns
Success if inventory quantity is >= quantity else Failure

Definition at line 1463 of file InventoryTasks.cpp.

References Botcraft::BehaviourClient::GetBlackboard(), HasItemInInventoryImpl(), and Botcraft::Blackboard::Set().

◆ HasItemIdInInventoryBlackboard()

Status Botcraft::HasItemIdInInventoryBlackboard ( BehaviourClient client)

Same thing as HasItemIdInInventory, but reads its parameters from the blackboard.

Parameters
clientThe client performing the action
Returns
Success if inventory quantity is >= quantity else Failure

Definition at line 1477 of file InventoryTasks.cpp.

References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), and HasItemInInventoryImpl().

◆ HasItemInInventory()

Status Botcraft::HasItemInInventory ( BehaviourClient client,
const std::string &  item_name,
const int  quantity = 1 
)

Check if item_name is present in inventory.

Parameters
clientThe client performing the action
item_nameItem name
quantityMin quantity to have
Returns
Success if inventory quantity is >= quantity else Failure

Definition at line 1495 of file InventoryTasks.cpp.

References Botcraft::BehaviourClient::GetBlackboard(), Botcraft::AssetsManager::getInstance(), Botcraft::AssetsManager::GetItemID(), HasItemInInventoryImpl(), and Botcraft::Blackboard::Set().

◆ HasItemInInventoryBlackboard()

Status Botcraft::HasItemInInventoryBlackboard ( BehaviourClient client)

Same thing as HasItemInInventory, but reads its parameters from the blackboard.

Parameters
clientThe client performing the action
Returns
Success if inventory quantity is >= quantity else Failure

Definition at line 1511 of file InventoryTasks.cpp.

References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), Botcraft::AssetsManager::getInstance(), and HasItemInInventoryImpl().

◆ HasItemInInventoryImpl()

Status Botcraft::HasItemInInventoryImpl ( BehaviourClient client,
const ItemId  item_id,
const int  quantity 
)

◆ InteractEntity()

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.

Parameters
clientThe client performing the action
entity_idThe ID of the entity we want to interact with
handThe hand we want to use
swingIf true, a swing packet will be sent too
Returns
Success if the entity is right clicked (does not mean the server accepted it though). Failure otherwise.

Definition at line 74 of file EntitiesTasks.cpp.

References Botcraft::BehaviourClient::GetBlackboard(), InteractEntityImpl(), and Botcraft::Blackboard::Set().

◆ InteractEntityBlackboard()

Status Botcraft::InteractEntityBlackboard ( BehaviourClient client)

Same thing as InteractEntity, but reads its parameters from the blackboard.

Parameters
clientThe client performing the action
Returns
Success if the entity is right clicked (does not mean the server accepted it though). Failure otherwise.

Definition at line 91 of file EntitiesTasks.cpp.

References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), InteractEntityImpl(), and Main.

◆ InteractEntityImpl()

Status Botcraft::InteractEntityImpl ( BehaviourClient client,
const int  entity_id,
const Hand  hand,
const bool  swing 
)

◆ InteractWithBlock()

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.

Parameters
clientThe client performing the action
posThe position of the block
faceFace on which we want to clik on
animationWhether or not we should send an animation to the server (vanilla client does)
Returns
Failure if couldn't interact (because the client couldn't get close enough for example). Success otherwise.

Definition at line 146 of file BaseTasks.cpp.

References Botcraft::BehaviourClient::GetBlackboard(), InteractWithBlockImpl(), and Botcraft::Blackboard::Set().

Referenced by OpenContainerImpl().

◆ InteractWithBlockBlackboard()

Status Botcraft::InteractWithBlockBlackboard ( BehaviourClient client)

Same thing as InteractWithBlock, but reads its parameters from the blackboard.

Parameters
clientThe client performing the action
Returns
Failure if couldn't interact (because the client couldn't get close enough for example). Success otherwise.

Definition at line 163 of file BaseTasks.cpp.

References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), InteractWithBlockImpl(), and Up.

◆ InteractWithBlockImpl()

◆ IsAlive()

Status Botcraft::IsAlive ( BehaviourClient client)

Return success if player is alive.

Parameters
clientThe client performing the action
Returns
Success if player.GetHealth() > 0, Failure otherwise

Definition at line 331 of file BaseTasks.cpp.

References Failure, Botcraft::ManagersClient::GetLocalPlayer(), and Success.

◆ IsHungry()

Status Botcraft::IsHungry ( BehaviourClient client,
const int  threshold = 20 
)

Return success if player food is below a threshold.

Parameters
clientThe client performing the action
thresholdThreshold under which the player is considered to be hungry
Returns
Success if player.GetFood() < threshold, Failure otherwise

Definition at line 257 of file BaseTasks.cpp.

References Botcraft::BehaviourClient::GetBlackboard(), IsHungryImpl(), and Botcraft::Blackboard::Set().

◆ IsHungryBlackboard()

Status Botcraft::IsHungryBlackboard ( BehaviourClient client)

Same thing as IsHungry, but reads its parameters from the blackboard.

Parameters
clientThe client performing the action
Returns
Success if player.GetFood() < threshold, Failure otherwise

Definition at line 270 of file BaseTasks.cpp.

References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), and IsHungryImpl().

◆ 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().

◆ IsNightTime()

Status Botcraft::IsNightTime ( BehaviourClient client)

Return Success if it's night time (sleep is possible)

Parameters
clientThe client performing the action
Returns
Success if it's time to sleep, Failure otherwise

Definition at line 324 of file BaseTasks.cpp.

References Failure, Botcraft::ManagersClient::GetDayTime(), and Success.

◆ LogInventoryContent()

Status Botcraft::LogInventoryContent ( BehaviourClient client,
const LogLevel  level = LogLevel::Info 
)

Log all the inventory content at given log level.

Parameters
clientThe client performing the action
levelDesired log level
Returns
Always return Success

Definition at line 850 of file InventoryTasks.cpp.

References Botcraft::BehaviourClient::GetBlackboard(), LogInventoryContentImpl(), and Botcraft::Blackboard::Set().

◆ LogInventoryContentBlackboard()

Status Botcraft::LogInventoryContentBlackboard ( BehaviourClient client)

Same thing as LogInventoryContent, but reads its parameters from the blackboard.

Parameters
clientThe client performing the action
Returns
Always return Success

Definition at line 863 of file InventoryTasks.cpp.

References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), Info, and LogInventoryContentImpl().

◆ LogInventoryContentImpl()

Status Botcraft::LogInventoryContentImpl ( BehaviourClient client,
const LogLevel  level 
)

◆ LookAt()

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.

Parameters
clientThe client performing the action
targetThe target to look at
set_pitchIf false, only the yaw will be changed
sync_to_serverIf true, will wait for the new orientation to be sent to the server
Returns
Always Success if sync_to_server is false, return the SyncPosRotToServer result otherwise

Definition at line 1566 of file PathfindingTask.cpp.

References Botcraft::BehaviourClient::GetBlackboard(), LookAtImpl(), and Botcraft::Blackboard::Set().

Referenced by InteractWithBlockImpl(), and PlaceBlockImpl().

◆ LookAtBlackboard()

Status Botcraft::LookAtBlackboard ( BehaviourClient client)

Same thing as LookAt, but reads its parameters from the blackboard.

Parameters
clientThe client performing the action
Returns
Always return Success

Definition at line 1583 of file PathfindingTask.cpp.

References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), and LookAtImpl().

◆ LookAtImpl()

Status Botcraft::LookAtImpl ( BehaviourClient client,
const Vector3< double > &  target,
const bool  set_pitch,
const bool  sync_to_server 
)

◆ ModelModificationFromJson()

◆ ModelNameFromJson()

std::string Botcraft::ModelNameFromJson ( const Json::Value json)

◆ Move()

◆ OpenContainer()

Status Botcraft::OpenContainer ( BehaviourClient client,
const Position pos 
)

Open a container at a given position.

Parameters
clientThe client performing the action
posThe position of the container
Returns
Success if the container is opened, Failure otherwise

Definition at line 754 of file InventoryTasks.cpp.

References Botcraft::BehaviourClient::GetBlackboard(), OpenContainerImpl(), and Botcraft::Blackboard::Set().

◆ OpenContainerBlackboard()

Status Botcraft::OpenContainerBlackboard ( BehaviourClient client)

Same thing as OpenContainer, but reads its parameters from the blackboard.

Parameters
clientThe client performing the action
Returns
Success if the container is opened, Failure otherwise

Definition at line 767 of file InventoryTasks.cpp.

References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), and OpenContainerImpl().

◆ OpenContainerImpl()

Status Botcraft::OpenContainerImpl ( BehaviourClient client,
const Position pos 
)

◆ operator<<() [1/4]

std::ostream & Botcraft::operator<< ( std::ostream &  os,
const Direction  v 
)

◆ operator<<() [2/4]

std::ostream & Botcraft::operator<< ( std::ostream &  os,
const EntityAttribute::Type  v 
)

◆ operator<<() [3/4]

std::ostream & Botcraft::operator<< ( std::ostream &  os,
const Hand  v 
)

◆ operator<<() [4/4]

std::ostream & Botcraft::operator<< ( std::ostream &  os,
const LogLevel  v 
)

◆ PlaceBlock()

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.

Parameters
clientThe client performing the action
item_nameThe item to place
posThe location where we want to place the block
faceThe 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_confirmationIf true, waits for the server to send the new block in pos
allow_midair_placingIf false, task will fail if the neighbour block matching face is air
Returns
Success if placement attempt was made (and confirmed by the server if wait_confirmation is true), Failure otherwise

Definition at line 609 of file InventoryTasks.cpp.

References Botcraft::BehaviourClient::GetBlackboard(), PlaceBlockImpl(), and Botcraft::Blackboard::Set().

◆ PlaceBlockBlackboard()

Status Botcraft::PlaceBlockBlackboard ( BehaviourClient client)

Same thing as PlaceBlock, but reads its parameters from the blackboard.

Parameters
clientThe client performing the action
Returns
Success if placement attempt was made (and confirmed by the server if wait_confirmation is true), Failure otherwise

Definition at line 630 of file InventoryTasks.cpp.

References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), PlaceBlockImpl(), and Up.

◆ PlaceBlockImpl()

◆ PutOneItemInContainerSlot()

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.

Parameters
clientThe client performing the action
container_idContainer ID
source_slotSlot from which the item is taken
destination_slotSlot receiving the item
Returns
Success if the item is correctly set, Failure otherwise

Definition at line 264 of file InventoryTasks.cpp.

References Botcraft::BehaviourClient::GetBlackboard(), PutOneItemInContainerSlotImpl(), and Botcraft::Blackboard::Set().

◆ PutOneItemInContainerSlotBlackboard()

Status Botcraft::PutOneItemInContainerSlotBlackboard ( BehaviourClient client)

Same thing as PutOneItemInContainerSlot, but reads its parameters from the blackboard.

Parameters
clientThe client performing the action
Returns
Success if the item is correctly set, Failure otherwise

Definition at line 281 of file InventoryTasks.cpp.

References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), and PutOneItemInContainerSlotImpl().

◆ PutOneItemInContainerSlotImpl()

Status Botcraft::PutOneItemInContainerSlotImpl ( BehaviourClient client,
const short  container_id,
const short  source_slot,
const short  destination_slot 
)

◆ RemoveBlackboardData()

Status Botcraft::RemoveBlackboardData ( BehaviourClient client,
const std::string &  key 
)

Remove a value from the blackboard if exist.

Parameters
clientThe client performing the action
keyThe key to clear
Returns
Always return Success

Definition at line 224 of file BaseTasks.cpp.

References Botcraft::BehaviourClient::GetBlackboard(), RemoveBlackboardDataImpl(), and Botcraft::Blackboard::Set().

◆ RemoveBlackboardDataBlackboard()

Status Botcraft::RemoveBlackboardDataBlackboard ( BehaviourClient client)

Same thing as RemoveBlackboardData, but reads its parameters from the blackboard.

Parameters
clientThe client performing the action
Returns
Always return Success

Definition at line 237 of file BaseTasks.cpp.

References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), and RemoveBlackboardDataImpl().

◆ RemoveBlackboardDataImpl()

Status Botcraft::RemoveBlackboardDataImpl ( BehaviourClient client,
const std::string &  key 
)

◆ Say()

Status Botcraft::Say ( BehaviourClient client,
const std::string &  msg 
)

Send a message in the game chat.

Parameters
clientThe client performing the action
msgThe message to send
Returns
Always return Success

Definition at line 32 of file BaseTasks.cpp.

References Botcraft::BehaviourClient::GetBlackboard(), SayImpl(), and Botcraft::Blackboard::Set().

◆ SayBlackboard()

Status Botcraft::SayBlackboard ( BehaviourClient client)

Same thing as Say, but reads its parameters from the blackboard.

Parameters
clientThe client performing the action
Returns
Always return Success

Definition at line 45 of file BaseTasks.cpp.

References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), and SayImpl().

◆ 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().

◆ SetBlackboardData()

template<typename T >
Status Botcraft::SetBlackboardData ( BehaviourClient client,
const std::string &  key,
const T &  data 
)

Set a value in the blackboard.

Template Parameters
TAny type
Parameters
clientThe client performing the action
keyThe key in the blackboard
dataThe data to store
Returns
Always return success

Definition at line 77 of file BaseTasks.hpp.

References Botcraft::BehaviourClient::GetBlackboard(), and Botcraft::Blackboard::Set().

◆ SetBlackboardDataBlackboard()

template<typename T >
Status Botcraft::SetBlackboardDataBlackboard ( BehaviourClient client)

Same thing as SetBlackboardData, but reads its parameters from the blackboard.

Template Parameters
TAny type
Parameters
clientThe client performing the action
Returns
Always return success

Definition at line 97 of file BaseTasks.hpp.

References Botcraft::Blackboard::Get(), and Botcraft::BehaviourClient::GetBlackboard().

◆ SetItemIdInHand()

Status Botcraft::SetItemIdInHand ( BehaviourClient client,
const ItemId  item_id,
const Hand  hand = Hand::Right 
)

Try to set a given item in the given hand.

Parameters
clientThe client performing the action
item_idItem id to place in hand
handLeft or right hand
Returns
Success if the item is now in hand, Failure otherwise

Definition at line 343 of file InventoryTasks.cpp.

References Botcraft::BehaviourClient::GetBlackboard(), Botcraft::Blackboard::Set(), and SetItemInHandImpl().

◆ SetItemIdInHandBlackboard()

Status Botcraft::SetItemIdInHandBlackboard ( BehaviourClient client)

Same thing as SetItemIdInHand, but reads its parameters from the blackboard.

Parameters
clientThe client performing the action
Returns
Success if the item is now in hand, Failure otherwise

Definition at line 358 of file InventoryTasks.cpp.

References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), Right, and SetItemInHandImpl().

◆ SetItemInHand()

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.

Parameters
clientThe client performing the action
item_nameItem name to place in hand
handLeft or right hand
Returns
Success if the item is now in hand, Failure otherwise

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().

◆ SetItemInHandBlackboard()

Status Botcraft::SetItemInHandBlackboard ( BehaviourClient client)

Same thing as SetItemInHand, but reads its parameters from the blackboard.

Parameters
clientThe client performing the action
Returns
Success if the item is now in hand, Failure otherwise

Definition at line 391 of file InventoryTasks.cpp.

References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), Botcraft::AssetsManager::getInstance(), Botcraft::AssetsManager::GetItemID(), Right, and SetItemInHandImpl().

◆ SetItemInHandImpl()

◆ SortInventory()

Status Botcraft::SortInventory ( BehaviourClient client)

◆ StartFlying()

Status Botcraft::StartFlying ( BehaviourClient client)

Make the current player fly (as in creative/spectator mode, NOT WITH ELYTRA)

Parameters
clientThe client performing the action
Returns
Success if the player is now flying, failure otherwise

Definition at line 1603 of file PathfindingTask.cpp.

References Failure, Botcraft::ManagersClient::GetLocalPlayer(), Botcraft::ManagersClient::GetPhysicsManager(), Success, and Botcraft::Utilities::YieldForCondition().

◆ StopFlying()

Status Botcraft::StopFlying ( BehaviourClient client)

Make the current player not fly (as in creative/spectator mode, NOT WITH ELYTRA)

Parameters
clientThe client performing the action
Returns
Success if the player is now not flying anymore, failure otherwise

Definition at line 1645 of file PathfindingTask.cpp.

References Failure, Botcraft::ManagersClient::GetLocalPlayer(), Botcraft::ManagersClient::GetPhysicsManager(), Success, and Botcraft::Utilities::YieldForCondition().

Referenced by GoToImpl().

◆ SwapItemsInContainer()

Status Botcraft::SwapItemsInContainer ( BehaviourClient client,
const short  container_id,
const short  first_slot,
const short  second_slot 
)

Swap two slots in a given container.

Parameters
clientThe client performing the action
container_idContainer ID
first_slotFirst slot index
second_slotSecond slot index
Returns
Success if the two slots have been correctly swapped, Failure otherwise

Definition at line 135 of file InventoryTasks.cpp.

References Botcraft::BehaviourClient::GetBlackboard(), Botcraft::Blackboard::Set(), and SwapItemsInContainerImpl().

Referenced by SetItemInHandImpl(), and TradeImpl().

◆ SwapItemsInContainerBlackboard()

Status Botcraft::SwapItemsInContainerBlackboard ( BehaviourClient client)

Same thing as SwapItemsInContainer, but reads its parameters from the blackboard.

Parameters
clientThe client performing the action
Returns
Success if the two slots have been correctly swapped, Failure otherwise

Definition at line 152 of file InventoryTasks.cpp.

References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), and SwapItemsInContainerImpl().

◆ SwapItemsInContainerImpl()

Status Botcraft::SwapItemsInContainerImpl ( BehaviourClient client,
const short  container_id,
const short  first_slot,
const short  second_slot 
)

◆ SyncPosRotToServer()

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

Parameters
clientThe client performing the action
Returns
Failure if the position has not been properly sent to the server in a reasonable time (it may happen if the physics manager is currently not running), Success otherwise

Definition at line 1682 of file PathfindingTask.cpp.

References Failure, Botcraft::ManagersClient::GetLocalPlayer(), Botcraft::ManagersClient::GetPhysicsManager(), Success, and Botcraft::Utilities::YieldForCondition().

Referenced by LookAtImpl().

◆ Trade()

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.

Parameters
clientThe client performing the action
item_idId of the item to buy/sell
buyIf true, the item is bought, otherwise is sold
trade_idIf > -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)
Returns
Success if the exchange went sucessfully, Failure otherwise

Definition at line 1044 of file InventoryTasks.cpp.

References Botcraft::BehaviourClient::GetBlackboard(), Botcraft::Blackboard::Set(), and TradeImpl().

◆ TradeBlackboard()

Status Botcraft::TradeBlackboard ( BehaviourClient client)

Same thing as Trade, but reads its parameters from the blackboard.

Parameters
clientThe client performing the action
Returns
Success if the exchange went sucessfully, Failure otherwise

Definition at line 1061 of file InventoryTasks.cpp.

References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), and TradeImpl().

◆ TradeImpl()

◆ TradeName()

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.

Parameters
clientThe client performing the action
item_nameItem to buy/sell
buyIf true, the item is bought, otherwise is sold
trade_idIf > -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)
Returns
Success if the exchange went sucessfully, Failure otherwise

Definition at line 1095 of file InventoryTasks.cpp.

References Botcraft::BehaviourClient::GetBlackboard(), Botcraft::Blackboard::Set(), and TradeNameImpl().

◆ TradeNameBlackboard()

Status Botcraft::TradeNameBlackboard ( BehaviourClient client)

Same thing as TradeName, but reads its parameters from the blackboard.

Parameters
clientThe client performing the action
Returns
Success if the exchange went sucessfully, Failure otherwise

Definition at line 1112 of file InventoryTasks.cpp.

References Botcraft::Blackboard::Get(), Botcraft::BehaviourClient::GetBlackboard(), and TradeNameImpl().

◆ TradeNameImpl()

Status Botcraft::TradeNameImpl ( BehaviourClient client,
const std::string &  item_name,
const bool  buy,
const int  trade_id 
)

◆ WeightFromJson()

int Botcraft::WeightFromJson ( const Json::Value json)

◆ Yield()

Status Botcraft::Yield ( BehaviourClient client)

Just call client.Yield().

Can be used to Idle the behaviour.

Parameters
clientThe client performing the action
Returns
Always return Success

Definition at line 11 of file BaseTasks.cpp.

References Success, and Botcraft::BehaviourClient::Yield().

Variable Documentation

◆ botcraft_pathfinding_speed_key

const std::string Botcraft::botcraft_pathfinding_speed_key = "botcraft:speed"
static

Definition at line 981 of file PathfindingTask.cpp.

Referenced by Move().

◆ CHUNK_WIDTH

◆ SECTION_HEIGHT