void should work correctly now

This commit is contained in:
GameHerobrine 2022-11-10 18:38:59 +03:00
parent 394ede50e9
commit c29d8dab9d
2 changed files with 86 additions and 56 deletions

View file

@ -5,7 +5,11 @@ move methods
*/
abstract class Creature extends Living{
const CLASS_TYPE = ENTITY_MOB;
public $inPanic;
public function __construct(Level $level, $eid, $class, $type = 0, $data = []){
$this->inPanic = true;
parent::__construct($level, $eid, $class, $type, $data);
$this->setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 1, "generic");
//$this->setName((isset($mobs[$this->type]) ? $mobs[$this->type]:$this->type));
@ -15,6 +19,10 @@ abstract class Creature extends Living{
}
}
public function getSpeedModifer(){
return $this->speedModifer * ($this->inPanic ? 1.4 : 0.7);
}
public function spawn($player){
if(!($player instanceof Player)){
$player = $this->server->api->player->get($player);