[SOLVED] Custom Head Texture

Discussion in 'Spigot Plugin Development' started by DevCubeHD, Jun 27, 2015.

  1. How can I set the texture of an head from an image?
    I know that it works in Singeplayer, but how can I do it in Bukkit?
    Thanks
    ~DevCube
     
  2. PHP:
        public ItemStack getSkull(String url) {
            ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (short)3);
            if(url.isEmpty())return head;
           
           
            SkullMeta headMeta = (SkullMeta) head.getItemMeta();
            GameProfile profile = new GameProfile(UUID.randomUUID(), null);
            byte[] encodedData = Base64.encodeBase64(String.format("{textures:{SKIN:{url:\"%s\"}}}", url).getBytes());
            profile.getProperties().put("textures", new Property("textures", new String(encodedData)));
            Field profileField = null;
            try {
                profileField = headMeta.getClass().getDeclaredField("profile");
                profileField.setAccessible(true);
                profileField.set(headMeta, profile);
            } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e1) {
                e1.printStackTrace();
            }
            head.setItemMeta(headMeta);
            return head;
        }
     
    • Useful Useful x 8
    • Like Like x 5
    • Informative Informative x 1
  3. Okay that is the Item... how can I set it in the world as a block?
     
  4. Block as in when you place the player head?
     
  5. See this: LINK . You can put a custom texture in a head ;)
     
  6. I dont know what is wrong, but nothing works :(
     
  7. Is there any abillity left? Because of the SkinServer Whitelists? All say its broken, but can I do anything with packets or so?!
     
  8. can you tell me more about the skinserver whitelists, because some of my skins works but some don't
     
  9. There is no white list on a skin server, your skin issues is probably due to rate limiting
     
  10. this is what i have learned so far: all skins worked all times when using 1.8, when upgrading to 1.8.3 only the skins which i get from the minecraft database work
     
  11. that will still require a minecraft account, no other ways?
     
  12. No, and pelase use the reply button
     
    • Funny Funny x 1
  13. how can it be blocked? i looked into the source code of CraftSkullMeta from 1.8 and 1.8.3 and there is no difference. it tried joining with 1.8 client still doesn't work
     
  14. The client changed, not the server (I think so)
     
  15. NathanWolf

    Supporter

    In 1.8.3 a whitelist was added to the client. It will only fetch player skins from two domains- textures.mojang and ... maybe skins.mojang.

    So the only way to do this now is to have an actual minecraft account and upload your skins to that account. Or you can use any of the existing player head/skin databases.

    Fortunately, once you've uploaded your skin its URL is fixed forever, so you can upload as many as you want.

    I've got a collection going :)

    http://mine.elmakers.com/#textures

    Otherwise, it does still work fine- I think you ought to be able to do the same with a block, though I haven't actually tried that myself, I just use skull items (mainly as GUI icons)
     
    • Like Like x 1
  16. Does that include the TLD, or could I do textures.mojang.sysemupdate.io
     
  17. NathanWolf

    Supporter

    It's the full domain, sorry- no cheating around it.