mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-16 18:59:00 +00:00
Improved damage sources for projectiles, falling blocks, TNT, and items
This commit is contained in:
parent
9e14435dbb
commit
14ff537e71
@ -78,7 +78,9 @@ class FallingSand extends Entity{
|
||||
}
|
||||
|
||||
public function attack($damage, EntityDamageEvent $source){
|
||||
|
||||
if($source->getCause() === EntityDamageEvent::CAUSE_VOID){
|
||||
parent::attack($damage, $source);
|
||||
}
|
||||
}
|
||||
|
||||
public function onUpdate($currentTick){
|
||||
|
@ -75,6 +75,17 @@ class Item extends Entity{
|
||||
$this->server->getPluginManager()->callEvent(new ItemSpawnEvent($this));
|
||||
}
|
||||
|
||||
public function attack($damage, EntityDamageEvent $source){
|
||||
if(
|
||||
$source->getCause() === EntityDamageEvent::CAUSE_VOID or
|
||||
$source->getCause() === EntityDamageEvent::CAUSE_FIRE_TICK or
|
||||
$source->getCause() === EntityDamageEvent::CAUSE_ENTITY_EXPLOSION or
|
||||
$source->getCause() === EntityDamageEvent::CAUSE_BLOCK_EXPLOSION
|
||||
){
|
||||
parent::attack($damage, $source);
|
||||
}
|
||||
}
|
||||
|
||||
public function onUpdate($currentTick){
|
||||
if($this->closed){
|
||||
return false;
|
||||
|
@ -47,7 +47,9 @@ class PrimedTNT extends Entity implements Explosive{
|
||||
|
||||
|
||||
public function attack($damage, EntityDamageEvent $source){
|
||||
|
||||
if($source->getCause() === EntityDamageEvent::CAUSE_VOID){
|
||||
parent::attack($damage, $source);
|
||||
}
|
||||
}
|
||||
|
||||
protected function initEntity(){
|
||||
|
@ -52,9 +52,10 @@ abstract class Projectile extends Entity{
|
||||
parent::__construct($chunk, $nbt);
|
||||
}
|
||||
|
||||
|
||||
public function attack($damage, EntityDamageEvent $source){
|
||||
|
||||
if($source->getCause() === EntityDamageEvent::CAUSE_VOID){
|
||||
parent::attack($damage, $source);
|
||||
}
|
||||
}
|
||||
|
||||
protected function initEntity(){
|
||||
|
Loading…
x
Reference in New Issue
Block a user