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 | 16 |
1 files changed, 16 insertions, 0 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 6187495c..6cc1bbe7 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java @@ -103,6 +103,22 @@ public class ItemUtils { is.setTagCompound(tagCompound); } + public static void setLore(ItemStack is, List<String> newLore) { + NBTTagCompound tagCompound = is.getTagCompound(); + if (tagCompound == null) { + tagCompound = new NBTTagCompound(); + } + + NBTTagCompound display = tagCompound.getCompoundTag("display"); + NBTTagList lore = new NBTTagList(); + for (String s : newLore) { + lore.appendTag(new NBTTagString(s)); + } + display.setTag("Lore", lore); + tagCompound.setTag("display", display); + is.setTagCompound(tagCompound); + } + public static List<String> getLore(ItemStack is) { return getLore(is.getTagCompound()); } |
