feat: Allow reexporting all items

This commit is contained in:
Linnea Gräf
2025-06-23 00:38:40 +02:00
parent cd81fc6b18
commit 5094885767

View File

@@ -1,6 +1,7 @@
package moe.nea.firmament.features.debug.itemeditor
import com.mojang.brigadier.arguments.StringArgumentType
import kotlinx.coroutines.launch
import kotlinx.serialization.json.JsonArray
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.JsonPrimitive
@@ -110,6 +111,42 @@ object ItemExporter {
)
)
}
fixLoreNbtFor(itemid)
MC.sendChat(
tr(
"firmament.repo.export.relore",
"Updated lore / display name for $itemid"
)
)
}
}
thenLiteral("all") {
thenExecute {
var i = 0
val chunkSize = 100
val items = RepoManager.neuRepo.items.items.keys
Firmament.coroutineScope.launch {
items.chunked(chunkSize).forEach { key ->
MC.sendChat(
tr(
"firmament.repo.export.relore.progress",
"Updated lore / display for ${i * chunkSize} / ${items.size}."
)
)
i++
key.forEach {
fixLoreNbtFor(SkyblockId(it))
}
}
MC.sendChat(tr("firmament.repo.export.relore.alldone", "All lores updated."))
}
}
}
}
}
}
fun fixLoreNbtFor(itemid: SkyblockId) {
modifyJson(itemid) {
val mutJson = it.toMutableMap()
val legacyTag = LegacyTagParser.parse(mutJson["nbttag"]!!.jsonPrimitive.content)
@@ -125,10 +162,6 @@ object ItemExporter {
JsonObject(mutJson)
}
}
}
}
}
}
@Subscribe
fun onKeyBind(event: HandledScreenKeyPressedEvent) {