Hello the community, I'm back again with a little question about MyEntities, my plugin which i'm trying to continue/revive. How is it possible to add 'thing' to it ? - Add a timer (Task) to it, when placed, to remove it. - Detect when player are close (in range/proximity) to it If player is detected, launch a timer (task) Source: https://github.com/benda95280/MyEntities/tree/master/src/Benda95280/MyEntities/entities Thanks for your time and your help.
How about this? Insert this code to BaseEntity in entityBaseTick PHP: public function entityBaseTick(int $tickDiff = 1): bool{ if ($this->properties->rotationPerTick !== 0) { $newYaw = ($this->getYaw() + $this->properties->rotationPerTick) % 360; $this->setRotation($newYaw, 0); } if (!is_null($this->getLevel()->getNearestEntity($this->asVector3(), 10, Human::class, false))) { /* * * add property isUsing default equal false; * if isUsing === true -> break * set isUsing to true; * Run your task; * inside task class when it's finished change isUsing to false. * To all your stuff inside task. */ } return parent::entityBaseTick($tickDiff);}
Nice ................... Works well, i've been able to set automatic rotation when player are near Thanks !