blob: 40d6198e4507371fcbdc8ea99a449842c2382cb3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package moe.nea.firmament.util
import net.minecraft.item.ItemStack
import net.minecraft.nbt.NbtCompound
import net.minecraft.nbt.NbtList
import net.minecraft.text.Text
import moe.nea.firmament.util.item.loreAccordingToNbt
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)
}
|