Skip to content

Commit

Permalink
fix some bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiaoming0313883 authored Aug 15, 2021
1 parent c6987d8 commit 4e4c85e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/Xiaoming0313883/Zspawn/spawn.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,25 @@ public function onRun($tick){
$text = "Zombie summon every $this->delay second\n$this->count left to spawn next zombie\nspawn id: $this->id";
$this->particle->setText($text);
$this->position->getLevel()->addParticle($this->particle);
if($entity->namedtag->hasTag("pass")){
$health = (int)$entity->gethealth();
$maxhealth = (int)$entity->getmaxhealth();
$currnohealth = $maxhealth - $health . "\n";
$namedtagtext = "Health";
for($i = 0;$i < (int)$health;$i++){
$namedtagtext = $namedtagtext . "§2|";
}
for($a = 0;$a < (int)$currnohealth;$a++){
$namedtagtext = $namedtagtext . "§4|";
}
$entity->setnametag($namedtagtext);
$entity->setNameTagAlwaysVisible(true);
}
} else {
$this->count = ($this->count - 1);
$text = "Zombie summon every $this->delay second\n" . $this->count . " left to spawn next zombie\nspawn id: $this->id";
$this->particle->setText($text);
$this->position->getLevel()->addParticle($this->particle);
}
}
}
}

0 comments on commit 4e4c85e

Please sign in to comment.