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 | 33 |
1 files changed, 33 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 new file mode 100644 index 00000000..e3d90aaa --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java @@ -0,0 +1,33 @@ +package io.github.moulberry.notenoughupdates.util; + +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.NBTTagString; + +import java.util.List; + +public class ItemUtils { + + public static ItemStack getCoinItemStack(int coinAmount) { + ItemStack itemStack = new ItemStack(Items.gold_nugget); + itemStack.setStackDisplayName("\u00A7r\u00A76" + Utils.formatNumberWithDots(coinAmount) + " Coins"); + return itemStack; + } + + public static void appendLore(ItemStack is, List<String> moreLore) { + 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); + tagCompound.setTag("display", display); + is.setTagCompound(tagCompound); + } +} |
