diff options
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java index 3a2db0fb..cffdd164 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java @@ -73,7 +73,10 @@ public class ItemUtils { } public static List<String> getLore(ItemStack is) { - NBTTagCompound tagCompound = is.getTagCompound(); + return getLore(is.getTagCompound()); + } + + public static List<String> getLore(NBTTagCompound tagCompound) { if (tagCompound == null) { return Collections.emptyList(); } @@ -84,4 +87,13 @@ public class ItemUtils { } return list; } + + public static String getDisplayName(NBTTagCompound compound) { + if (compound == null) return null; + String string = compound.getCompoundTag("display").getString("Name"); + if (string == null || string.isEmpty()) + return null; + return string; + } + } |
