Fix /move

This commit is contained in:
BruceChen 2022-09-09 16:13:25 +08:00
parent 531f3408a0
commit 223c13561c
6 changed files with 62 additions and 45 deletions

View file

@ -76,24 +76,19 @@ namespace MinecraftClient.Mapping
/// <summary>
/// Round coordinates
/// </summary>
/// <returns>itself</returns>
public Location ConvertToFloor()
/// <returns>New location</returns>
public Location ToFloor()
{
this.X = Math.Floor(this.X);
this.Y = Math.Floor(this.Y);
this.Z = Math.Floor(this.Z);
return this;
return new Location(Math.Floor(this.X), Math.Floor(this.Y), Math.Floor(this.Z));
}
/// <summary>
/// Get the center coordinates
/// </summary>
/// <returns>itself</returns>
public Location ConvertToCenter()
/// <returns>New location</returns>
public Location ToCenter()
{
this.X = Math.Floor(this.X) + 0.5;
this.Z = Math.Floor(this.Z) + 0.5;
return this;
return new Location(Math.Floor(this.X) + 0.5, this.Y, Math.Floor(this.Z) + 0.5);
}
/// <summary>