mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Upgrade old coordinate parsing.
This commit is contained in:
parent
993771dc5d
commit
ff7021e798
1 changed files with 2 additions and 6 deletions
|
|
@ -121,12 +121,8 @@ namespace MinecraftClient.Commands
|
||||||
|
|
||||||
if (args.Length >= 3)
|
if (args.Length >= 3)
|
||||||
{
|
{
|
||||||
Location current = handler.GetCurrentLocation();
|
Location block = Location.Parse(handler.GetCurrentLocation(), args[1], args[2], args[3]).ToFloor();
|
||||||
double x = args[1].StartsWith('~') ? current.X + (args[1].Length > 1 ? double.Parse(args[1][1..]) : 0) : double.Parse(args[1]);
|
Location blockCenter = block.ToCenter();
|
||||||
double y = args[2].StartsWith('~') ? current.Y + (args[2].Length > 1 ? double.Parse(args[2][1..]) : 0) : double.Parse(args[2]);
|
|
||||||
double z = args[3].StartsWith('~') ? current.Z + (args[3].Length > 1 ? double.Parse(args[3][1..]) : 0) : double.Parse(args[3]);
|
|
||||||
|
|
||||||
Location block = new Location(x, y, z).ToFloor(), blockCenter = block.ToCenter();
|
|
||||||
|
|
||||||
if (!handler.GetWorld().GetBlock(block).Type.IsBed())
|
if (!handler.GetWorld().GetBlock(block).Type.IsBed())
|
||||||
return Translations.TryGet("cmd.bed.not_a_bed", blockCenter.X, blockCenter.Y, blockCenter.Z);
|
return Translations.TryGet("cmd.bed.not_a_bed", blockCenter.X, blockCenter.Y, blockCenter.Z);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue