Creating custom heads

  • After careful consideration and due to limited usage, we’ve made the decision to discontinue the PaperMC forums. Moving forward, we recommend using Hangar for plugin uploads, and for all other community discussions and support, please join us on Discord.

C0MAE

New member
Dec 20, 2024
1
0
1
I want to create custom heads but I can't get any further. I have created the custom skull and so on but it does not set the new skin. Does anyone know what to do?


Java:
    private ItemStack getSkull(String url) throws MalformedURLException {
        UUID uuid = UUID.randomUUID();
        PlayerProfile profile = Bukkit.createProfile(uuid);
        PlayerTextures textures = profile.getTextures();
        textures.setSkin(URI.create(url).toURL());
        profile.setTextures(textures);
        ItemStack head = new ItemStack(Material.PLAYER_HEAD);
        SkullMeta skullMeta = (SkullMeta) head.getItemMeta();
        skullMeta.setPlayerProfile(profile);
        return head;
    }
 
Version Output
Current Purpur Version: 1.21.3-2358-16ce24a (MC: 1.21.3)*
* You are running the latest version

Noy

New member
Jan 8, 2023
23
1
0
1
You need to set the meta back to enable your modifications. Or just simply use ItemStack.editMeta.