Add optional arguments to DigBlock()
This commit is contained in:
ORelio 2020-11-14 10:19:51 +01:00
parent 2eba2149b7
commit 20f6375153
2 changed files with 9 additions and 5 deletions

View file

@ -860,10 +860,12 @@ namespace MinecraftClient
/// <summary>
/// Attempt to dig a block at the specified location
/// </summary>
/// <param name="location">Location</param>
protected bool DigBlock(Location location)
/// <param name="location">Location of block to dig</param>
/// <param name="swingArms">Also perform the "arm swing" animation</param>
/// <param name="lookAtBlock">Also look at the block before digging</param>
protected bool DigBlock(Location location, bool swingArms = true, bool lookAtBlock = true)
{
return Handler.DigBlock(location);
return Handler.DigBlock(location, swingArms, lookAtBlock);
}
/// <summary>

View file

@ -1402,7 +1402,8 @@ namespace MinecraftClient
/// </summary>
/// <param name="location">Location of block to dig</param>
/// <param name="swingArms">Also perform the "arm swing" animation</param>
public bool DigBlock(Location location, bool swingArms = true)
/// <param name="lookAtBlock">Also look at the block before digging</param>
public bool DigBlock(Location location, bool swingArms = true, bool lookAtBlock = true)
{
if (GetTerrainEnabled())
{
@ -1410,7 +1411,8 @@ namespace MinecraftClient
Direction blockFace = Direction.Down;
// Look at block before attempting to break it
UpdateLocation(GetCurrentLocation(), location);
if (lookAtBlock)
UpdateLocation(GetCurrentLocation(), location);
// Send dig start and dig end, will need to wait for server response to know dig result
// See https://wiki.vg/How_to_Write_a_Client#Digging for more details