From abe71be0da84bfc5d765c002cea4bf1950fe49e1 Mon Sep 17 00:00:00 2001 From: Lulonaut Date: Wed, 2 Nov 2022 00:35:02 +0100 Subject: Essenceupgrades gui (#313) Co-authored-by: jani270 --- .../moulberry/notenoughupdates/util/ItemUtils.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java') 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 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 getLore(ItemStack is) { return getLore(is.getTagCompound()); } -- cgit