From 68b7b3183ff7086770ce3271645a5abe7f39500b Mon Sep 17 00:00:00 2001 From: nea Date: Thu, 14 Apr 2022 17:21:58 +0200 Subject: NPE --- .../io/github/moulberry/notenoughupdates/util/ItemUtils.java | 9 +++++++-- 1 file 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 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); } } -- cgit