How to make a player sit on a pig?

Discussion in 'Plugin Development' started by NicksTheBoss, Nov 27, 2014.

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

    NicksTheBoss

    I want to make a plugin where people can right click a saddle and it will spawn them on a pig where they can fly around. How can I spawn the player on the pig?
     
  2. Offline

    Skionz

  3. Offline

    NicksTheBoss

    Skionz
    But how would I get the pig entity?
     
  4. Offline

    Skionz

    NicksTheBoss Thats up to you. Spawn a new one, use Maps, check when a player interacts with an entity.
     
  5. Offline

    Dudemister1999

    NicksTheBoss Here's a direct quote from someone I read a few minutes ago:

    " right click a saddle and it will spawn them on a pig"

    So when the player right clicks, check if it's a saddle they clicked with (and for god's sake, use some null checks please), and if it's a saddle spawn a pig and use the code Skionz provided.

    EDIT: I was attacked by a ferocious ninja. :p
     
    Skionz likes this.
  6. Offline

    NicksTheBoss

    Skionz
    Yeah but setPassenger needs a Entity and the only way to spawn a pig is through EntityType
     
  7. Offline

    Skionz

  8. Offline

    NicksTheBoss

    Skionz Can I get an example please?
     
  9. Offline

    Skionz

  10. Offline

    NicksTheBoss

    Skionz of turning the EntityType of pig into a Entity?
     
  11. Offline

    Skionz

    NicksTheBoss You can't turn EntityType into an Entity. EntityType is an enum for choosing which type of Entity to spawn. World#spawnEntity returns an Entity not an EntityType.
     
    ChipDev likes this.
  12. Offline

    ChipDev

    That's why you use Entity e = World#spawnEntity
     
  13. Offline

    Fuzzybear04

    ChipDev I've seen this before on other things you've replied to, But why do you type things like
    'World#spawnEntity' instead of using 'World.spawnEntity'? I've seen others do it too, but I was just wondering why
     
    TGRHavoc likes this.
Thread Status:
Not open for further replies.

Share This Page