diff options
| author | Linnea Gräf <nea@nea.moe> | 2025-11-15 23:13:50 +0100 |
|---|---|---|
| committer | Linnea Gräf <nea@nea.moe> | 2025-11-15 23:13:50 +0100 |
| commit | 4d8399ff4d769def62e6a8241327c4f2dac47e71 (patch) | |
| tree | 703f8651cb680d2583d82c2b1b4aee0911ccb490 /src/main/kotlin/features/debug | |
| parent | 215178c650d38a4a77fdef6dc8815c07bef29c25 (diff) | |
| download | Firmament-4d8399ff4d769def62e6a8241327c4f2dac47e71.tar.gz Firmament-4d8399ff4d769def62e6a8241327c4f2dac47e71.tar.bz2 Firmament-4d8399ff4d769def62e6a8241327c4f2dac47e71.zip | |
snapshot: main source set compile
Diffstat (limited to 'src/main/kotlin/features/debug')
4 files changed, 10 insertions, 20 deletions
diff --git a/src/main/kotlin/features/debug/PowerUserTools.kt b/src/main/kotlin/features/debug/PowerUserTools.kt index a549f7e..fc36806 100644 --- a/src/main/kotlin/features/debug/PowerUserTools.kt +++ b/src/main/kotlin/features/debug/PowerUserTools.kt @@ -41,6 +41,7 @@ import moe.nea.firmament.util.mc.SNbtFormatter.Companion.toPrettyString import moe.nea.firmament.util.mc.displayNameAccordingToNbt import moe.nea.firmament.util.mc.iterableArmorItems import moe.nea.firmament.util.mc.loreAccordingToNbt +import moe.nea.firmament.util.mc.unsafeNbt import moe.nea.firmament.util.skyBlockId import moe.nea.firmament.util.tr @@ -166,7 +167,7 @@ object PowerUserTools { Pair(item, Text.stringifiedTranslatable("firmament.tooltip.copied.modelid", model.toString())) } else if (it.matches(TConfig.copyNbtData)) { // TODO: copy full nbt - val nbt = item.get(DataComponentTypes.CUSTOM_DATA)?.nbt?.toPrettyString() ?: "<empty>" + val nbt = item.get(DataComponentTypes.CUSTOM_DATA)?.unsafeNbt?.toPrettyString() ?: "<empty>" ClipboardUtils.setTextContent(nbt) lastCopiedStack = Pair(item, Text.translatable("firmament.tooltip.copied.nbt")) } else if (it.matches(TConfig.copyLoreData)) { diff --git a/src/main/kotlin/features/debug/SkinPreviews.kt b/src/main/kotlin/features/debug/SkinPreviews.kt index aff5c13..a853cd1 100644 --- a/src/main/kotlin/features/debug/SkinPreviews.kt +++ b/src/main/kotlin/features/debug/SkinPreviews.kt @@ -1,5 +1,6 @@ package moe.nea.firmament.features.debug +import com.mojang.authlib.GameProfile import kotlinx.serialization.json.JsonPrimitive import kotlinx.serialization.json.buildJsonObject import kotlinx.serialization.json.put @@ -35,18 +36,7 @@ object SkinPreviews { return val entity = event.entity as? LivingEntity ?: return val stack = entity.getEquippedStack(EquipmentSlot.HEAD) ?: return - val profile = stack.get(DataComponentTypes.PROFILE) ?: return - if (!profile.isCompleted) { - lastDiscard = TimeMark.now() - animation.clear() - MC.sendChat( - tr( - "firmament.dev.skinpreviews.discarding", - "Encountered unloaded skin, discarding all previews skin frames." - ) - ) - return - } + val profile = stack.get(DataComponentTypes.PROFILE)?.gameProfile ?: return if (profile == animation.lastOrNull()) return animation.add(profile) val shortened = animation.shortenCycle() @@ -59,7 +49,7 @@ object SkinPreviews { put( "textures", shortened.map { - it.gameProfile().id.toString() + ":" + it.properties()["textures"].first().value() + it.id.toString() + ":" + it.properties()["textures"].first().value() }.toJsonArray() ) } @@ -74,7 +64,7 @@ object SkinPreviews { } } - var animation = mutableListOf<ProfileComponent>() + var animation = mutableListOf<GameProfile>() var pos = Vec3d(-1.0, 72.0, -101.25) var isRecording = false var skinColor: String? = null diff --git a/src/main/kotlin/features/debug/itemeditor/ExportRecipe.kt b/src/main/kotlin/features/debug/itemeditor/ExportRecipe.kt index 9356dd3..b3dc69a 100644 --- a/src/main/kotlin/features/debug/itemeditor/ExportRecipe.kt +++ b/src/main/kotlin/features/debug/itemeditor/ExportRecipe.kt @@ -6,6 +6,7 @@ import kotlinx.serialization.json.JsonObject import kotlinx.serialization.json.JsonPrimitive import net.minecraft.client.network.AbstractClientPlayerEntity import net.minecraft.entity.decoration.ArmorStandEntity +import net.minecraft.util.AssetInfo import moe.nea.firmament.Firmament import moe.nea.firmament.annotations.Subscribe import moe.nea.firmament.events.HandledScreenKeyPressedEvent @@ -67,7 +68,7 @@ object ExportRecipe { val id = generateName(reply) ItemExporter.exportStub(id, "§9$reply") { val playerEntity = entity as? AbstractClientPlayerEntity - val textureUrl = playerEntity?.skinTextures?.textureUrl + val textureUrl = (playerEntity?.skin?.body as? AssetInfo.SkinAssetInfo)?.url if (textureUrl != null) it.setSkullOwner(playerEntity.uuid, textureUrl) } diff --git a/src/main/kotlin/features/debug/itemeditor/LegacyItemExporter.kt b/src/main/kotlin/features/debug/itemeditor/LegacyItemExporter.kt index f06eb43..65f9fa1 100644 --- a/src/main/kotlin/features/debug/itemeditor/LegacyItemExporter.kt +++ b/src/main/kotlin/features/debug/itemeditor/LegacyItemExporter.kt @@ -291,12 +291,10 @@ class LegacyItemExporter private constructor(var itemStack: ItemStack) { fun copyLegacySkullNbt() { val profile = itemStack.get(DataComponentTypes.PROFILE) ?: return legacyNbt.put("SkullOwner", NbtCompound().apply { - profile.uuid.ifPresent { - putString("Id", it.toString()) - } + putString("Id", profile.gameProfile.id.toString()) putBoolean("hypixelPopulated", true) put("Properties", NbtCompound().apply { - profile.properties().forEach { prop, value -> + profile.gameProfile.properties().forEach { prop, value -> val list = getListOrEmpty(prop) put(prop, list) list.add(NbtCompound().apply { |
