/* * SPDX-FileCopyrightText: 2023 Linnea Gräf * SPDX-FileCopyrightText: 2024 Linnea Gräf * * 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) { if (args.isEmpty()) return modifyLore { val loreList = loreAccordingToNbt.toMutableList() for (arg in args) { loreList.add(arg) } loreList } } fun ItemStack.modifyLore(update: (List) -> List) { val loreList = loreAccordingToNbt loreAccordingToNbt = update(loreList) }