mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 03:59:43 +00:00
changed pathfinder(hopefully one last time)
This commit is contained in:
parent
8c12e0de26
commit
e11c40f645
28 changed files with 401 additions and 416 deletions
|
|
@ -12,9 +12,10 @@ class MobController
|
|||
}
|
||||
|
||||
public function moveNonInstant($x, $y, $z){
|
||||
if($x === $this->entity->x && $y === $this->entity->y && $z === $this->entity->z){
|
||||
if($x == 0 && $y == 0 && $z == 0){
|
||||
return false; //failed
|
||||
}
|
||||
|
||||
$ox = ($x > 0 ? 1 : ($x < 0 ? -1 : 0));
|
||||
$oy = ($y > 0 ? 1 : ($y < 0 ? -1 : 0));
|
||||
$oz = ($z > 0 ? 1 : ($z < 0 ? -1 : 0));
|
||||
|
|
@ -27,6 +28,10 @@ class MobController
|
|||
return true;
|
||||
}
|
||||
|
||||
public function moveTo($x, $y, $z){
|
||||
return $this->moveNonInstant($x - floor($this->entity->x), $y - floor($this->entity->y), $z - floor($this->entity->z));
|
||||
}
|
||||
|
||||
public function faceEntity(Vector3 $v){
|
||||
$d = $v->subtract($this->entity)->normalize();
|
||||
$dx = $d->x;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue