- Баллы
- 76
- Имя в Minecraft
- TheSirCororo
Здравствуйте. Я пытаюсь наложить на голову текстурки http://textures.minecraft.net/texture/e64cfecdcd8644479652cff359222a6240577922e39a994ab5c0b12ad582f5
Вот метод для получения головы
Кодируется в Base64 правильно, я проверял, заносится в GameProfile всё правильно, я проверял. Выдаю себе предмет - голова скелета. Как решать? 1.12
Вот метод для получения головы
PHP:
public static ItemStack getCustomSkull(String url) {
GameProfile profile = new GameProfile(UUID.randomUUID(), null);
PropertyMap propertyMap = profile.getProperties();
if (propertyMap == null) {
throw new IllegalStateException("Profile doesn't contain a property map");
}
byte[] encodedData = Base64Coder.encodeString(String.format("{textures:{SKIN:{url:\"%s\"}}}", url)).getBytes();
profile.getProperties().put("textures", new Property("textures", new String(encodedData)));
ItemStack head = new ItemStack(getSkullMaterial(), 1);
SkullMeta headMeta = (SkullMeta) head.getItemMeta();
try {
Field profileField = headMeta.getClass().getDeclaredField("profile");
profileField.setAccessible(true);
profileField.set(headMeta, profile);
} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e1) {
e1.printStackTrace();
}
head.setItemMeta(headMeta);
return head;
}
Последнее редактирование: