diff options
-rw-r--r-- | gradle/libs.versions.toml | 2 | ||||
-rw-r--r-- | shell.nix | 6 | ||||
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/features/debug/PowerUserTools.kt | 28 |
3 files changed, 33 insertions, 3 deletions
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 388d5c6..912b88c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -10,7 +10,7 @@ fabric_kotlin = "1.9.4+kotlin.1.8.21" yarn = "1.20.4+build.3" libgui = "9.2.2+1.20.2" rei = "14.0.688" -devauth = "1.0.0" +devauth = "1.2.0" modmenu = "9.0.0" ktor = "2.3.0" dbus_java = "4.2.1" @@ -11,5 +11,11 @@ pkgs.mkShell { temurin-bin-17 reuse pre-commit + glfw + libGL ]; + shellHook = '' + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.glfw}/lib" + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.libGL}/lib" + ''; } 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 3545f21..9341dad 100644 --- a/src/main/kotlin/moe/nea/firmament/features/debug/PowerUserTools.kt +++ b/src/main/kotlin/moe/nea/firmament/features/debug/PowerUserTools.kt @@ -9,6 +9,8 @@ package moe.nea.firmament.features.debug import net.minecraft.block.SkullBlock import net.minecraft.block.entity.SkullBlockEntity 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 @@ -25,6 +27,7 @@ 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 { @@ -105,7 +108,8 @@ object PowerUserTools : FirmamentFeature { return@subscribe } ClipboardUtils.setTextContent(sbId.neuItem) - lastCopiedStack = Pair(item, Text.stringifiedTranslatable("firmament.tooltip.copied.skyblockid", sbId.neuItem)) + lastCopiedStack = + Pair(item, Text.stringifiedTranslatable("firmament.tooltip.copied.skyblockid", sbId.neuItem)) } else if (it.matches(TConfig.copyTexturePackId)) { val model = CustomItemModelEvent.getModelIdentifier(item) if (model == null) { @@ -113,11 +117,31 @@ object PowerUserTools : FirmamentFeature { return@subscribe } ClipboardUtils.setTextContent(model.toString()) - lastCopiedStack = Pair(item, Text.stringifiedTranslatable("firmament.tooltip.copied.modelid", model.toString())) + lastCopiedStack = + Pair(item, Text.stringifiedTranslatable("firmament.tooltip.copied.modelid", model.toString())) } else if (it.matches(TConfig.copyNbtData)) { val nbt = item.orCreateNbt.toString() ClipboardUtils.setTextContent(nbt) lastCopiedStack = Pair(item, Text.translatable("firmament.tooltip.copied.nbt")) + } else if (it.matches(TConfig.copySkullTexture)) { + if (item.item != Items.PLAYER_HEAD) { + lastCopiedStack = Pair(item, Text.translatable("firmament.tooltip.copied.skull-id.fail.no-skull")) + return@subscribe + } + val profile = NbtHelper.toGameProfile(item.orCreateNbt.getOrCreateCompoundTag("SkullOwner")) + if (profile == null) { + lastCopiedStack = Pair(item, Text.translatable("firmament.tooltip.copied.skull-id.fail.no-profile")) + return@subscribe + } + val skullTexture = CustomSkyBlockTextures.getSkullTexture(profile) + if (skullTexture == null) { + lastCopiedStack = Pair(item, Text.translatable("firmament.tooltip.copied.skull-id.fail.no-texture")) + return@subscribe + } + ClipboardUtils.setTextContent(skullTexture.toString()) + lastCopiedStack = + Pair(item, Text.stringifiedTranslatable("firmament.tooltip.copied.skull-id", skullTexture.toString())) + println("Copied skull id: $skullTexture") } } } |