aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/firmament/features/debug
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-04-26 18:04:45 +0200
committerLinnea Gräf <nea@nea.moe>2024-04-26 18:15:54 +0200
commit7e0151569477df63601be50c82177ecfd21e5deb (patch)
treef30e5440a1855de92d2b424ef79339d3d6cf5f34 /src/main/kotlin/moe/nea/firmament/features/debug
parent041da7c7d179df01c4048a81ddf40a9f13c3ce77 (diff)
downloadfirmament-7e0151569477df63601be50c82177ecfd21e5deb.tar.gz
firmament-7e0151569477df63601be50c82177ecfd21e5deb.tar.bz2
firmament-7e0151569477df63601be50c82177ecfd21e5deb.zip
Bump to 1.20.5
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/features/debug')
-rw-r--r--src/main/kotlin/moe/nea/firmament/features/debug/PowerUserTools.kt14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/features/debug/PowerUserTools.kt b/src/main/kotlin/moe/nea/firmament/features/debug/PowerUserTools.kt
index 9341dad..99ef0d5 100644
--- a/src/main/kotlin/moe/nea/firmament/features/debug/PowerUserTools.kt
+++ b/src/main/kotlin/moe/nea/firmament/features/debug/PowerUserTools.kt
@@ -1,5 +1,6 @@
/*
* SPDX-FileCopyrightText: 2023 Linnea Gräf <nea@nea.moe>
+ * SPDX-FileCopyrightText: 2024 Linnea Gräf <nea@nea.moe>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
@@ -8,9 +9,9 @@ package moe.nea.firmament.features.debug
import net.minecraft.block.SkullBlock
import net.minecraft.block.entity.SkullBlockEntity
+import net.minecraft.component.DataComponentTypes
import net.minecraft.item.ItemStack
import net.minecraft.item.Items
-import net.minecraft.nbt.NbtHelper
import net.minecraft.text.Text
import net.minecraft.util.hit.BlockHitResult
import net.minecraft.util.hit.HitResult
@@ -27,7 +28,6 @@ import moe.nea.firmament.mixins.accessor.AccessorHandledScreen
import moe.nea.firmament.util.ClipboardUtils
import moe.nea.firmament.util.MC
import moe.nea.firmament.util.focusedItemStack
-import moe.nea.firmament.util.getOrCreateCompoundTag
import moe.nea.firmament.util.skyBlockId
object PowerUserTools : FirmamentFeature {
@@ -120,7 +120,8 @@ object PowerUserTools : FirmamentFeature {
lastCopiedStack =
Pair(item, Text.stringifiedTranslatable("firmament.tooltip.copied.modelid", model.toString()))
} else if (it.matches(TConfig.copyNbtData)) {
- val nbt = item.orCreateNbt.toString()
+ // TODO: copy full nbt
+ val nbt = item.get(DataComponentTypes.CUSTOM_DATA)?.nbt?.toString() ?: "<empty>"
ClipboardUtils.setTextContent(nbt)
lastCopiedStack = Pair(item, Text.translatable("firmament.tooltip.copied.nbt"))
} else if (it.matches(TConfig.copySkullTexture)) {
@@ -128,7 +129,7 @@ object PowerUserTools : FirmamentFeature {
lastCopiedStack = Pair(item, Text.translatable("firmament.tooltip.copied.skull-id.fail.no-skull"))
return@subscribe
}
- val profile = NbtHelper.toGameProfile(item.orCreateNbt.getOrCreateCompoundTag("SkullOwner"))
+ val profile = item.get(DataComponentTypes.PROFILE)
if (profile == null) {
lastCopiedStack = Pair(item, Text.translatable("firmament.tooltip.copied.skull-id.fail.no-profile"))
return@subscribe
@@ -140,7 +141,10 @@ object PowerUserTools : FirmamentFeature {
}
ClipboardUtils.setTextContent(skullTexture.toString())
lastCopiedStack =
- Pair(item, Text.stringifiedTranslatable("firmament.tooltip.copied.skull-id", skullTexture.toString()))
+ Pair(
+ item,
+ Text.stringifiedTranslatable("firmament.tooltip.copied.skull-id", skullTexture.toString())
+ )
println("Copied skull id: $skullTexture")
}
}