Teleporting a horse (or any mob)

Discussion in 'Plugin Development' started by ShakyTom, Jul 6, 2013.

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

    ShakyTom

    Hi there,

    I am having issues when teleporting a horse or any entity other than players.

    The entity teleports fine, but is invisible to players until either the entity moves around or the player moves around.

    I am using the following code to eject the player from a horse and then teleport the horse and player:

    Code:
    Horse horse = (Horse)player.getVehicle();
    horse.eject();
    horse.teleport(safeLocation);
    player.teleport(safeLocation);
    How do I go about making the horse immediately visible to the player?

    Should have added that I have tried teleporting the horse and player on different ticks with no success.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
  2. Offline

    Eats_Rainbows

    Code:
    LivingEntity theHorse = (LivingEntity) horse;
     
  3. Offline

    ShakyTom

    Wait what? How will that stop the horse from becoming invisible when teleported?
     
  4. Offline

    Eats_Rainbows

    Oh, you could try updating the entity by setting its health to its current health.
    Example:
    Code:
    LivingEntity theHorse = (LivingEntity) horse;
    theHorse.setHealth(theHorse.getHealth());
    There may be an error, made without an IDE.
     
Thread Status:
Not open for further replies.

Share This Page