Player
Methods
Properties
GetUuid
State
GetUsername
Manager
GetPosition
PhysicsEngine
GetLocation
Crafting
GetRotation
Controls
GetHealth
GetFood
GetFoodSaturation
GetEntityId
GetHeldSlot
GetHeldIndex
IsDead
GetExperienceLevel
GetExperience
GetEffects
HasEffect
SetCrouchState
IsCrouching
Chat
Respawn
SwapItemInHands
UseHeld
Swing
Eat
SetLook
LookAt
LookAtSmooth
Jump
MoveDirection
MoveTo
MoveToRange
MoveToRangeCustom
MoveToInteactionRange
CreateReusablePath
ExecuteReusablePath
Disconnect
Properties
State
The state can be accessed by Context.Player.State. The state contains information that is relevant to the current session of the bot, such as LoggedIn, Spawned, Eating, etc.
Controls
The controls can be accessed by Context.Player.Controls. Provides high-level controls over the bot. This class allows you to use mouse and keyboard controls such as ClickMouseButton, HoldMouseButton, SpamMouseButton, KeyboardHoldForward, etc.
Crafting
The crafting manager can be accessed by Context.Player.Crafting. Provides a high-level crafting interface. This class gives you access to functions Craft(CraftingTask task), and GetMaxCrafts(CraftingTask task). Note: comments on Github provide adequate explanations for this class.
Methods
GetUuid
Returns the bot's uuid. You can use https://mcuuid.net/ to convert a username to an uuid manually. The returned value is in the format of `91a546fca6fe44c99550ab2291f28760` (does not have dashes).
GetUsername
Returns the username of the bot.
GetPosition
Returns the position of the bot.
GetLocation
Returns the Location of the bot, where the coordinates are rounded down from doubles to integers.
GetRotation
Returns the rotation (yaw, pitch) of the bot.
GetHealth
Returns the health of the bot. Note: the Health is measured 0 (aka dead) up to 20 (full health), not up to 10 like Minecraft's visual indicators.
GetFood
Returns the how much food the bot has. Note: the Food is measured 0 up to 20, not up to 10 like Minecraft's visual indicators.
GetFoodSaturation
Returns the food saturation of the bot.
GetEntityId
Returns the bot's entity's id. This is sent over by the server to the bot and other bots may have different entity ids for this bot.
GetHeldSlot
Returns the hobar slot that the bot has currently selected. This can be null or empty.
GetHeldIndex
Returns the index (0-8) of the hotbar slot that the bot has currently selected.
IsDead
Returns whether the bot is dead.
GetExperienceLevel
Returns the bot's experience level.
GetExperience
Returns the total experience points of the bot.
GetEffects
Returns the IEffectContainer of the bot, which can be used to determine the bot's status effects (e.g.: poisoned, regeneration, strength), their duration, and their level.
HasEffect
Returns whether the bot has the specified effect.
SetCrouchState
Sets the crouching state of the bot to the specified mode (Couch, Uncrouched).
IsCrouching
Returns whether the bot is crouching.
Chat
Sends a chat message to the server. Server commands are also sent from this, however they have /
appended to the beginning of the message.
Note: protocols up to 1.11 have a character limit of 100 characters per message, where as 1.11 and later protocols can have messages with up to 256 characters.
Respawn
Attempts to respawn the bot. The task that this function returns is completed once a world reload is done.
SwapItemInHands
Swaps the item that the player is currently holding in it's primary hand to it's off-hand and vice-versa. Note: this only works on 1.9+.
UseHeld
Right clicks the currently held item.
Swing
Performs the (left) arm swing animation. This is only the animation and will not hit any mobs or blocks.
Eat
Attempts to "eat" (hold right click) on the selected item. This does not check whether the player is currently holding food, that is up to the developer to do!
SetLook
Sets the bot's rotation to the specified value. You can optionally await for this function as the server can take a bit to update the change. The await value is always 1 tick and is here only for the convenience.
LookAt
Sets the bot's rotation to look at the specified position. You can optionally await for this function as the server can take a bit to update the change. The await value is always 1 tick and is here only for the convenience.
LookAtSmooth
Smoothly (slowly, per multiple ticks) sets the bot's rotation to look at the specified position. You should await for this function to complete, as the rotation time is dynamic. You can optionally specify the look speed, however it is recommended to leave it as 'auto'.
Jump
The bot attempts to jump up. This will not move the bot horizontally, only vertically.
MoveDirection
Attempts to move the player in the specified direction. You can optionally specify the MapOptions, which control what the bot can and cannot do while pathing (e.g.: can't build, can't walk on sand).
Returns IMoveTask, which has functions to affect the current path, such as SetNewTarget()
and Stop()
. IMoveTask also contains the task that will be marked completed once the path is completed/cancelled. The task can be awaited by doing await IMoveTask.Task
and returns a MoveResult, which contains the path that was used (MoveResult.Path) and the outcome (MoveResult.Result).
Note: Path can be used by re-used withcontext.player.ExecuteReusablePath
.
MoveTo
Attempts to move the player to the specified location. You can optionally specify the MapOptions, which control what the bot can and cannot do while pathing (e.g.: can't build, can't walk on sand).
Returns IMoveTask, which has functions to affect the current path, such as SetNewTarget()
and Stop()
. IMoveTask also contains the task that will be marked completed once the path is completed/cancelled. The task can be awaited by doing await IMoveTask.Task
and returns a MoveResult, which contains the path that was used (MoveResult.Path) and the outcome (MoveResult.Result).
Note: Path can be used by re-used withcontext.player.ExecuteReusablePath
.
MoveToRange
Attempts to move the player in range to the specified (within the specified range) or to the specified location it self. The range is circular, that means that the total distance to the block must be within the specified radius. You can optionally specify the MapOptions, which control what the bot can and cannot do while pathing (e.g.: can't build, can't walk on sand).
Returns IMoveTask, which has functions to affect the current path, such as SetNewTarget()
and Stop()
. IMoveTask also contains the task that will be marked completed once the path is completed/cancelled. The task can be awaited by doing await IMoveTask.Task
and returns a MoveResult, which contains the path that was used (MoveResult.Path) and the outcome (MoveResult.Result).
Note: Path can be used by re-used withcontext.player.ExecuteReusablePath
.
MoveToRangeCustom
Attempts to move the player onto a block that is within a specified range of the location and canBlockBePicked returns true for the selected block. This allows developers to customize the block that the bot will pick to stand on. You can optionally specify the MapOptions, which control what the bot can and cannot do while pathing (e.g.: can't build, can't walk on sand).
Returns IMoveTask, which has functions to affect the current path, such as SetNewTarget()
and Stop()
. IMoveTask also contains the task that will be marked completed once the path is completed/cancelled. The task can be awaited by doing await IMoveTask.Task
and returns a MoveResult, which contains the path that was used (MoveResult.Path) and the outcome (MoveResult.Result).
Note: Path can be used by re-used withcontext.player.ExecuteReusablePath
.
MoveToInteractionRange
Attempts to move the player onto a block that the specified location can be reached from and seen from. This means that this takes both the interaction range of the player (~4.5 blocks) and the visibility into account when looking for a block. You can optionally specify the MapOptions, which control what the bot can and cannot do while pathing (e.g.: can't build, can't walk on sand).
Returns IMoveTask, which has functions to affect the current path, such as SetNewTarget()
and Stop()
. IMoveTask also contains the task that will be marked completed once the path is completed/cancelled. The task can be awaited by doing await IMoveTask.Task
and returns a MoveResult, which contains the path that was used (MoveResult.Path) and the outcome (MoveResult.Result).
Note: Path can be used by re-used withcontext.player.ExecuteReusablePath
.
FollowEntity
Makes the bot follow the specified entity. You can optionally specify the maxRange and the minRange that the bot must keep to the player. If no maxRange is specified then 1 is used, meaning the bot will path to the same position as the player is in.
Returns IMoveTask, which has functions to affect the current path, such as SetNewTarget()
and Stop()
. IMoveTask also contains the task that will be marked completed once the path is completed/cancelled. The task can be awaited by doing await IMoveTask.Task
and returns a MoveResult, the outcome of the path (MoveResult.Result).
The IMoveTask.Task is marked as completed when either the player is reached or the player dies/moves out of ranges or when a new path is specified. Therefore for constant following you should place this on a loop where if the path is done then you re-queue another follow call.
CreateReusablePath
Performs a path lookup and stores it into a reusable variable, which can be used later. The result of this function can be used with ExecuteReusablePath to actually perform that movement of the path. Note: When reusing paths, the bots must start at the same location the path was created at.
ExecuteReusablePath
The bot must be standing in the same location that the path originates from otherwise the bot may not path as expected.
Attempts to re-use a path that has been calculated beforehand.
Returns IMoveTask, which has functions to affect the current path, such as SetNewTarget()
and Stop()
. IMoveTask also contains the task that will be marked completed once the path is completed/cancelled. The task can be awaited by doing await IMoveTask.Task
and returns a MoveResult, which contains the path that was used (MoveResult.Path) and the outcome (MoveResult.Result).
Disconnect
Disconnects the bot from the server. You can optionally specify the disconnect message, which will be shown in the accounts tab.
Last updated