mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
getSide() Vector3 method
This commit is contained in:
parent
cac2a3a6e5
commit
f79c6cf2e9
@ -116,6 +116,25 @@ class Vector3{
|
||||
public function abs(){
|
||||
return new Vector3(abs($this->x), abs($this->y), abs($this->z));
|
||||
}
|
||||
|
||||
public function getSide($side){
|
||||
switch((int) $side){
|
||||
case 0:
|
||||
return new Vector3($this->x, $this->y - 1, $this->z);
|
||||
case 1:
|
||||
return new Vector3($this->x, $this->y + 1, $this->z);
|
||||
case 2:
|
||||
return new Vector3($this->x, $this->y, $this->z - 1);
|
||||
case 3:
|
||||
return new Vector3($this->x, $this->y, $this->z + 1);
|
||||
case 4:
|
||||
return new Vector3($this->x - 1, $this->y, $this->z);
|
||||
case 5:
|
||||
return new Vector3($this->x + 1, $this->y, $this->z);
|
||||
default:
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
public function distance($x = 0, $y = 0, $z = 0){
|
||||
if(($x instanceof Vector3) === true){
|
||||
|
Loading…
x
Reference in New Issue
Block a user