Added check for invalid entity attack

This commit is contained in:
Shoghi Cervantes
2014-08-30 18:24:24 +02:00
parent 3409d332e7
commit 23793e0fc4
5 changed files with 167 additions and 1 deletions

View File

@ -58,6 +58,11 @@ abstract class Living extends Entity implements Damageable{
public abstract function getName();
public function hasLineOfSight(Entity $entity){
//TODO: head height
return $this->getLevel()->rayTraceBlocks(new Vector3($this->x, $this->y + $this->height, $this->z), new Vector3($entity->x, $entity->y + $entity->height, $entity->z)) === null;
}
public function attack($damage, $source = EntityDamageEvent::CAUSE_MAGIC){
//TODO: attack tick limit
$pk = new EntityEventPacket();