mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Upgrade old coordinate parsing.
This commit is contained in:
parent
e01eab28a2
commit
cfdc035617
4 changed files with 9 additions and 18 deletions
|
|
@ -24,16 +24,14 @@ namespace MinecraftClient.Commands
|
|||
{
|
||||
try
|
||||
{
|
||||
int x = int.Parse(args[0]);
|
||||
int y = int.Parse(args[1]);
|
||||
int z = int.Parse(args[2]);
|
||||
Location blockToBreak = new Location(x, y, z);
|
||||
if (blockToBreak.DistanceSquared(handler.GetCurrentLocation().EyesLocation()) > 25)
|
||||
Location current = handler.GetCurrentLocation();
|
||||
Location blockToBreak = Location.Parse(current, args[0], args[1], args[2]);
|
||||
if (blockToBreak.DistanceSquared(current.EyesLocation()) > 25)
|
||||
return Translations.Get("cmd.dig.too_far");
|
||||
if (handler.GetWorld().GetBlock(blockToBreak).Type == Material.Air)
|
||||
return Translations.Get("cmd.dig.no_block");
|
||||
if (handler.DigBlock(blockToBreak))
|
||||
return Translations.Get("cmd.dig.dig", x, y, z);
|
||||
return Translations.Get("cmd.dig.dig", blockToBreak.X, blockToBreak.Y, blockToBreak.Z);
|
||||
else return "cmd.dig.fail";
|
||||
}
|
||||
catch (FormatException) { return GetCmdDescTranslated(); }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue