diff options
author | nea <romangraef@gmail.com> | 2022-04-14 17:21:58 +0200 |
---|---|---|
committer | nea <romangraef@gmail.com> | 2022-04-14 17:21:58 +0200 |
commit | 68b7b3183ff7086770ce3271645a5abe7f39500b (patch) | |
tree | 1ffceab704f54621a107ca1ef80b00f893ed7c53 | |
parent | d8c61118f12fb93949e11b21e9a41e951a9af13f (diff) | |
download | NotEnoughUpdates-68b7b3183ff7086770ce3271645a5abe7f39500b.tar.gz NotEnoughUpdates-68b7b3183ff7086770ce3271645a5abe7f39500b.tar.bz2 NotEnoughUpdates-68b7b3183ff7086770ce3271645a5abe7f39500b.zip |
NPE
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java | 9 |
1 files changed, 7 insertions, 2 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 2244c5fc..bc620437 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java @@ -9,12 +9,17 @@ import java.util.List; public class ItemUtils { public static void appendLore(ItemStack is, List<String> moreLore) { - NBTTagCompound display = is.getTagCompound().getCompoundTag("display"); + NBTTagCompound tagCompound = is.getTagCompound(); + if(tagCompound == null){ + tagCompound = new NBTTagCompound(); + } + NBTTagCompound display = tagCompound.getCompoundTag("display"); NBTTagList lore = display.getTagList("Lore", 8); for (String s : moreLore) { lore.appendTag(new NBTTagString(s)); } display.setTag("Lore", lore); - is.getTagCompound().setTag("display", display); + tagCompound.setTag("display", display); + is.setTagCompound(tagCompound); } } |