more entity metadata

This commit is contained in:
GameHerobrine 2023-02-24 19:39:38 +03:00
parent 447638816e
commit 93765e8cc7
6 changed files with 67 additions and 7 deletions

View file

@ -3,6 +3,16 @@
class Wolf extends Animal implements Tameable
{
const TYPE = MOB_WOLF;
const WOLF_FLAGS = 14;
const WF_SITTING = 1;
const WF_ANGRY = 2;
const WF_INTERESTED = 3;
protected $interested = false;
protected $angry = false;
protected $sitting = false;
public function __construct(Level $level, $eid, $class, $type = 0, $data = []){
$this->setSize(0.6, 0.8);
parent::__construct($level, $eid, $class, $type, $data);
@ -11,6 +21,15 @@ class Wolf extends Animal implements Tameable
$this->setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 10, "generic");
}
public function getMetadata(){
$ret = parent::getMetadata();
$ret[self::WOLF_FLAGS] = ["type" => 0, "value" =>
(($this->angry) << self::WF_ANGRY) ^
(($this->interested) << self::WF_INTERESTED) ^
(($this->sitting) << self::WF_SITTING)
];//TODO toggles
return $ret;
}
public function isTamed()
{