mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-27 21:59:52 +00:00
Implemented asVector3(), asPosition() and asLocation()
Squash merge, closes #973
This commit is contained in:
parent
9cc27b2719
commit
f0d12a0b30
@ -57,6 +57,15 @@ class Location extends Position{
|
|||||||
return new Location($pos->x, $pos->y, $pos->z, $yaw, $pitch, $level ?? (($pos instanceof Position) ? $pos->level : null));
|
return new Location($pos->x, $pos->y, $pos->z, $yaw, $pitch, $level ?? (($pos instanceof Position) ? $pos->level : null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a Location instance
|
||||||
|
*
|
||||||
|
* @return Location
|
||||||
|
*/
|
||||||
|
public function asLocation() : Location{
|
||||||
|
return new Location($this->x, $this->y, $this->z, $this->yaw, $this->pitch, $this->level);
|
||||||
|
}
|
||||||
|
|
||||||
public function getYaw(){
|
public function getYaw(){
|
||||||
return $this->yaw;
|
return $this->yaw;
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,15 @@ class Position extends Vector3{
|
|||||||
return new Position($pos->x, $pos->y, $pos->z, $level);
|
return new Position($pos->x, $pos->y, $pos->z, $level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a Position instance
|
||||||
|
*
|
||||||
|
* @return Position
|
||||||
|
*/
|
||||||
|
public function asPosition() : Position{
|
||||||
|
return new Position($this->x, $this->y, $this->z, $this->level);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the target Level, or null if the target is not valid.
|
* Returns the target Level, or null if the target is not valid.
|
||||||
* If a reference exists to a Level which is closed, the reference will be destroyed and null will be returned.
|
* If a reference exists to a Level which is closed, the reference will be destroyed and null will be returned.
|
||||||
|
@ -157,6 +157,15 @@ class Vector3{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a Vector3 instance
|
||||||
|
*
|
||||||
|
* @return Vector3
|
||||||
|
*/
|
||||||
|
public function asVector3() : Vector3{
|
||||||
|
return new Vector3($this->x, $this->y, $this->z);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Vector3 side number opposite the specified one
|
* Returns the Vector3 side number opposite the specified one
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user