Added Fire, Lava damage

This commit is contained in:
Shoghi Cervantes
2014-09-16 10:42:29 +02:00
parent e608acbd1c
commit e9a2f88847
6 changed files with 63 additions and 15 deletions

View File

@ -21,6 +21,9 @@
namespace pocketmine\block;
use pocketmine\event\entity\EntityDamageEvent;
use pocketmine\Server;
use pocketmine\entity\Entity;
class StillLava extends Liquid{
public function __construct($meta = 0){
@ -28,4 +31,18 @@ class StillLava extends Liquid{
$this->hardness = 500;
}
public function getBoundingBox(){
return null;
}
public function onEntityCollide(Entity $entity){
$entity->setOnFire(15);
$ev = new EntityDamageEvent($entity, EntityDamageEvent::CAUSE_LAVA, 4);
Server::getInstance()->getPluginManager()->callEvent($ev);
if(!$ev->isCancelled()){
$entity->attack($ev->getFinalDamage(), $ev);
}
$entity->attack(4, EntityDamageEvent::CAUSE_LAVA);
}
}