blob: 4ae226e5346d7ebd7149b51dc1a25bcc063412f5 (
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
27
28
29
30
31
|
/*
* SPDX-FileCopyrightText: 2023 Linnea Gräf <nea@nea.moe>
* SPDX-FileCopyrightText: 2024 Linnea Gräf <nea@nea.moe>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
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)
}
|