entity damage by blocks was a bit rewritten, fixed packet spam by burning zombies/entities, fire tweaks

This commit is contained in:
GameHerobrine 2024-03-16 00:29:33 +03:00
parent 7ebb5a4a63
commit f078e83528
6 changed files with 87 additions and 93 deletions

View file

@ -7,7 +7,7 @@ class PigZombie extends Monster{ //TODO extends zombie
$this->setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 12, "generic");
$this->setName("Pigman");
$this->setSpeed(0.25);
$this->isImmuneToFire = true;
$this->ai->addTask(new TaskLookAround());
$this->ai->addTask(new TaskRandomWalk(1.0));
$this->ai->addTask(new TaskSwimming());
@ -22,12 +22,4 @@ class PigZombie extends Monster{ //TODO extends zombie
[GOLD_INGOT, 0, mt_rand(0,1)]
];
}
public function harm($dmg, $cause = "generic", $force = false)
{
if($cause === "fire" || $cause === "lava" || $cause === "burning"){
return false;
}
return parent::harm($dmg, $cause, $force);
}
}

View file

@ -31,8 +31,11 @@ class Skeleton extends Monster{
}
}
if($block === AIR){
$oldFire = $this->fire;
$this->fire = 160; //Value from 0.8.1
$this->updateMetadata();
if(($oldFire > 0 && $this->fire <= 0) || ($oldFire <= 0 && $this->fire > 0)){
$this->updateMetadata(); //TODO rewrite metadata
}
return true;
}else{
return false;

View file

@ -30,8 +30,11 @@ class Zombie extends Monster{
}
}
if($block === AIR){
$oldFire = $this->fire;
$this->fire = 160; //Value from 0.8.1
$this->updateMetadata();
if(($oldFire > 0 && $this->fire <= 0) || ($oldFire <= 0 && $this->fire > 0)){
$this->updateMetadata(); //TODO rewrite metadata
}
return true;
}else{
return false;