Creating a Player Entity

Discussion in 'Plugin Development' started by Molten, Jan 12, 2014.

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

    Molten

    I've been looking around for awhile and cannot find anything that can help me.

    Basically what I'm trying to do is simple, given a player name(and that player is logged in) and coordinates, it places a "copy" of that player at the location.

    I have been trying to look at how to create a player and cannot find anything. I'm not asking you to code this for me, I'm asking you to help me get pushed in the right direction. All this copy needs to do is stand there with the same skin as the player (i.e. a server copies the Admin player and places the copy by a sign saying admin and the name of the admin.)

    I just need to know how to take a player and make a copy of him, or make a new player and just take the players skin.
     
  2. Offline

    NoLiver92

    This is basically an NPC which requires the use of packets. there are a couple of libs in the resources section to look at as well as numerous topics on the forum with "NPC" in the title which can help. The skin of the player will depend on the name of the player as minecraft will think its a new player, check its name with mojang, and download the skin for the name. I hope this helps you find more information on the topic
     
  3. Offline

    xTrollxDudex

    Molten
    If you use Packets (PacketPlayOutNamedEntitySpawn), it may be a bit more difficult to manage the NPC, I would recommend using a bit of deeper NMS if you would want to use it for more complex things. If you do use NMS, make sure to execute the b method in PlayerInteractManager to EnumGamemode and override the getPlayer() method to return a new CraftPlayer to prevent bot ticking entity crashes and NPEs.

    Also make sure to use the NMS world.addEntity(Entity) so it can be physically rendered.
     
Thread Status:
Not open for further replies.

Share This Page