Block selling to NPCs, trading and salvaging UUID locked items

[no changelog]
This commit is contained in:
nea
2023-10-04 16:41:04 +02:00
parent d0cc95b1e9
commit 64523821d8
3 changed files with 74 additions and 16 deletions

View File

@@ -11,9 +11,13 @@ import net.minecraft.nbt.NbtElement
import net.minecraft.nbt.NbtString
import net.minecraft.text.Text
fun textFromNbt() {
}
val ItemStack.loreAccordingToNbt
get() = getOrCreateSubNbt(ItemStack.DISPLAY_KEY).getList(ItemStack.LORE_KEY, NbtElement.STRING_TYPE.toInt())
.map { Text.Serializer.fromJson((it as NbtString).asString()) }
.map { lazy(LazyThreadSafetyMode.NONE) { Text.Serializer.fromJson((it as NbtString).asString()) } }
val ItemStack.displayNameAccordingToNbt
get() = getOrCreateSubNbt(ItemStack.DISPLAY_KEY).let {