[1.8] SkullOwner skin not rendering on head in inventory

Discussion in 'Spigot Plugin Development' started by koekeritis, Jun 2, 2015.

  1. Like the title says on my 1.8.3 spigot test server and on the 1.8 craftbukkit server the plugin is made for, SkullOwner skins DO NOT render on heads in an inventory. I don't know and it is annoying the crap out of me!

    Code (Text):
    ItemStack stats = new ItemStack(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal());
    SkullMeta statmeta = (SkullMeta) stats.getItemMeta();
    (And that just gives a steve skin, it renders when I place the skull but not in an inventory and I need it for an inventory system.)

    Thanks in advance!

  2. Same problem m8!
  3. I was so hyped when I saw: "1 new message from spigot forums" in my inbox... At least I'm not alone!
    It's so weird I have been searching the web for a week now but almost nonbody seems to have this problem, I couldn't find a solution anywher!
  4. Is your test server in offline mode?
  5. I didn't set online mode to false. I'll check tomorrow morning.
  6. Its a client bug. If you move the head with your mouse to another inventory slot it shows up.
  7. Moving it to another slot doesn't seem to help and if it is a client bug how do servers like hypixel show your skin on a head in your inventory.
  8. Its not a client bug, its an optimization by spigot, vecause requesting the image data was done in the main thread by mojang and that leaded to lag, so they moved that to another thread leading to default skins, this should however change some time if you update the player's inventory.

    An alternative would be to use http://www.spigotmc.org/resources/broken-customheadapi.2217/
    It says its broken, but you just have to use this api by mojang MANUALLY to get the skin urls: http://wiki.vg/Mojang_API#UUID_-.3E_Profile_.2B_Skin.2FCape
    To decode the base64 string you can just use the online tool you like most (plenty available)
  9. Thanks! how exactly would I get the skin from the api by mojang becuase this: "https://sessionserver.mojang.com/session/minecraft/profile/"+ p.getUniqueId() is not enough, I need to get the value from properties right? how would I do that?
    #9 koekeritis, Jun 4, 2015
    Last edited: Jun 4, 2015
  10. I've had this same problem since 1.8- they don't ever appear, even for players that should be in the offline player cache- even for myself, they're always Steve or Alex heads.

    I was considering going the route of the suggestions above, doing my own profile lookups, but isn't that what Spigot/mcserver are supposed to do under the hood for us?
  11. Try:

    ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (short)SkullType.PLAYER.ordinal());
    SkullMeta sm = (SkullMeta)head.getItemMeta();
  12. I think that's what we're all doing :)

    It simply doesn't work for me. And I think this is a common issue.

    For instance- one plugin that can do it, ArmorStandTools, the way they do it is to spawn an unattached player head block in the world, wait for it to break, catch the break event, and capture the drops. Insane! But it works. I think there is something internally in Spigot that doesn't do skin lookups for skull items, only for blocks.

    I also worked around the issue by building skulls myself, but I never implemented the skin lookup part. I am hackily using skins.mojang URLs, which I've been told are deprecated and will be removed :(
  13. This method works fine for me. Is online-mode false in server.properties?
  14. Yes, because it's Bungee. Skull blocks work fine though.
  15. offline mode doesn't work if im not mistaken.
  16. Why would it work for blocks and not items?

    I also have this problem running locally, online, outside of Bungee - I don't think it's related. I realize that offline mode by itself would break lookups since UUIDs are different- Bungee proxying should take care of that though.
  17. Idk. Maybe @md_5 knows it
  18. Yeah that's what I'm doing (did you read my code?) but it just DOESN'T work. And I have offline mode disabled/online-mode=true
  19. I think the issue, which has been brushed upon earlier I think, is that fact that you're putting it in a player inventory... Every time I use this code to put it in a chest it works (providing the name is valid) I think most of your issue comes from the fact that a player inventory doesn't always render when it should (Often this leads to 'ghost items'. If I'm not mistaken the skin look up for a head happens client side. Try using that code on a chest and you should have it work all the time...

    Code (Text):
    public void testSkull(Player p){
            Inventory inv = Bukkit.createInventory(null, 54, "NameIThink?");

           ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short)SkullType.PLAYER.ordinal());
            SkullMeta meta = (SkullMeta) skull.getItemMeta();


    Should work all the time...
  20. In my cosmetic menu I use the incentory with player heads in it, doesn't work either!