mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +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
|
|
@ -61,6 +61,29 @@ namespace MinecraftClient.Mapping
|
|||
Z = chunkZ * Chunk.SizeZ + blockZ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Round coordinates
|
||||
/// </summary>
|
||||
/// <returns>itself</returns>
|
||||
public Location ToFloor()
|
||||
{
|
||||
this.X = Math.Floor(this.X);
|
||||
this.Y = Math.Floor(this.Y);
|
||||
this.Z = Math.Floor(this.Z);
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the center coordinates
|
||||
/// </summary>
|
||||
/// <returns>itself</returns>
|
||||
public Location ToCenter()
|
||||
{
|
||||
this.X = Math.Floor(this.X) + 0.5;
|
||||
this.Z = Math.Floor(this.Z) + 0.5;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The X index of the corresponding chunk in the world
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -168,7 +168,8 @@ namespace MinecraftClient.Mapping
|
|||
throw new ArgumentException("minOffset must be lower or equal to maxOffset", "minOffset");
|
||||
|
||||
// Round start coordinates for easier calculation
|
||||
start = new Location(Math.Floor(start.X), Math.Floor(start.Y), Math.Floor(start.Z));
|
||||
start.ToFloor();
|
||||
goal.ToFloor();
|
||||
|
||||
// We always use distance squared so our limits must also be squared.
|
||||
minOffset *= minOffset;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue