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

Solved How to track of the arrow in the block ?

Comments in 'Plugin Development' started by asyven, Apr 19, 2016.

  1. asyven
    Offline

    asyven New Member

    Joined:
    Jan 17, 2015
    Posts:
    29
    Minecraft User:
    asyven
    I want to make shooting
    need to keep track of getting a bow
    sorry 4 my eng
  2. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    Can you explain what you want more clearly?
    applqpak likes this.
  3. MCPEPIG
    Offline

    MCPEPIG Notable Member

    Joined:
    Jun 22, 2014
    Posts:
    349
    Minecraft User:
    MCPEPIG
  4. asyven
    Offline

    asyven New Member

    Joined:
    Jan 17, 2015
    Posts:
    29
    Minecraft User:
    asyven
    Безымянный.png

    PHP:
    public function handle(ProjectileHitEvent $event)
    {
    $entity $event->getEntity();
    if (
    $entity instanceof /*Arrow???*/) {
                
    $theX $entity->getX();
                
    $theY $entity->getY();
                
    $theZ $entity->getZ();
                
    $level $entity->getLevel();
                
    $thePosition = new Position($theX$theY$theZ$level);
                
    $theExplosion = new Explosion($thePosition5NULL);
                
    $theExplosion->explodeB();
                
    $impact 1;
                
    $damage 1;
               
        }
    };
    Last edited: Apr 20, 2016
    HotFireyDeath likes this.
  5. HotFireyDeath
    Offline

    HotFireyDeath Notable Member Plugin Developer

    Joined:
    Mar 19, 2015
    Posts:
    328
    Plugins:
    1
    Minecraft User:
    HotFireyDeath
    Why not do this?
    Theory.
    PHP:
    public function onShoot(EntityShootBowEvent $event){
     
    $arrow $event->getProjectile();
     
    $position $arrow->getPosition(); //Position class.
     
    $x $position->getX();
     
    $y $position->getY();
     
    $z $position->getZ();
     
    //etc.
    }
    Primus likes this.
  6. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    If you are getting position on EntityShootBowEvent it'll return position where the arrow was shot, you have to do it on ProjectileHitEvent instead.
    HotFireyDeath likes this.
  7. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Why don't you pass $entity instead creating new Position instance?

Share This Page

Advertisement