Discussion in 'Spigot Plugin Development' started by Esquilo_Azul, Jul 5, 2015.

  1. How can i spawn and mount a player on a Horse in Java?
    I tried this but the player is not able to control the horse as if he mounted manualy ingame:
    Code (Text):
            if (e.getPlayer().getName().equals("Esquilo_Azul")) {
                Horse h = (Horse) e.getPlayer().getLocation().getWorld().spawnEntity(e.getPlayer().getLocation(), EntityType.HORSE);
                h.setCustomName("§cCavalinho do Diego");
                h.getInventory().setSaddle(new ItemStack(Material.SADDLE));
  2. I thought you could do something like h.setSaddled(true); Not sure if that would make a difference seeing that you are saddling the horse in some manner, or if the setSaddled(true) option is even available still, have not dealt with horses in a while. But it could be worth checking the docs and giving it a try.
    • Agree Agree x 1