data tag for saddled pigs was added(id 16, type:byte)

This commit is contained in:
GameHerobrine 2022-06-24 00:08:06 +03:00
parent 7b5bd27a39
commit 551ae19d7f
2 changed files with 15 additions and 7 deletions

View file

@ -7,7 +7,14 @@ abstract class Animal extends Creature implements Ageable, Breedable{
public function isBaby(){
return $this->data["IsBaby"];
}
public function getMetadata(){
$d = parent::getMetadata();
if(!isset($this->data["IsBaby"])){
$this->data["IsBaby"] = 0;
}
$d[14]["value"] = $this->isBaby();
return $d;
}
public function environmentUpdate(){
if($this->server->api->getProperty("spawn-animals") !== true){
$this->close();

View file

@ -603,12 +603,13 @@ class Entity extends Position{
16 => array("type" => 0, "value" => 0),
17 => array("type" => 6, "value" => array(0, 0, 0)),
);
if(!isset($this->data["IsBaby"])){
$this->data["IsBaby"] = 0;
}
$d[14]["value"] = $this->data["IsBaby"];
if($this->class === ENTITY_OBJECT && $this->type === OBJECT_PRIMEDTNT){ //ladder fix 2.0
$d[16]["value"] = (int) max(0, $this->data["fuse"] - (microtime(true) - $this->spawntime) * 20);
if($this->class === ENTITY_OBJECT || $this->class === ENTITY_MOB){ //ladder fix 2.0
if($this->type === OBJECT_PRIMEDTNT){
$d[16]["value"] = (int) max(0, $this->data["fuse"] - (microtime(true) - $this->spawntime) * 20);
}
if($this->type === MOB_PIG){ /*Saddled Pig*/
$d[16]["value"] = 0;
}
}elseif($this->class === ENTITY_PLAYER){
if($this->player->isSleeping !== false){
$d[16]["value"] = 2;