diff options
author | Linnea Gräf <nea@nea.moe> | 2024-10-01 18:00:43 +0200 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-10-01 18:00:43 +0200 |
commit | a4eac70118fc25334c9352712fe3c7944b8bed1d (patch) | |
tree | e0faedfca323e243a64a427d13b4fb31bcea9256 /src/main/kotlin/util/mc/ItemUtil.kt | |
parent | beb14d73bd2d0d48513e540ff629b48f89b95ed9 (diff) | |
download | Firmament-a4eac70118fc25334c9352712fe3c7944b8bed1d.tar.gz Firmament-a4eac70118fc25334c9352712fe3c7944b8bed1d.tar.bz2 Firmament-a4eac70118fc25334c9352712fe3c7944b8bed1d.zip |
Add basic sack util
[no changelog]
Diffstat (limited to 'src/main/kotlin/util/mc/ItemUtil.kt')
-rw-r--r-- | src/main/kotlin/util/mc/ItemUtil.kt | 20 |
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) +} |