mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Bug fix: /move command went to the wrong location
This commit is contained in:
parent
5f520e2cf4
commit
ed8e97fd2d
4 changed files with 35 additions and 9 deletions
|
|
@ -73,12 +73,14 @@ namespace MinecraftClient.Commands
|
|||
}
|
||||
|
||||
Location goal = Movement.Move(handler.GetCurrentLocation(), direction);
|
||||
if (handler.GetWorld().GetChunkColumn(goal) == null || handler.GetWorld().GetChunkColumn(goal)!.FullyLoaded == false)
|
||||
|
||||
ChunkColumn? chunkColumn = handler.GetWorld().GetChunkColumn(goal);
|
||||
if (chunkColumn == null || chunkColumn.FullyLoaded == false)
|
||||
return Translations.Get("cmd.move.chunk_not_loaded");
|
||||
|
||||
if (Movement.CanMove(handler.GetWorld(), handler.GetCurrentLocation(), direction))
|
||||
{
|
||||
if (handler.MoveTo(Movement.Move(handler.GetCurrentLocation(), direction), allowUnsafe: takeRisk))
|
||||
if (handler.MoveTo(goal, allowUnsafe: takeRisk))
|
||||
return Translations.Get("cmd.move.moving", args[0]);
|
||||
else return takeRisk ? Translations.Get("cmd.move.dir_fail") : Translations.Get("cmd.move.suggestforce");
|
||||
}
|
||||
|
|
@ -93,12 +95,12 @@ namespace MinecraftClient.Commands
|
|||
int z = int.Parse(args[2]);
|
||||
Location goal = new Location(x, y, z);
|
||||
|
||||
if (handler.GetWorld().GetChunkColumn(goal) == null || handler.GetWorld().GetChunkColumn(goal)!.FullyLoaded == false)
|
||||
ChunkColumn? chunkColumn = handler.GetWorld().GetChunkColumn(goal);
|
||||
if (chunkColumn == null || chunkColumn.FullyLoaded == false)
|
||||
return Translations.Get("cmd.move.chunk_not_loaded");
|
||||
|
||||
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);
|
||||
handler.MoveTo(current.ToCenter(), allowDirectTeleport: true);
|
||||
|
||||
if (handler.MoveTo(goal, allowUnsafe: takeRisk))
|
||||
return Translations.Get("cmd.move.walk", goal, current);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue