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> /// <summary>
/// Attempt to dig a block at the specified location /// Attempt to dig a block at the specified location
/// </summary> /// </summary>
/// <param name="location">Location</param> /// <param name="location">Location of block to dig</param>
protected bool DigBlock(Location location) /// <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> /// <summary>

View file

@ -1402,7 +1402,8 @@ namespace MinecraftClient
/// </summary> /// </summary>
/// <param name="location">Location of block to dig</param> /// <param name="location">Location of block to dig</param>
/// <param name="swingArms">Also perform the "arm swing" animation</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()) if (GetTerrainEnabled())
{ {
@ -1410,7 +1411,8 @@ namespace MinecraftClient
Direction blockFace = Direction.Down; Direction blockFace = Direction.Down;
// Look at block before attempting to break it // 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 // 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 // See https://wiki.vg/How_to_Write_a_Client#Digging for more details