mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Explicit yawpitch, cardinal directions, and cleanup.
This commit is contained in:
parent
8bfdb2ab59
commit
4f54a4060a
2 changed files with 79 additions and 17 deletions
|
|
@ -18,25 +18,49 @@ namespace MinecraftClient.Commands
|
|||
string[] args = getArgs(command);
|
||||
if (args.Length == 1)
|
||||
{
|
||||
return "ok.";
|
||||
string dirStr = getArg(command).Trim().ToLower();
|
||||
Direction direction;
|
||||
switch (dirStr)
|
||||
{
|
||||
case "up": direction = Direction.Up; break;
|
||||
case "down": direction = Direction.Down; break;
|
||||
case "east": direction = Direction.East; break;
|
||||
case "west": direction = Direction.West; break;
|
||||
case "north": direction = Direction.North; break;
|
||||
case "south": direction = Direction.South; break;
|
||||
default: return "Unknown direction '" + dirStr + "'.";
|
||||
}
|
||||
|
||||
handler.LookAtDirection(direction);
|
||||
return "Looking " + dirStr;
|
||||
}
|
||||
else if (args.Length == 2)
|
||||
{
|
||||
float yaw = Single.Parse(args[0]),
|
||||
pitch = Single.Parse(args[1]);
|
||||
try
|
||||
{
|
||||
float yaw = Single.Parse(args[0]),
|
||||
pitch = Single.Parse(args[1]);
|
||||
|
||||
return $"Looking at YAW: {yaw} PITCH: {pitch}";
|
||||
handler.LookAtAngle(yaw, pitch);
|
||||
return $"Looking at YAW: {yaw} PITCH: {pitch}";
|
||||
}
|
||||
catch (FormatException) { return CMDDesc; }
|
||||
}
|
||||
else if (args.Length == 3)
|
||||
{
|
||||
int x = int.Parse(args[0]),
|
||||
y = int.Parse(args[1]),
|
||||
z = int.Parse(args[2]);
|
||||
try
|
||||
{
|
||||
int x = int.Parse(args[0]),
|
||||
y = int.Parse(args[1]),
|
||||
z = int.Parse(args[2]);
|
||||
|
||||
Location block = new Location(x, y, z);
|
||||
handler.LookAtBlock(block);
|
||||
Location block = new Location(x, y, z);
|
||||
handler.LookAtBlock(block);
|
||||
|
||||
return "Looking at " + block;
|
||||
return "Looking at " + block;
|
||||
}
|
||||
catch (FormatException) { return CMDDesc; }
|
||||
|
||||
}
|
||||
else return CMDDesc;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue