Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

KnockBack Projectile

Comments in 'Plugin Development' started by Skullex, Apr 9, 2016.

  1. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    How exactly could I add knockback to a projectile?
  2. Ritch
    Offline

    Ritch Active Member

    Joined:
    Oct 4, 2015
    Posts:
    184
    Minecraft User:
    anonymous
    PHP:
         public function onDamage(EntityDamageEvent $event){
            
    $player $event->getEntity();
            
    $entity $event->getEntity();
            if(
    $player instanceof Player && $event->getCause() === EntityDamageEvent::CAUSE_PROJECTILE){
               
    $event->setDamage(6);
               
    $event->setKnockBack($event->getKnockBack() * 2);
               }
          }
    }      
    Skullex likes this.
  3. Skullex
    Offline

    Skullex Active Member

    Joined:
    Nov 14, 2015
    Posts:
    212
    Minecraft User:
    Skullex
    No, I mean have the projectile launched even further after its been spawned :p
  4. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Disable or lower gravity for arrow.
    Skullex likes this.
  5. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    Level::addEntityMotion()?
    Skullex likes this.
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Either that, or reduce the drag.
    Skullex likes this.

Share This Page

Advertisement