Split up Effects into a bunch of classes

Server-side levitation now works too.
This commit is contained in:
Dylan K. Taylor
2019-01-27 19:45:15 +00:00
parent 729ae8bab7
commit 9ec40c421f
16 changed files with 649 additions and 158 deletions

View File

@ -25,6 +25,7 @@ namespace pocketmine\entity\projectile;
use pocketmine\block\Block;
use pocketmine\block\BlockFactory;
use pocketmine\entity\effect\InstantEffect;
use pocketmine\entity\EffectInstance;
use pocketmine\entity\Living;
use pocketmine\event\entity\ProjectileHitBlockEvent;
@ -101,7 +102,7 @@ class SplashPotion extends Throwable{
foreach($this->getPotionEffects() as $effect){
//getPotionEffects() is used to get COPIES to avoid accidentally modifying the same effect instance already applied to another entity
if(!$effect->getType()->isInstantEffect()){
if(!($effect->getType() instanceof InstantEffect)){
$newDuration = (int) round($effect->getDuration() * 0.75 * $distanceMultiplier);
if($newDuration < 20){
continue;
@ -109,7 +110,7 @@ class SplashPotion extends Throwable{
$effect->setDuration($newDuration);
$entity->addEffect($effect);
}else{
$effect->getType()->applyEffect($entity, $effect, $distanceMultiplier, $this, $this->getOwningEntity());
$effect->getType()->applyEffect($entity, $effect, $distanceMultiplier, $this);
}
}
}