Solved How do i make a player ride an enderpearl?

Discussion in 'Plugin Development' started by MasterNiitro, Apr 8, 2016.

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

    MasterNiitro

    Hi, i looked thru most of the threads on the site but i didn't get a soluction....
    I wanted to make the player ride an enderpearl for my hub server, do you know how to do it?
     
  2. Offline

    CraftCreeper6

    Zombie_Striker likes this.
  3. Offline

    Zombie_Striker

    @MasterNiitro
    • When the projectile spawns
    • Get the shooter. If that shoot is a player and the projectile is an ender pearl
    • EnderPearl.setPassager(shooter)
     
  4. Offline

    Badwolf330

    @MasterNiitro

    You need to loop the player on the ender pearl, otherwise the player will be thrown off.

    Sorry for my bad english!
     
  5. Offline

    Abstract97

    @MasterNiitro I wouldn't advise doing what the people above said, in this scenario it's relatively glitchy and sometimes the player is kicked of the ender-peal, or just not set as passenger at all; if a loop is used.

    I would advise
    • Spawning in an ender-pearl as an Item based Entity.
    • Applying a velocity to the Item, this could be custom or you could grab the players direction and multiply it by a certain amount to stimulate a normal ender-pearl throw.
    • Setting the player as a passenger of the item. (Rather than an ender-pearl itself.)
    • In the background run a task which will check when the ender-pearl item hits the ground.
    • Damage the player if necessary, and call the eject method on the item to kick off the player, then remove the item.
    The reason I would suggest this rather than the other suggestions, is because when I tried to do the same thing, I encountered a lot of problems when just setting the passenger of the ender-pearl. If it was called once only, after a certain distance the player is kicked off automatically. But if I repeated a task setting them as the passenger sometimes the player was kicked from the server for an 'Illegal Movement' or other issues occurred.
     
  6. Offline

    teej107

    Also I tried to do the same thing a while ago except with an arrow. If I wasn't in creative, the arrow would just hit me, the passenger.
     
    Abstract97 likes this.
  7. Offline

    Abstract97

    @teej107 Yup, the ender-pearl would do the exact same thing. I remember trying to create a parabolic shape with an arrow too, got the same thing as you mentioned.
     
  8. Offline

    mcdorli

    @Abstract97 @teej107 If you create an arrow with a packet, can that hurt the player, as it obly exists client side?
     
  9. Offline

    Abstract97

    @mcdorli I actually have no idea, haven't tried that before.
     
  10. Offline

    teej107

    To tell you the truth, idk. I think it'll work overall but I have know idea on how the client will react while it happens.

    @Abstract97 Offtopic: Holy cow your WPM! I can only get up to like 50. I do make quite a few typing errors when I type though.
     
  11. Offline

    MasterNiitro

    Thank you all for the answers i'll try to make it work lol
     
  12. Offline

    Abstract97

    @teej107 That was about a year ago, I can actually get to about 94 now haha.
     
Thread Status:
Not open for further replies.

Share This Page