mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
"/move X Y Z" now moves the player to the center of the block first
This commit is contained in:
parent
a18b526a41
commit
94fd8b118d
3 changed files with 17 additions and 5 deletions
|
|
@ -8,7 +8,7 @@ namespace MinecraftClient.Commands
|
|||
public class Move : Command
|
||||
{
|
||||
public override string CmdName { get { return "move"; } }
|
||||
public override string CmdUsage { get { return "move <on|off|get|up|down|east|west|north|south|x y z|gravity [on|off]> [-f]"; } }
|
||||
public override string CmdUsage { get { return "move <on|off|get|up|down|east|west|north|south|center|x y z|gravity [on|off]> [-f]"; } }
|
||||
public override string CmdDesc { get { return "walk or start walking. \"-f\": force unsafe movements like falling or touching fire"; } }
|
||||
|
||||
public override string Run(McClient handler, string command, Dictionary<string, object> localVars)
|
||||
|
|
@ -63,6 +63,13 @@ namespace MinecraftClient.Commands
|
|||
case "west": direction = Direction.West; break;
|
||||
case "north": direction = Direction.North; break;
|
||||
case "south": direction = Direction.South; break;
|
||||
case "center":
|
||||
{
|
||||
Location current = handler.GetCurrentLocation();
|
||||
Location currentCenter = new Location(Math.Floor(current.X) + 0.5, current.Y, Math.Floor(current.Z) + 0.5);
|
||||
handler.MoveTo(currentCenter, allowDirectTeleport: true);
|
||||
return Translations.Get("cmd.move.walk", currentCenter, current);
|
||||
}
|
||||
case "get": return handler.GetCurrentLocation().ToString();
|
||||
default: return Translations.Get("cmd.look.unknown", args[0]);
|
||||
}
|
||||
|
|
@ -85,8 +92,13 @@ namespace MinecraftClient.Commands
|
|||
|
||||
if (handler.GetWorld().GetChunkColumn(goal) == null || handler.GetWorld().GetChunkColumn(goal).FullyLoaded == false)
|
||||
return Translations.Get("cmd.move.chunk_not_loaded");
|
||||
else if (handler.MoveTo(goal, allowUnsafe: takeRisk))
|
||||
return Translations.Get("cmd.move.walk", goal);
|
||||
|
||||
Location current = handler.GetCurrentLocation();
|
||||
Location currentCenter = new Location(Math.Floor(current.X) + 0.5, current.Y, Math.Floor(current.Z) + 0.5);
|
||||
handler.MoveTo(currentCenter, allowDirectTeleport: true);
|
||||
|
||||
if (handler.MoveTo(goal, allowUnsafe: takeRisk))
|
||||
return Translations.Get("cmd.move.walk", goal, current);
|
||||
else return takeRisk ? Translations.Get("cmd.move.fail", goal) : Translations.Get("cmd.move.suggestforce", goal);
|
||||
}
|
||||
catch (FormatException) { return GetCmdDescTranslated(); }
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ namespace MinecraftClient.Mapping
|
|||
/// <returns>String representation of the location</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("X:{0} Y:{1} Z:{2}", X, Y, Z);
|
||||
return String.Format("X:{0:0.00} Y:{1:0.00} Z:{2:0.00}", X, Y, Z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@ cmd.move.enable=Enabling Terrain and Movements on next server login, respawn or
|
|||
cmd.move.disable=Disabling Terrain and Movements.
|
||||
cmd.move.moving=Moving {0}
|
||||
cmd.move.dir_fail=Cannot move in that direction.
|
||||
cmd.move.walk=Walking to {0}
|
||||
cmd.move.walk=Walking from {1} to {0}
|
||||
cmd.move.fail=Failed to compute path to {0}
|
||||
cmd.move.suggestforce=Failed to compute a safe path to {0}. Try -f parameter to allow unsafe movements.
|
||||
cmd.move.gravity.enabled=Gravity is enabled.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue