mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
more entity metadata
This commit is contained in:
parent
447638816e
commit
93765e8cc7
6 changed files with 67 additions and 7 deletions
|
|
@ -13,6 +13,9 @@ class TaskAttackPlayer extends TaskTempt
|
|||
{
|
||||
if(!($this->target instanceof Entity) || ($ai->entity instanceof Spider && $ai->entity->level->isDay()) || ($this->target instanceof Entity && !$this->target->isPlayer()) || (Utils::distance_noroot($this->target, $ai->entity) > 256) || $this->target->level->getName() != $ai->entity->level->getName()){
|
||||
$this->reset();
|
||||
if($ai->entity instanceof Enderman){
|
||||
$ai->entity->setAngry(false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -27,12 +30,21 @@ class TaskAttackPlayer extends TaskTempt
|
|||
--$this->attackTime;
|
||||
|
||||
}
|
||||
public function onEnd(EntityAI $ai){
|
||||
parent::onEnd($ai);
|
||||
if($ai->entity instanceof Enderman){
|
||||
$ai->entity->setAngry(false);
|
||||
}
|
||||
}
|
||||
public function canBeExecuted(EntityAI $ai)
|
||||
{
|
||||
$target = $this->findTarget($ai->entity, 16);
|
||||
if(($ai->entity instanceof Spider && !$ai->entity->level->isDay()) || $target instanceof Entity && $target->class === ENTITY_PLAYER && $target->isPlayer()){
|
||||
$this->target = $target; //TODO get rid of it
|
||||
$ai->entity->target = $target;
|
||||
if($ai->entity instanceof Enderman){ //TODO find a better way
|
||||
$ai->entity->setAngry(true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue