mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 20:19:44 +00:00
entity collisions
This commit is contained in:
parent
2ce333af5e
commit
3b15c26b0c
13 changed files with 104 additions and 34 deletions
|
|
@ -15,7 +15,12 @@ class TaskEatTileGoal extends TaskBase
|
|||
|
||||
public function onUpdate(EntityAI $ai)
|
||||
{
|
||||
if (--$this->selfCounter === 4)
|
||||
if($ai->isStarted("TaskEatTileGoal")){
|
||||
$this->reset();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (--$this->selfCounter == 4)
|
||||
{
|
||||
$id = $ai->entity->level->level->getBlockID($ai->entity->x, $ai->entity->y, $ai->entity->z);
|
||||
$idb = $ai->entity->level->level->getBlockID($ai->entity->x, $ai->entity->y - 1, $ai->entity->z);
|
||||
|
|
@ -32,7 +37,7 @@ class TaskEatTileGoal extends TaskBase
|
|||
|
||||
public function canBeExecuted(EntityAI $ai)
|
||||
{
|
||||
if($ai->isStarted("TaskRandomWalk")) return false;
|
||||
if($ai->isStarted("TaskRandomWalk") || $ai->isStarted("TaskEatTileGoal")) return false;
|
||||
if(mt_rand(0, ($ai->entity instanceof Ageable && $ai->entity->isBaby()) ? 50 : 1000) == 0){
|
||||
$idm = $ai->entity->level->level->getBlock($ai->entity->x, $ai->entity->y, $ai->entity->z);
|
||||
$idb = $ai->entity->level->level->getBlockID($ai->entity->x, $ai->entity->y - 1, $ai->entity->z);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue