diff options
| author | Lulonaut <lulonaut@tutanota.de> | 2022-11-02 00:35:02 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-02 00:35:02 +0100 |
| commit | abe71be0da84bfc5d765c002cea4bf1950fe49e1 (patch) | |
| tree | b0f30fc651fcdfe5d2725141a6380c53e2b7e546 /src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java | |
| parent | 7184121f7ae1f16a9bc8e51989f555d62b14bb24 (diff) | |
| download | notenoughupdates-abe71be0da84bfc5d765c002cea4bf1950fe49e1.tar.gz notenoughupdates-abe71be0da84bfc5d765c002cea4bf1950fe49e1.tar.bz2 notenoughupdates-abe71be0da84bfc5d765c002cea4bf1950fe49e1.zip | |
Essenceupgrades gui (#313)
Co-authored-by: jani270 <jani270@gmx.de>
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()); } |
