mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Calulate dig range using eyes location (#1228)
This commit is contained in:
parent
ee164dfcc2
commit
70c991cd30
3 changed files with 11 additions and 2 deletions
|
|
@ -885,7 +885,7 @@ namespace MinecraftClient
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the current location of the player
|
/// Get the current location of the player (Feets location)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Minecraft world or null if associated setting is disabled</returns>
|
/// <returns>Minecraft world or null if associated setting is disabled</returns>
|
||||||
protected Mapping.Location GetCurrentLocation()
|
protected Mapping.Location GetCurrentLocation()
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ namespace MinecraftClient.Commands
|
||||||
int y = int.Parse(args[1]);
|
int y = int.Parse(args[1]);
|
||||||
int z = int.Parse(args[2]);
|
int z = int.Parse(args[2]);
|
||||||
Location blockToBreak = new Location(x, y, z);
|
Location blockToBreak = new Location(x, y, z);
|
||||||
if (blockToBreak.DistanceSquared(handler.GetCurrentLocation()) > 25)
|
if (blockToBreak.DistanceSquared(handler.GetCurrentLocation().EyesLocation()) > 25)
|
||||||
return "You are too far away from this block.";
|
return "You are too far away from this block.";
|
||||||
if (handler.GetWorld().GetBlock(blockToBreak).Type == Material.Air)
|
if (handler.GetWorld().GetBlock(blockToBreak).Type == Material.Air)
|
||||||
return "No block at this location (Air)";
|
return "No block at this location (Air)";
|
||||||
|
|
|
||||||
|
|
@ -149,6 +149,15 @@ namespace MinecraftClient.Mapping
|
||||||
return Math.Sqrt(DistanceSquared(location));
|
return Math.Sqrt(DistanceSquared(location));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Considering the current location as Feet location, calculate Eyes location
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Player Eyes location</returns>
|
||||||
|
public Location EyesLocation()
|
||||||
|
{
|
||||||
|
return this + new Location(0, 1.62, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compare two locations. Locations are equals if the integer part of their coordinates are equals.
|
/// Compare two locations. Locations are equals if the integer part of their coordinates are equals.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue