Solved How to set a payer riding a horse?

Discussion in 'Plugin Development' started by mine-care, May 31, 2014.

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

    mine-care

    Well i want to make player ride a horse but i cant think of how to spawn a horse and then set the player on it.
     
  2. Offline

    bensku

    Spawn the horse and then do horse.setPassenger(passenger)
     
  3. Offline

    Antybarrel

    Code:java
    1. Horse horse = (Horse) e.getPlayer().getWorld().spawnCreature(e.getPlayer().getLocation(), EntityType.HORSE); // Spawns the horse
    2. horse.getInventory().setSaddle(new ItemStack(Material.SADDLE, 1)); // Gives horse saddle
    3. horse.setTamed(true); // Sets horse to tamed
    4. horse.setOwner(e.getPlayer()); // Makes the horse the players
    5.  
     
    mine-care likes this.
  4. Offline

    mine-care

    bensku okay thanks

    Antybarrel Supper thanks, you saved me time. also i tryed my own and i had no saddle so i got a error that i had not time to trace :S Thanks!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 1, 2016
Thread Status:
Not open for further replies.

Share This Page