diff --git a/MinecraftClient/ChatBot.cs b/MinecraftClient/ChatBot.cs index d1bf53bd..ad908ad8 100644 --- a/MinecraftClient/ChatBot.cs +++ b/MinecraftClient/ChatBot.cs @@ -885,7 +885,7 @@ namespace MinecraftClient } /// - /// Get the current location of the player + /// Get the current location of the player (Feets location) /// /// Minecraft world or null if associated setting is disabled protected Mapping.Location GetCurrentLocation() diff --git a/MinecraftClient/Commands/Dig.cs b/MinecraftClient/Commands/Dig.cs index 80b4d04a..f7d445a6 100644 --- a/MinecraftClient/Commands/Dig.cs +++ b/MinecraftClient/Commands/Dig.cs @@ -27,7 +27,7 @@ namespace MinecraftClient.Commands int y = int.Parse(args[1]); int z = int.Parse(args[2]); 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."; if (handler.GetWorld().GetBlock(blockToBreak).Type == Material.Air) return "No block at this location (Air)"; diff --git a/MinecraftClient/Mapping/Location.cs b/MinecraftClient/Mapping/Location.cs index 0d199951..df780573 100644 --- a/MinecraftClient/Mapping/Location.cs +++ b/MinecraftClient/Mapping/Location.cs @@ -149,6 +149,15 @@ namespace MinecraftClient.Mapping return Math.Sqrt(DistanceSquared(location)); } + /// + /// Considering the current location as Feet location, calculate Eyes location + /// + /// Player Eyes location + public Location EyesLocation() + { + return this + new Location(0, 1.62, 0); + } + /// /// Compare two locations. Locations are equals if the integer part of their coordinates are equals. ///