mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
creepers will explode if they will come close to player(do not remind me of animation bug, pretty sure it is unfixable
This commit is contained in:
parent
bae0d4618e
commit
f4569d6edf
3 changed files with 15 additions and 2 deletions
|
|
@ -28,7 +28,7 @@ class Creeper extends Monster{
|
|||
* @return boolean
|
||||
*/
|
||||
public function isIgnited(){
|
||||
return (boolean)$this->getState();
|
||||
return $this->getState() > 0;
|
||||
}
|
||||
|
||||
public function interactWith(Entity $e, $action){
|
||||
|
|
@ -50,7 +50,17 @@ class Creeper extends Monster{
|
|||
$this->timeUntilExplode = self::EXPL_TIME;
|
||||
}
|
||||
|
||||
public function attackEntity($entity){
|
||||
if(Utils::distance_noroot($entity, $this) <= 49 && !$this->isIgnited()){
|
||||
$this->ignite();
|
||||
}
|
||||
|
||||
}
|
||||
public function update(){
|
||||
if($this->isIgnited() && $this->target instanceof Entity && Utils::distance_noroot($this->target, $this) > 49){
|
||||
$this->setIgnited(-1); //broken in vanilla too
|
||||
$this->timeUntilExplode = 0;
|
||||
}
|
||||
if($this->timeUntilExplode === 1){
|
||||
$this->explode();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue