[1.8] SKULL_ITEM not taking a skin :(

Discussion in 'Spigot Plugin Development' started by Renamed, Jul 23, 2018.

  1. Here is my code:
    Code (Java):
    ItemStack XpMult = new ItemStack(Material.SKULL_ITEM, 1);
                                    SkullMeta skull = (SkullMeta) XpMult.getItemMeta();
    Although the head just turns out as a skeleton skull, please help me. Thank you.
  2. It needs to have durability 3.

    When creating the itemstack:
    Code (Java):

    new item..(Material.., 1, (byte) 3);
  3. It now shows an alex head, which is better than the skeleton skull (and thank you for that) but how do I get it to be a blaze head? I have put in setOwner("MHF_Blaze");..
  4. Full code? And I mistakenly said byte instead of short. The durability must be inserted as a short. (Cast the durability 3 with short)
  5. Try block.getState().update()
  6. That's totally irrelevant. This doens't have to do with blocks but with itemstacks.
  7. This is an inventory ItemStack, not a block.

    @OP I got that problem too once, it seemed to work reliably when I used UUIDs / Base64 encoded texture values instead of names. Switching to that instead of the MHF heads also allows by far more skins to be used.
  8. Oh my bad, I thought its a block
  9. I also had issues with it, which led to me downloading and applying the skin manually using the specific NMS classes.
  10. I casted it to a short, still has same results (alex head)
    Never really tried to use UUID / Base64 for textures, but I guess ill give it a go
  11. If using the setOwner() method the skull's texture should update after a few seconds when you update the inventory (e.g by moving the itemstack). This behavior is caused by the fact, that the server has to contact the mojang api to retrieve the skin's texture url.

    Using the texture url directly updates the skull immediately. Take a look at this class.
    • Informative Informative x 1
    • Useful Useful x 1
  12. Just use a Class from the internet?!
    • Optimistic Optimistic x 1

  13. Nope it doesn't update.

    wanting to custom code this. not looking to just skid others code.
  14. If you'd like to try it the way I'm doing it, you can either shade ItemStackLib or use its public domain code.
    Direct implementation: https://github.com/DRE2N/ItemStackL...ava/de/erethon/commons/item/v1_13_R1.java#L59
    Reflection (I use reflection as a "backup" for upcoming versions): https://github.com/DRE2N/ItemStackL...in/java/de/erethon/commons/item/New.java#L130
    I've never had an issue with it so far. Got the heads from https://freshcoal.com/maincollection