mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 10:53:05 +00:00
Heap of bugfixes, cleanup and PHP 7 upgrades
This commit is contained in:
@ -55,17 +55,17 @@ class Matrix implements \ArrayAccess{
|
||||
for($r = 0; $r < $this->rows; ++$r){
|
||||
$this->matrix[$r] = [];
|
||||
for($c = 0; $c < $this->columns; ++$c){
|
||||
$this->matrix[$r][$c] = isset($m[$r][$c]) ? $m[$r][$c] : 0;
|
||||
$this->matrix[$r][$c] = $m[$r][$c] ?? 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getRows(){
|
||||
return ($this->rows);
|
||||
return $this->rows;
|
||||
}
|
||||
|
||||
public function getColumns(){
|
||||
return ($this->columns);
|
||||
return $this->columns;
|
||||
}
|
||||
|
||||
public function setElement($row, $column, $value){
|
||||
|
@ -100,7 +100,7 @@ class Vector2{
|
||||
if($x instanceof Vector2){
|
||||
return $this->distanceSquared($x->x, $x->y);
|
||||
}else{
|
||||
return pow($this->x - $x, 2) + pow($this->y - $y, 2);
|
||||
return (($this->x - $x) ** 2) + (($this->y - $y) ** 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ class Vector3{
|
||||
}
|
||||
|
||||
public function distanceSquared(Vector3 $pos){
|
||||
return pow($this->x - $pos->x, 2) + pow($this->y - $pos->y, 2) + pow($this->z - $pos->z, 2);
|
||||
return (($this->x - $pos->x) ** 2) + (($this->y - $pos->y) ** 2) + (($this->z - $pos->z) ** 2);
|
||||
}
|
||||
|
||||
public function maxPlainDistance($x = 0, $z = 0){
|
||||
|
Reference in New Issue
Block a user