Mimicking Player Sleep Animation

Discussion in 'Plugin Development' started by SnowGears, Jul 30, 2012.

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

    SnowGears

    I have a really good idea for a plugin and would need player to lay down on the ground ( with no bed ) and was wondering if there was code to mimic this animation. Thanks!
     
  2. Offline

    r0306

  3. Offline

    SnowGears

    Hmm maybe I could replace the ground underneath with a bed? So would this be a major task?
     
  4. Offline

    r0306

    Tooner101
    Not at all. :p Packet sending is just like:
    Code:
    player.sendPacket(Packet.SLEEP);
    except that it doesn't have an API so it may look more complicated and it's also less documented than the Bukkit API but overall, it probably takes only 5 lines of code to accomplish.
     
    Tooner101 likes this.
  5. Offline

    SnowGears

    Hmm i will look into that then. Thanks again r0306. You are definitely the person who has replied to my threads the most haha. I look forward to your continued help. :)
     
  6. Offline

    r0306

  7. Offline

    ceoepts

    Would'nt it work to send a fake/Client bed to the client and make him lie in it?
     
  8. Offline

    Hoolean

    1. That post is from about 4 months ago; they may not respond and it is probably solved
    2. Is that not what they just suggested?!
     
  9. Offline

    ceoepts

    I dont care i still need to know this myself...
     
  10. Offline

    Hoolean

    Well have you tried packets?
     
  11. Offline

    ceoepts

    Im not sure have to use them yet :p
     
  12. Offline

    Comphenix

    You can kinda get it to work, but it's very buggy. The sleeping player will occasionally fall through the top layer, and almost disappear into the floor.

    I don't know if it's fixable on a vanilla client. It seems like the client will ignore the y-position the server sends and calculate it based on the nearest solid block. It might be possible with Spout, however.
     
Thread Status:
Not open for further replies.

Share This Page