diff --git a/src/pocketmine/entity/FallingSand.php b/src/pocketmine/entity/FallingSand.php index 4fcde0dd1..758cbe577 100644 --- a/src/pocketmine/entity/FallingSand.php +++ b/src/pocketmine/entity/FallingSand.php @@ -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){ diff --git a/src/pocketmine/entity/Item.php b/src/pocketmine/entity/Item.php index 70f398330..0461c7c18 100644 --- a/src/pocketmine/entity/Item.php +++ b/src/pocketmine/entity/Item.php @@ -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; diff --git a/src/pocketmine/entity/PrimedTNT.php b/src/pocketmine/entity/PrimedTNT.php index ddc43b602..eed361c5a 100644 --- a/src/pocketmine/entity/PrimedTNT.php +++ b/src/pocketmine/entity/PrimedTNT.php @@ -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(){ diff --git a/src/pocketmine/entity/Projectile.php b/src/pocketmine/entity/Projectile.php index 6c3755624..d37c63c13 100644 --- a/src/pocketmine/entity/Projectile.php +++ b/src/pocketmine/entity/Projectile.php @@ -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(){