custom mob heads dont stack plz help

Discussion in 'Plugin Development' started by sheaksadi, Jan 6, 2021.

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

    sheaksadi

    i am trying to make a custom mob head plugin using following code but the heads doesnt stack plz help

    public ItemStack getCustomSkull(String url) {

    ItemStack head = new ItemStack(Material.PLAYER_HEAD);
    if (url.isEmpty()) return head;

    SkullMeta skullMeta = (SkullMeta) head.getItemMeta();
    GameProfile profile = new GameProfile(UUID.randomUUID(), null);

    profile.getProperties().put("textures", new Property("textures", url));

    try {
    Method mtd = skullMeta.getClass().getDeclaredMethod("setProfile", GameProfile.class);
    mtd.setAccessible(true);
    mtd.invoke(skullMeta, profile);
    } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException ex) {
    ex.printStackTrace();
    }

    head.setItemMeta(skullMeta);
    return head;
    }
     
  2. Offline

    Kars

    I think player heads don't stack by default.
     
Thread Status:
Not open for further replies.

Share This Page