Advertisement
_GameDoctor_

Untitled

Apr 12th, 2024
575
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. public ItemStack head(String texture) {
  2.         ItemStack itemStack1 = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
  3.         SkullMeta headMeta = (SkullMeta) itemStack1.getItemMeta();
  4.         GameProfile profile = new GameProfile(UUID.randomUUID(), null);
  5.         profile.getProperties().put("textures", new Property("textures", texture));
  6.         Field profileField = null;
  7.         try {
  8.             profileField = headMeta.getClass().getDeclaredField("profile");
  9.             profileField.setAccessible(true);
  10.             profileField.set(headMeta, profile);
  11.         } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e1) {
  12.             e1.printStackTrace();
  13.         }
  14.         itemStack1.setItemMeta(headMeta);
  15.         return itemStack1;
  16.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement