Added more damage sources

This commit is contained in:
Shoghi Cervantes
2014-07-10 14:02:56 +02:00
parent 99c5ad789b
commit c9535162bd
2 changed files with 22 additions and 4 deletions

View File

@@ -581,8 +581,15 @@ abstract class Entity extends Position implements Metadatable{
return $this->boundingBox;
}
public function fall($fallDistance){ //TODO
public function fall($fallDistance){
$damage = floor($fallDistance - 3);
if($damage > 0){
$this->server->getPluginManager()->callEvent($ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_FALL, $damage));
if($ev->isCancelled()){
return;
}
$this->attack($ev->getFinalDamage(), $ev);
}
}
public function handleWaterMovement(){ //TODO