From 38fd61fdcc70f75f5b8b5eb39e21c34aaf5ceb90 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Mon, 5 May 2025 15:33:21 +0200 Subject: fix(test): Unit Tests not DFUing items --- .../kotlin/features/debug/AnimatedClothingScanner.kt | 1 - .../kotlin/features/debug/ExportedTestConstantMeta.kt | 19 +++++++++++++++++++ src/main/kotlin/features/debug/PowerUserTools.kt | 8 ++++---- 3 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 src/main/kotlin/features/debug/ExportedTestConstantMeta.kt (limited to 'src/main/kotlin/features/debug') diff --git a/src/main/kotlin/features/debug/AnimatedClothingScanner.kt b/src/main/kotlin/features/debug/AnimatedClothingScanner.kt index d0db252..47da7d6 100644 --- a/src/main/kotlin/features/debug/AnimatedClothingScanner.kt +++ b/src/main/kotlin/features/debug/AnimatedClothingScanner.kt @@ -81,7 +81,6 @@ object AnimatedClothingScanner { if (subject == null) run { val entity = MC.instance.targetedEntity ?: return@run null val clipboard = ClipboardUtils.getTextContents() - MC.instance.entit if (!clipboard.startsWith(EXPORT_WATERMARK)) { ClipboardUtils.setTextContent(EXPORT_WATERMARK) } else { diff --git a/src/main/kotlin/features/debug/ExportedTestConstantMeta.kt b/src/main/kotlin/features/debug/ExportedTestConstantMeta.kt new file mode 100644 index 0000000..a817dd6 --- /dev/null +++ b/src/main/kotlin/features/debug/ExportedTestConstantMeta.kt @@ -0,0 +1,19 @@ +package moe.nea.firmament.features.debug + +import com.mojang.serialization.Codec +import com.mojang.serialization.codecs.RecordCodecBuilder +import java.util.Optional + +data class ExportedTestConstantMeta( + val dataVersion: Int, + val modVersion: Optional, +) { + companion object { + val CODEC: Codec = RecordCodecBuilder.create { + it.group( + Codec.INT.fieldOf("dataVersion").forGetter(ExportedTestConstantMeta::dataVersion), + Codec.STRING.optionalFieldOf("modVersion").forGetter(ExportedTestConstantMeta::modVersion), + ).apply(it, ::ExportedTestConstantMeta) + } + } +} diff --git a/src/main/kotlin/features/debug/PowerUserTools.kt b/src/main/kotlin/features/debug/PowerUserTools.kt index 251fc8b..4387ced 100644 --- a/src/main/kotlin/features/debug/PowerUserTools.kt +++ b/src/main/kotlin/features/debug/PowerUserTools.kt @@ -180,10 +180,10 @@ object PowerUserTools : FirmamentFeature { Pair(item, Text.stringifiedTranslatable("firmament.tooltip.copied.skull-id", skullTexture.toString())) println("Copied skull id: $skullTexture") } else if (it.matches(TConfig.copyItemStack)) { - ClipboardUtils.setTextContent( - ItemStack.CODEC - .encodeStart(MC.currentOrDefaultRegistries.getOps(NbtOps.INSTANCE), item) - .orThrow.toPrettyString()) + val nbt = ItemStack.CODEC + .encodeStart(MC.currentOrDefaultRegistries.getOps(NbtOps.INSTANCE), item) + .orThrow + ClipboardUtils.setTextContent(nbt.toPrettyString()) lastCopiedStack = Pair(item, Text.stringifiedTranslatable("firmament.tooltip.copied.stack")) } } -- cgit