IBlock

Represents a block in the world. This can be used to interact with the block (e.g.: dig, use) or block location (e.g.: place at).

Methods

GetId

GetMetadata

GetLocation

GetBlockEntityData

MoveTo

MoveToRange

MoveToInteractionRange

IsBotStandingOn

IsEntityStandingOn

IsInteractiveRange

GetVisibleFaces

GetVisibleFacesFrom

GetPlaceableFaces

IsInvisible

IsInvisibleFrom

IsSafeToMine

IsBlockDangerous

IsSolid

IsLiquid

IsMineable

IsAir

IsTransparent

IsUndesirableForPath

Use

Dig

Hit

LookAt

LookAtSmooth

PlaceOn

PlaceAt

Methods

GetId

Returns the Minecraft Block ID of the block. References: https://minecraft-ids.grahamedgecombe.com/

ushort GetId();

GetMetadata

Returns the Metadata of the block as a byte (0-255).

byte GetMetadata();

GetLocation

Returns the location of the block.

ILocation GetLocation();

GetBlockEntityData

Returns block entity data (e.g.: sign text) for blocks that have it, otherwise null is returned. The returned type is IBlockEntity data which by it self has a Type property, which further specifies the entity data type (e.g.: sign). A full list of BlockEntity types can be found here.

IBlockEntity GetBlockEntityData();
// the result is a generic type which can then be converted like this:
// if(blockEntityData.Type == BlockEntityType.Sign) {
//     var convertedData = (SignBlockEntity)blockEntityData;
//     var signText = convertedData.GetContinuousText();
// }

MoveTo

Attempts to move the bot onto this block. This is a wrapper function for Player.MoveTo, for more information check that.

IMoveTask MoveTo(MapOptions options = null);

MoveToRange

Attempts to move the bot into the specified range of this block. You must specify the max distance that we can be from this block to still be considered in range. This is a wrapper function for Player.MoveToRange, for more information check that.

IMoveTask MoveToRange(int maxRange, MapOptions options = null);

MoveToInteractionRange

Attempts to move the bot to a location that it can interact with this block from. The function considers the visibility and bot's reach. This is a wrapper function for Player.MoveToInteractionRange, for more information check that.

IMoveTask MoveToInteractionRange(MapOptions options = null);

IsBotStandingOn

Returns true if this bot is standing on the given block, otherwise false.

bool IsBotStandingOn();

IsEntityStandingOn

Returns true if there is an entity that is standing on the block, otherwise false. If the output is true then the out parameter entities will contain a list of entities that are on the block. Note: this does not include this bot's entity.

bool IsEntityStandingOn(out IEntity[] entities);

IsInInteractionRange

Returns True if the block is within the interaction range (around 5 blocks) of the bot, otherwise false.

bool IsInInteractionRange();

GetVisibleFaces

Returns the faces (sides) that the bot can see from the current location of this block. This will be at most 3 faces.

FaceData[] GetVisibleFaces();

GetVisibleFacesFrom

Returns the faces (sides) of this block that the bot could see from the given eye position. Eye position for the player is feetPosition + 1.65. This will be at most 3 faces.

FaceData[] GetVisibleFacesFrom(IPosition eyePosition);

GetPlaceableFaces

Returns the faces of this block that can be placed on (i.e.: don't have a block already attached to it).

FaceData[] GetPlaceableFaces();

IsVisibleFrom

Returns true if the bot would have direct line-of-sight to this block at a given eye position, otherwise false. Eye position for the player is feetPosition + 1.65.

bool IsVisibleFrom(IPosition eyePosition);

IsVisible

Wrapper function for IsVisibleFrom where IsVisibleFrom gets called with the bot's current eye position.

bool IsVisible();

IsSafeToMine

Returns true if mining this block would harm us in any way, otherwise false. By default this only considers the current bot instance, however the parameter regardOtherBots can enable checks for other bots safety as well. Note: This accounts for things such as lava flowing into us, sand falling ontop of us, us falling down a cave, and almost any scenario where it would harm us.

bool IsSafeToMine(bool regardOtherBots = false);

IsBlockDangerous

Returns true if the block will damage the player if we are near it or stand on it, otherwise false. Note: Examples include Lava, Cactus, Magma Block, etc.

bool IsBlockDangerous();

IsSolid

Returns true if the block is solid, otherwise false. Note: Examples include stone, dirt, wooden planks, etc.

bool IsSolid();

IsLiquid

Returns true if the block is a liquid (water or lava), otherwise false.

bool IsLiquid();

IsMineable

Returns true if the block is mineable, otherwise false. Note: This does not account for tool inequality such as mining obsidian with iron pickaxes, this is just for if the block will ever be mineable such as mining water, bedrock, void, etc.

bool IsMineable();

IsAir

Returns true if the block is an Air block (empty), otherwise false.

bool IsAir();

IsTransparent

Returns true if the block is transparent, otherwise false. Note: Examples include torches, rails, signs, pressure plates, etc.

bool IsTransparent();

IsUndesireableForPath

Returns true if there are any objects in the path that can slow the bot down, harm it, or get it stuck. Note: This includes things like slime blocks, mob heads, lava, fences, etc.

bool IsUndesirableForPath();

Use

Right clicks on the given block. This will consider visibility of the faces (sides) and will rotate the bots head to face the correct face (side), however it will not move the bot to the block (that is up to the developer to do).

Task Use();

Dig

Attempts to break this block. You can optionally specify the face (side) that will be used to dig the block. This does rotate the bots head to the appropriate block's face. If no face data is specified and no visible face is found then it will default to breaking the block using the Top (+Y) face.

The function returns Task<IDigAction> which completes once the block is broken or instantly if the dig action was invalid (e.g.: attempting to break bedrock). The variables cancelled and/or completed can be used to determine the dig actions outcome.

Task<IDigAction> Dig();
Task<IDigAction> Dig(sbyte face);
Task<IDigAction> Dig(FaceData faceData);

Hit

Hits (left clicks) the given block. This will consider visibility of the faces (sides) and will rotate the bots head to face the correct face (side), however it will not move the bot to the block (that is up to the developer to do).

Task Hit();

LookAt

Looks at the given block. If no parameter is provided then the bot will look at the center of the block, however optionally you can specify the face (side) of the block to look at. Note: you can find a list of the faces and their corresponding information here.

Task LookAt(FaceData faceData = null);
Task LookAt(sbyte face);

LookAtSmooth

Smoothly (slowly, per multiple ticks) looks at the given block. If no parameter is provided then the bot will look at the center of the block, however optionally you can specify the face (side) of the block to look at. 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'.

Task LookAtSmooth(FaceData faceData = null, LookSpeed speed = LookSpeed.auto);
Task LookAtSmooth(sbyte face, LookSpeed speed = LookSpeed.auto);

PlaceAt

Attempts to place a block that the bot is currently holding (does not validate if the bot is holding a block, that is up to the developer) at this location. This is done by getting the nearby block faces and checking whether we can place on them. This does consider the visibility of faces. If no visible face is found then false is returned, otherwise true. Note: this does not check whether the server cancelled the block placement (removed the placed block), nor does this function move the player to the range of the block (that is up to developer to do).

Task<bool> PlaceAt();

PlaceOn

Attempts to place a block that the bot is currently holding by right clicking on this block's specified face (side). The visibility of a face is not verified. Note: this function does not move the player to the range of the block (that is up to developer to do). You can find a list of the faces and their corresponding information here.

Task PlaceOn(FaceData faceData);
Task PlaceOn(sbyte face);

Last updated