mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Perform arm animation when breaking blocks (#1254)
This commit is contained in:
parent
9bfb2bf6c7
commit
b1233ace7c
3 changed files with 8 additions and 5 deletions
|
|
@ -915,7 +915,7 @@ namespace MinecraftClient
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the current location of the player (Feets location)
|
||||
/// Get the current location of the player (Feet location)
|
||||
/// </summary>
|
||||
/// <returns>Minecraft world or null if associated setting is disabled</returns>
|
||||
protected Mapping.Location GetCurrentLocation()
|
||||
|
|
|
|||
|
|
@ -16,13 +16,14 @@ namespace MinecraftClient.Inventory.ItemPalettes
|
|||
foreach (KeyValuePair<int, ItemType> entry in GetDict())
|
||||
DictReverse.Add(entry.Value, entry.Key);
|
||||
|
||||
DictReverse[ItemType.Unknown] = -2;
|
||||
DictReverse[ItemType.Null] = -1;
|
||||
// Hardcoded placeholder types for internal and network use
|
||||
DictReverse[ItemType.Unknown] = (int)ItemType.Unknown;
|
||||
DictReverse[ItemType.Null] = (int)ItemType.Null;
|
||||
}
|
||||
|
||||
public ItemType FromId(int id)
|
||||
{
|
||||
// Unknown item types may appear of Forge servers for custom items
|
||||
// Unknown item types may appear on Forge servers for custom items
|
||||
if (!GetDict().ContainsKey(id))
|
||||
return ItemType.Unknown;
|
||||
|
||||
|
|
|
|||
|
|
@ -1403,7 +1403,8 @@ namespace MinecraftClient
|
|||
/// Attempt to dig a block at the specified location
|
||||
/// </summary>
|
||||
/// <param name="location">Location of block to dig</param>
|
||||
public bool DigBlock(Location location)
|
||||
/// <param name="swingArms">Also perform the "arm swing" animation</param>
|
||||
public bool DigBlock(Location location, bool swingArms = true)
|
||||
{
|
||||
if (GetTerrainEnabled())
|
||||
{
|
||||
|
|
@ -1416,6 +1417,7 @@ namespace MinecraftClient
|
|||
// 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
|
||||
return handler.SendPlayerDigging(0, location, blockFace)
|
||||
&& (!swingArms || DoAnimation((int)Hand.MainHand))
|
||||
&& handler.SendPlayerDigging(2, location, blockFace);
|
||||
}
|
||||
else return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue