diff options
| author | Linnea Gräf <nea@nea.moe> | 2025-11-17 19:55:02 +0100 |
|---|---|---|
| committer | Linnea Gräf <nea@nea.moe> | 2025-11-17 19:55:02 +0100 |
| commit | c93a04a001b0f66b2724d46b04b6d1ed49a08d07 (patch) | |
| tree | 5869ca70acc482ef0362f27785c3d3f1cbb9ffae /src/main/kotlin/features/debug/itemeditor/ItemExporter.kt | |
| parent | af9893b59407c69d31ebd2ed513f0396ab4d2dc9 (diff) | |
| download | Firmament-c93a04a001b0f66b2724d46b04b6d1ed49a08d07.tar.gz Firmament-c93a04a001b0f66b2724d46b04b6d1ed49a08d07.tar.bz2 Firmament-c93a04a001b0f66b2724d46b04b6d1ed49a08d07.zip | |
refactor: port to mojmaps
Diffstat (limited to 'src/main/kotlin/features/debug/itemeditor/ItemExporter.kt')
| -rw-r--r-- | src/main/kotlin/features/debug/itemeditor/ItemExporter.kt | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/main/kotlin/features/debug/itemeditor/ItemExporter.kt b/src/main/kotlin/features/debug/itemeditor/ItemExporter.kt index ccbd7e0..f664da3 100644 --- a/src/main/kotlin/features/debug/itemeditor/ItemExporter.kt +++ b/src/main/kotlin/features/debug/itemeditor/ItemExporter.kt @@ -12,10 +12,10 @@ import kotlin.io.path.notExists import kotlin.io.path.readText import kotlin.io.path.relativeTo import kotlin.io.path.writeText -import net.minecraft.item.ItemStack -import net.minecraft.item.Items -import net.minecraft.nbt.NbtString -import net.minecraft.text.Text +import net.minecraft.world.item.ItemStack +import net.minecraft.world.item.Items +import net.minecraft.nbt.StringTag +import net.minecraft.network.chat.Component import moe.nea.firmament.Firmament import moe.nea.firmament.annotations.Subscribe import moe.nea.firmament.commands.RestArgumentType @@ -47,7 +47,7 @@ import moe.nea.firmament.util.tr object ItemExporter { - fun exportItem(itemStack: ItemStack): Text { + fun exportItem(itemStack: ItemStack): Component { nonOverlayCache.clear() val exporter = LegacyItemExporter.createExporter(itemStack) var json = exporter.exportJson() @@ -197,7 +197,7 @@ object ItemExporter { display.putString("Name", mutJson["displayname"]!!.jsonPrimitive.content) display.put( "Lore", - (mutJson["lore"] as JsonArray).map { NbtString.of(it.jsonPrimitive.content) } + (mutJson["lore"] as JsonArray).map { StringTag.valueOf(it.jsonPrimitive.content) } .toNbtList() ) mutJson["nbttag"] = JsonPrimitive(legacyTag.toLegacyString()) @@ -220,8 +220,8 @@ object ItemExporter { if (!PowerUserTools.TConfig.highlightNonOverlayItems) { return } - val stack = event.slot.stack ?: return - val id = event.slot.stack.skyBlockId?.neuItem + val stack = event.slot.item ?: return + val id = event.slot.item.skyBlockId?.neuItem if (PowerUserTools.TConfig.dontHighlightSemicolonItems && id != null && id.contains(";")) return val sbId = stack.skyBlockId ?: return val isExported = nonOverlayCache.getOrPut(sbId) { @@ -240,8 +240,8 @@ object ItemExporter { fun exportStub(skyblockId: SkyblockId, title: String, extra: (ItemStack) -> Unit = {}) { exportItem(ItemStack(Items.PLAYER_HEAD).also { - it.displayNameAccordingToNbt = Text.literal(title) - it.loreAccordingToNbt = listOf(Text.literal("")) + it.displayNameAccordingToNbt = Component.literal(title) + it.loreAccordingToNbt = listOf(Component.literal("")) it.setSkyBlockId(skyblockId) extra(it) // LOL }) |
