mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
Open player's eyes for mobs
This commit is contained in:
parent
b6934024da
commit
abe7846bb9
4 changed files with 15 additions and 10 deletions
|
|
@ -55,7 +55,9 @@ class EntityAI
|
|||
}
|
||||
|
||||
public function updateTasks(){
|
||||
if(!($this->entity instanceof Entity)) return;
|
||||
if(!isset($entity) or !($this->entity instanceof Entity)){
|
||||
return;
|
||||
}
|
||||
foreach($this->tasks as $t){
|
||||
if(!$t->isStarted && $t->canBeExecuted($this)){
|
||||
$t->isStarted = true;
|
||||
|
|
|
|||
|
|
@ -11,11 +11,14 @@ class PathFollower{
|
|||
}
|
||||
|
||||
public function followPath(){
|
||||
if($this->entity->path != null && (is_array($this->entity->path) && count($this->entity->path) <= 0 || $this->entity->currentIndex >= count($this->entity->path))){
|
||||
if(!isset($entity) or $this->entity->path == null){
|
||||
return;
|
||||
}
|
||||
if((is_array($this->entity->path) && count($this->entity->path) <= 0 || $this->entity->currentIndex >= count($this->entity->path))){
|
||||
$this->entity->path = null;
|
||||
$this->entity->currentIndex = 0;
|
||||
$this->entity->currentNode = false;
|
||||
}elseif($this->entity->path != null && ($this->entity->currentNode == false || $this->entity->ai->mobController->moveTo($this->entity->currentNode->x, $this->entity->currentNode->y, $this->entity->currentNode->z) === false)){
|
||||
}elseif(($this->entity->currentNode == false || $this->entity->ai->mobController->moveTo($this->entity->currentNode->x, $this->entity->currentNode->y, $this->entity->currentNode->z) === false)){
|
||||
$this->entity->currentNode = $this->entity->path[$this->entity->currentIndex++];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ class AddMobPacket extends RakNetDataPacket{
|
|||
$this->reset();
|
||||
$this->putInt($this->eid);
|
||||
$this->putInt($this->type);
|
||||
$this->putFloat($this->x);
|
||||
$this->putFloat($this->y);
|
||||
$this->putFloat($this->z);
|
||||
$this->putInt($this->x);
|
||||
$this->putInt($this->y);
|
||||
$this->putInt($this->z);
|
||||
$this->putByte($this->yaw);
|
||||
$this->putByte($this->pitch);
|
||||
$this->put(Utils::writeMetadata($this->metadata));
|
||||
|
|
|
|||
|
|
@ -11,17 +11,17 @@ class EntityDataPacket extends RakNetDataPacket{
|
|||
}
|
||||
|
||||
public function decode(){
|
||||
$this->x = $this->getShort();
|
||||
$this->x = $this->getInt();
|
||||
$this->y = $this->getByte();
|
||||
$this->z = $this->getShort();
|
||||
$this->z = $this->getInt();
|
||||
$this->namedtag = $this->get(true);
|
||||
}
|
||||
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putShort($this->x);
|
||||
$this->putInt($this->x);
|
||||
$this->putByte($this->y);
|
||||
$this->putShort($this->z);
|
||||
$this->putInt($this->z);
|
||||
$this->put($this->namedtag);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue