Mirror von
https://github.com/St3venAU/ArmorStandTools.git
synchronisiert 2024-12-27 12:00:07 +01:00
Merge pull request #66 from MagicCraft-Mc/master
Add CustomModelData option for itemInfo(ItemStack is)
Dieser Commit ist enthalten in:
Commit
92e915dfa5
@ -166,6 +166,11 @@ class Utils {
|
||||
}
|
||||
return tags.length() == 0 ? "" : tags.toString();
|
||||
}
|
||||
|
||||
static private int getItemCustomModelData(ItemStack is) {
|
||||
if(is == null || is.getItemMeta() == null || is.getItemMeta().getCustomModelData() == null) return 0;
|
||||
return is.getItemMeta().getCustomModelData();
|
||||
}
|
||||
|
||||
static private String skullOwner(ItemStack is) {
|
||||
if(is == null || is.getItemMeta() == null || !(is.getItemMeta() instanceof SkullMeta skull)) return "";
|
||||
@ -187,6 +192,7 @@ class Utils {
|
||||
@SuppressWarnings("deprecation")
|
||||
short durability = is.getDurability();
|
||||
String skullOwner = skullOwner(is);
|
||||
int customModelData = getItemCustomModelData(is);
|
||||
int n = 0;
|
||||
if(itemStackTags.length() > 0 || durability > 0 || skullOwner.length() > 0) {
|
||||
sb.append(",tag:{");
|
||||
@ -194,6 +200,11 @@ class Utils {
|
||||
sb.append("Damage:").append(durability);
|
||||
n++;
|
||||
}
|
||||
if(customModelData > 0) {
|
||||
if(n > 0) sb.append(",");
|
||||
sb.append("CustomModelData:").append(customModelData);
|
||||
n++;
|
||||
}
|
||||
if(itemStackTags.length() > 0) {
|
||||
if(n > 0) sb.append(",");
|
||||
sb.append(itemStackTags);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren