mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-24 00:15:16 +01:00
CustomModelData for Config Items
This commit is contained in:
parent
ad33fd0bdf
commit
2371b1529c
@ -28,7 +28,7 @@ public class ConfigItem {
|
|||||||
private final String name, id, texture;
|
private final String name, id, texture;
|
||||||
private final ItemStack item;
|
private final ItemStack item;
|
||||||
private final List<String> lore;
|
private final List<String> lore;
|
||||||
private final int damage;
|
private final int damage, modeldata;
|
||||||
|
|
||||||
private boolean unbreakable;
|
private boolean unbreakable;
|
||||||
private Map<String, String> placeholders = new HashMap<>();
|
private Map<String, String> placeholders = new HashMap<>();
|
||||||
@ -47,6 +47,7 @@ public class ConfigItem {
|
|||||||
*/
|
*/
|
||||||
damage = config.getInt("damage");
|
damage = config.getInt("damage");
|
||||||
texture = config.getString("texture");
|
texture = config.getString("texture");
|
||||||
|
modeldata = config.getInt("custom-model-data");
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConfigItem(String id) {
|
public ConfigItem(String id) {
|
||||||
@ -60,6 +61,7 @@ public class ConfigItem {
|
|||||||
item = cache.item;
|
item = cache.item;
|
||||||
damage = cache.damage;
|
damage = cache.damage;
|
||||||
texture = cache.texture;
|
texture = cache.texture;
|
||||||
|
modeldata = cache.modeldata;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getItem(int amount) {
|
public ItemStack getItem(int amount) {
|
||||||
@ -102,6 +104,9 @@ public class ConfigItem {
|
|||||||
if (meta instanceof Damageable)
|
if (meta instanceof Damageable)
|
||||||
((Damageable) meta).setDamage(damage);
|
((Damageable) meta).setDamage(damage);
|
||||||
|
|
||||||
|
if(MMOCore.plugin.version.isStrictlyHigher(1, 13))
|
||||||
|
meta.setCustomModelData(modeldata);
|
||||||
|
|
||||||
if (item.getType() == VersionMaterial.PLAYER_HEAD.toMaterial() && texture != null) {
|
if (item.getType() == VersionMaterial.PLAYER_HEAD.toMaterial() && texture != null) {
|
||||||
try {
|
try {
|
||||||
Field profileField = meta.getClass().getDeclaredField("profile");
|
Field profileField = meta.getClass().getDeclaredField("profile");
|
||||||
|
Loading…
Reference in New Issue
Block a user