feat: Add item model to export

This commit is contained in:
Linnea Gräf
2025-06-22 17:05:39 +02:00
parent d60276a4c1
commit 6fbdeb105a
2 changed files with 12 additions and 1 deletions

View File

@@ -106,6 +106,7 @@ class ItemExporter(var itemStack: ItemStack) {
// TODO: calculate hideflags
legacyNbt.put("HideFlags", NbtInt.of(254))
copyUnbreakable()
copyItemModel()
copyExtraAttributes()
copyLegacySkullNbt()
copyDisplay()
@@ -114,6 +115,11 @@ class ItemExporter(var itemStack: ItemStack) {
// TODO: copyDisplay
}
private fun copyItemModel() {
val itemModel = itemStack.get(DataComponentTypes.ITEM_MODEL) ?: return
legacyNbt.put("ItemModel", NbtString.of(itemModel.toString()))
}
private fun copyDisplay() {
legacyNbt.put("display", NbtCompound().apply {
put("Lore", lore.map { NbtString.of(it.getLegacyFormatString(trimmed = true)) }.toNbtList())