Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public ItemStack head(String texture) {
- ItemStack itemStack1 = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
- SkullMeta headMeta = (SkullMeta) itemStack1.getItemMeta();
- GameProfile profile = new GameProfile(UUID.randomUUID(), null);
- profile.getProperties().put("textures", new Property("textures", texture));
- Field profileField = null;
- try {
- profileField = headMeta.getClass().getDeclaredField("profile");
- profileField.setAccessible(true);
- profileField.set(headMeta, profile);
- } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e1) {
- e1.printStackTrace();
- }
- itemStack1.setItemMeta(headMeta);
- return itemStack1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement