Bump to 1.20.4

This commit is contained in:
Linnea Gräf
2024-01-21 14:06:34 +01:00
parent 18ebd21cb0
commit 3e1f75e322
11 changed files with 47 additions and 39 deletions

View File

@@ -17,17 +17,17 @@ fun ItemStack.appendLore(args: List<Text>) {
val compoundTag = getOrCreateSubNbt("display")
val loreList = compoundTag.getOrCreateList("Lore", NbtString.STRING_TYPE)
for (arg in args) {
loreList.add(NbtString.of(Text.Serializer.toJson(arg)))
loreList.add(NbtString.of(Text.Serialization.toJsonString(arg)))
}
}
fun ItemStack.modifyLore(update: (List<Text>) -> List<Text>) {
val compoundTag = getOrCreateSubNbt("display")
val loreList = compoundTag.getOrCreateList("Lore", NbtString.STRING_TYPE)
val parsed = loreList.map { Text.Serializer.fromJson(it.asString())!! }
val parsed = loreList.map { Text.Serialization.fromJson(it.asString())!! }
val updated = update(parsed)
loreList.clear()
loreList.addAll(updated.map { NbtString.of(Text.Serializer.toJson(it)) })
loreList.addAll(updated.map { NbtString.of(Text.Serialization.toJsonString(it)) })
}