From 2371b1529cfb80930fd1a6a28d5d6f6cb621f2da Mon Sep 17 00:00:00 2001 From: Aria Date: Sat, 21 Sep 2019 00:38:41 +0200 Subject: [PATCH] CustomModelData for Config Items --- src/main/java/net/Indyuce/mmocore/api/item/ConfigItem.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/Indyuce/mmocore/api/item/ConfigItem.java b/src/main/java/net/Indyuce/mmocore/api/item/ConfigItem.java index 1ab4cedb..c0ecedb6 100644 --- a/src/main/java/net/Indyuce/mmocore/api/item/ConfigItem.java +++ b/src/main/java/net/Indyuce/mmocore/api/item/ConfigItem.java @@ -28,7 +28,7 @@ public class ConfigItem { private final String name, id, texture; private final ItemStack item; private final List lore; - private final int damage; + private final int damage, modeldata; private boolean unbreakable; private Map placeholders = new HashMap<>(); @@ -47,6 +47,7 @@ public class ConfigItem { */ damage = config.getInt("damage"); texture = config.getString("texture"); + modeldata = config.getInt("custom-model-data"); } public ConfigItem(String id) { @@ -60,6 +61,7 @@ public class ConfigItem { item = cache.item; damage = cache.damage; texture = cache.texture; + modeldata = cache.modeldata; } public ItemStack getItem(int amount) { @@ -102,6 +104,9 @@ public class ConfigItem { if (meta instanceof Damageable) ((Damageable) meta).setDamage(damage); + if(MMOCore.plugin.version.isStrictlyHigher(1, 13)) + meta.setCustomModelData(modeldata); + if (item.getType() == VersionMaterial.PLAYER_HEAD.toMaterial() && texture != null) { try { Field profileField = meta.getClass().getDeclaredField("profile");