Hey guys, I have a problem when I try to spawn a pig for players to race on. I have the following method to mount a player on a pig: Code:java public void mountpig(Player speler) { Pig pig = (Pig)speler.getWorld().spawnEntity(speler.getLocation(),EntityType.PIG); pig.teleport(speler.getLocation()); pig.setSaddle(true); pig.setPassenger(speler); speler.setItemInHand(new ItemStack(Material.CARROT_STICK)); } The pig gets spawned but it's not moving at all. It takes like 20 seconds before the pig is reacting to my carrot stick, while when mounting a pig normally it reacts right away. Any idea how I can fix this? Kinds regards, Bikkel007
PlayerMoveEvent : Check if player is riding the pig, and if player have carrot stick in hand, change the pig's velocity based on the player's velocity https://forums.bukkit.org/threads/how-to-create-a-vehicle-spaceship.128115/#post-1541962
MrKeals So you mean something like this: Code:java @EventHandlerpublic void OnPlayerMove (PlayerMoveEvent event){if (event.getPlayer().getVehicle() instanceof Pig == true){event.getPlayer().getVehicle().setVelocity(event.getPlayer().getVelocity());}} It isn't working the way it is right now. Any suggestions? N3rdFall Yep that's working. Thanks Even though it's working, the pig is going way too fast. Is it possible to slow it down? EDIT. Never mind, found it Code:java event.getPlayer().getLocation().getDirection().multiply(0.25) EDIT by Moderator: merged posts, please use the edit button instead of double posting.