Riding enderpearls

Discussion in 'Plugin Development' started by Filipzetomic, Jul 23, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    Filipzetomic

    What I want is when you right click a stone sword it shoots enderpeals which you can ride like on Mineplex . So far it glitches a lot.
    Code:
       public void EndermanKit(PlayerInteractEvent event) {
            if ((event.getAction() == Action.RIGHT_CLICK_AIR && event.getItem().getType() == Material.STONE_SWORD)){
                EnderPearl enderPearl = event.getPlayer().launchProjectile(EnderPearl.class);
                enderPearl.setShooter(event.getPlayer());
                enderPearl.setPassenger(event.getPlayer());
    }
     
  2. Never used or seen this on mineplex...
    Mostly cuz I don't play....
    But my first thought would be to try setting the player's velocity to the enderpearl's velocity.
    I mean.. It sounds like it would work. xD
     
  3. Offline

    WinX64

    I tested your code here, but the enderpearl is colliding with the player whenever he is riding it, and i couldn't find any reliable way to prevent that using the api. If it's an option to you, you could create a custom enderpearl and override the collision code, to make it work only if collides with a block or another entity besides the shooter, for example.
    I did the same here and it worked almost flawlessly, the only problem is that it sometimes goes through the walls x)
     
Thread Status:
Not open for further replies.

Share This Page