mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-03 08:39:53 +00:00
Better Entity attacking system
This commit is contained in:
parent
52aa57d400
commit
7cf9c03735
@ -681,11 +681,13 @@ class Player{
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(isset($this->server->entities[$data["target"]]) and Utils::distance($this->entity->position, $this->server->entities[$data["target"]]->position) <= 8){
|
if(isset($this->server->entities[$data["target"]]) and Utils::distance($this->entity->position, $this->server->entities[$data["target"]]->position) <= 8){
|
||||||
if($this->handle("player.interact", $data) !== false){
|
$target = $this->server->api->entity->get($data["target"]);
|
||||||
console("[DEBUG] EID ".$this->eid." attacked EID ".$data["target"], true, true, 2);
|
$data["targetentity"] = $target;
|
||||||
if($this->server->difficulty > 0){
|
$data["entity"] = $this->entity;
|
||||||
$this->server->api->entity->harm($data["target"], $this->server->difficulty, $this->eid);
|
if(($target instanceof Entity) and $target->class === ENTITY_PLAYER and ($this->server->difficulty <= 0 or $target->gamemode === CREATIVE)){
|
||||||
}
|
break;
|
||||||
|
}elseif($this->handle("player.interact", $data) !== false){
|
||||||
|
$this->server->api->entity->harm($data["target"], $this->server->difficulty, $this->eid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user