aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/util/mc/ItemUtil.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/util/mc/ItemUtil.kt')
-rw-r--r--src/main/kotlin/util/mc/ItemUtil.kt20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main/kotlin/util/mc/ItemUtil.kt b/src/main/kotlin/util/mc/ItemUtil.kt
new file mode 100644
index 0000000..13519cf
--- /dev/null
+++ b/src/main/kotlin/util/mc/ItemUtil.kt
@@ -0,0 +1,20 @@
+package moe.nea.firmament.util.mc
+
+import net.minecraft.item.ItemStack
+import net.minecraft.text.Text
+
+fun ItemStack.appendLore(args: List<Text>) {
+ if (args.isEmpty()) return
+ modifyLore {
+ val loreList = loreAccordingToNbt.toMutableList()
+ for (arg in args) {
+ loreList.add(arg)
+ }
+ loreList
+ }
+}
+
+fun ItemStack.modifyLore(update: (List<Text>) -> List<Text>) {
+ val loreList = loreAccordingToNbt
+ loreAccordingToNbt = update(loreList)
+}