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).
1
string GetUuid();
Copied!

GetUsername

Returns the username of the bot.
1
string GetUsername();
Copied!

GetPosition

Returns the position of the bot.
1
IPosition GetPosition();
Copied!

GetLocation

Returns the Location of the bot, where the coordinates are rounded down from doubles to integers.
1
ILocation GetLocation();
Copied!

GetRotation

Returns the rotation (yaw, pitch) of the bot.
1
IRotation GetRotation();
Copied!

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.
1
float GetHealth();
Copied!

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.
1
float GetFood();
Copied!

GetFoodSaturation

Returns the food saturation of the bot.
1
float GetFoodSaturation();
Copied!

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.
1
int GetEntityId();
Copied!

GetHeldSlot

Returns the hobar slot that the bot has currently selected. This can be null or empty.
1
ISlot GetHeldSlot();
Copied!

GetHeldIndex

Returns the index (0-8) of the hotbar slot that the bot has currently selected.
1
short GetHeldIndex();
Copied!

IsDead

Returns whether the bot is dead.
1
bool IsDead();
Copied!

GetExperienceLevel

Returns the bot's experience level.
1
int GetExperienceLevel();
Copied!

GetExperience

Returns the total experience points of the bot.
1
int GetExperience();
Copied!

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.
1
IEffectContainer GetEffects()
Copied!

HasEffect

Returns whether the bot has the specified effect.
1
bool HasEffect(Effects effect)
Copied!

SetCrouchState

Sets the crouching state of the bot to the specified mode (Couch, Uncrouched).
1
Task SetCrouchState(CrouchStates mode);
Copied!

IsCrouching

Returns whether the bot is crouching.
1
bool IsCrouching();
Copied!

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.
1
void Chat(string message);
Copied!

Respawn

Attempts to respawn the bot. The task that this function returns is completed once a world reload is done.
1
Task Respawn();
Copied!

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+.
1
Task SwapItemInHands();
Copied!

UseHeld

Right clicks the currently held item.
1
Task UseHeld();
Copied!

Swing

Performs the (left) arm swing animation. This is only the animation and will not hit any mobs or blocks.
1
Task Swing();
Copied!

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!
1
Task<bool> Eat();
Copied!

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.
1
Task SetLook(IRotation rotation);
2
Task SetLook(Directions direction);
Copied!

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.
1
Task LookAt(IPosition position);
2
Task LookAt(ILocation location);
Copied!

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'.
1
Task LookAtSmooth(IPosition position, LookSpeed speed = LookSpeed.auto);
2
Task LookAtSmooth(ILocation location, LookSpeed speed = LookSpeed.auto);
Copied!

Jump

The bot attempts to jump up. This will not move the bot horizontally, only vertically.
1
void Jump();
Copied!

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.Taskand 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.
1
MoveDirection(Direction direction, MapOptions options = null);
Copied!

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.Taskand 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.
1
IMoveTask MoveTo(ILocation location, MapOptions options = null);
2
IMoveTask MoveTo(IPosition position, MapOptions options = null);
3
IMoveTask MoveTo(int x, int y, int z, MapOptions options = null);
4
5
/*
6
* E.g. of pathing and waiting for it to finish
7
*/
8
public async Task OnTick() {
9
var moveResult = await Context.Player.MoveTo(new Location(100, 40, 100)).Task;
10
if(moveResult.Result == MoveResultType.Completed)
11
Console.WriteLine("Moved to 100/40/100");
12
else
13
Console.WriteLine("Failed to move to 100/40/100, path was "
14
+ moveResult.Result);
15
}
Copied!

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.Taskand 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.
1
IMoveTask MoveToRange(ILocation location, int range, MapOptions options = null);
2
IMoveTask MoveToRange(IPosition position, int range, MapOptions options = null);
3
IMoveTask MoveToRange(int x, int y, int z, int range, MapOptions options = null);
Copied!

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.Taskand 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.
1
IMoveTask MoveToRangeCustom(ILocation location, int range, Func<IBlock, bool> canBlockBePicked, MapOptions options = null);
2
IMoveTask MoveToRangeCustom(IPosition position, int range, Func<IBlock, bool> canBlockBePicked, MapOptions options = null);
3
IMoveTask MoveToRangeCustom(int x, int y, int z, int range, Func<IBlock, bool> canBlockBePicked, MapOptions options = null);
Copied!

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.Taskand 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.
1
IMoveTask MoveToInteractionRange(ILocation location, MapOptions options = null);
2
IMoveTask MoveToInteractionRange(IPosition position, MapOptions options = null);
3
IMoveTask MoveToInteractionRange(int x, int y, int z, MapOptions options = null);
Copied!

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.Taskand 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.
1
IMoveTask FollowEntity(IEntity entity, MapOptions options = null);
2
IMoveTask FollowEntity(IEntity entity, int maxRange, MapOptions options = null);
3
IMoveTask FollowEntity(IEntity entity, int maxRange, int minRange, MapOptions options = null);
Copied!

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.
1
Task<ICachedPath> CreateReusablePath(IPosition start, IPosition end, MapOptions options = null);
2
Task<ICachedPath> CreateReusablePath(ILocation start, ILocation end, MapOptions options = null);
Copied!

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.Taskand returns a MoveResult, which contains the path that was used (MoveResult.Path) and the outcome (MoveResult.Result).
1
IMoveTask ExecuteReusablePath(ICachedPath path);
Copied!

Disconnect

Disconnects the bot from the server. You can optionally specify the disconnect message, which will be shown in the accounts tab.
1
void Disconnect(string message = null);
Copied!
Last modified 1yr ago