Skins

Discussion in 'Plugin Development' started by ISHLCMinecraft, May 17, 2014.

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

    ISHLCMinecraft

    I am tring to create a NPC plugin and it is working, but since there is alredy the feature of name changing (not in the bukkit API), there must be a skin changing feature (not in the bukkit API) using the UUID.
    I have tried to use UUIDFetcher to get the "skin" UUID and it did, but the skin is not showing up.

    Code:
    Code:java
    1. public class Human extends EntityPlayer {
    2.  
    3. private Location l;
    4. private CraftPlayer p;
    5.  
    6. public Human(Player player, String skinPlayer) {
    7. super(((CraftServer) Main.getInstance().getServer()).getHandle().getServer(), ((CraftWorld) player.getWorld()).getHandle(),
    8. new GameProfile(new UUIDFetcher(skinPlayer).call().get(skinPlayer), player.getName()),
    9. new PlayerInteractManager(((CraftWorld) player.getWorld()).getHandle()));
    10. this.l = player.getLocation();
    11. p = (CraftPlayer) player;
    12. playerConnection = new PlayerConnection(((CraftServer) Main.getInstance().getServer()).getHandle().getServer(), new NullNetworkManager(), this);
    13. }
    14.  
    15. public void spawn() {
    16. try {
    17. World ws = world;
    18. ws.addEntity(this);
    19. getBukkitEntity().teleport(p);
    20. if(p != null) {
    21. playerInteractManager.setGameMode(EnumGamemode.valueOf(p.getGameMode().toString()));
    22. inventory.setCarried(CraftItemStack.asNMSCopy(p.getItemInHand()));
    23. for(int i = 0; i < inventory.armor.length; i++) {
    24. inventory.armor = CraftItemStack.asNMSCopy(p.getInventory().getArmorContents());
    25. }
    26. }
    27.  
    28. PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn(this);
    29. for(Player p : Bukkit.getOnlinePlayers()) ((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
    30. } catch (Exception e) {
    31. e.printStackTrace();
    32. }
    33. }
    34.  
    35. public void h() {
    36.  
    37. }
    38.  
    39. public void a(PacketPlayInSettings packetplayinsettings) {}
    40.  
    41. public void sendMessage(IChatBaseComponent ichatbasecomponent) {}
    42.  
    43. public void sendMessage(IChatBaseComponent[] arg0) {}
    44.  
    45. public Location getLocation() {
    46. return l;
    47. }
    48. }
    49.  


    Line 8
     
  2. Offline

    tommycake50

    NPC's aren't players and as such the client doesn't check for their skins.
     
  3. Offline

    ISHLCMinecraft

    NPCs are just like normal players, Except for the fact that the server controls them, not a user.
     
  4. Offline

    tommycake50

    Do you understand how skins work?
     
  5. Offline

    ISHLCMinecraft

    There is a database of skins and blablabla...
    If there is way to change player's skin, there is a same way to change EntityPlayer's skin (There is a EntityPlayer variable in CraftPlayer class)
     
  6. Offline

    tommycake50

    Nope, the client looks up the username of a player and then downloads the skin from an url on the skin server https://s3.amazonaws.com/MinecraftSkins/username.png and then renders the player with that skin.
    However it only looks up playernames and not mob or npc names.
     
Thread Status:
Not open for further replies.

Share This Page