aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/firmament/features/debug
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-06-14 18:34:40 +0200
committerLinnea Gräf <nea@nea.moe>2024-06-14 18:34:40 +0200
commite4bd69a0569b4ccc49b9e4b89998220bf4bfe25a (patch)
tree2cb89c55c9c63cbb115cfeaff1848f301c9a461c /src/main/kotlin/moe/nea/firmament/features/debug
parentcd1826a49822e7be0fb583e7b540270560fb657d (diff)
downloadfirmament-e4bd69a0569b4ccc49b9e4b89998220bf4bfe25a.tar.gz
firmament-e4bd69a0569b4ccc49b9e4b89998220bf4bfe25a.tar.bz2
firmament-e4bd69a0569b4ccc49b9e4b89998220bf4bfe25a.zip
Add shiny pig tracker
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/features/debug')
-rw-r--r--src/main/kotlin/moe/nea/firmament/features/debug/PowerUserTools.kt36
1 files changed, 36 insertions, 0 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 d530487..17e8253 100644
--- a/src/main/kotlin/moe/nea/firmament/features/debug/PowerUserTools.kt
+++ b/src/main/kotlin/moe/nea/firmament/features/debug/PowerUserTools.kt
@@ -10,12 +10,16 @@ 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.entity.Entity
+import net.minecraft.entity.LivingEntity
import net.minecraft.item.ItemStack
import net.minecraft.item.Items
import net.minecraft.text.Text
import net.minecraft.util.hit.BlockHitResult
+import net.minecraft.util.hit.EntityHitResult
import net.minecraft.util.hit.HitResult
import moe.nea.firmament.annotations.Subscribe
+import moe.nea.firmament.events.CommandEvent
import moe.nea.firmament.events.CustomItemModelEvent
import moe.nea.firmament.events.HandledScreenKeyPressedEvent
import moe.nea.firmament.events.ItemTooltipEvent
@@ -41,6 +45,7 @@ object PowerUserTools : FirmamentFeature {
val copyTexturePackId by keyBindingWithDefaultUnbound("copy-texture-pack-id")
val copyNbtData by keyBindingWithDefaultUnbound("copy-nbt-data")
val copySkullTexture by keyBindingWithDefaultUnbound("copy-skull-texture")
+ val copyEntityData by keyBindingWithDefaultUnbound("entity-data")
}
override val config
@@ -65,6 +70,37 @@ object PowerUserTools : FirmamentFeature {
}
}
+ fun debugFormat(itemStack: ItemStack): Text {
+ return Text.literal(itemStack.skyBlockId?.toString() ?: itemStack.toString())
+ }
+
+ @Subscribe
+ fun onEntityInfo(event: WorldKeyboardEvent) {
+ if (!event.matches(TConfig.copyEntityData)) return
+ val target = (MC.instance.crosshairTarget as? EntityHitResult)?.entity
+ if (target == null) {
+ MC.sendChat(Text.translatable("firmament.poweruser.entity.fail"))
+ return
+ }
+ showEntity(target)
+ }
+
+ fun showEntity(target: Entity) {
+ MC.sendChat(Text.translatable("firmament.poweruser.entity.type", target.type))
+ MC.sendChat(Text.translatable("firmament.poweruser.entity.name", target.name))
+ if (target is LivingEntity) {
+ MC.sendChat(Text.translatable("firmament.poweruser.entity.armor"))
+ for (armorItem in target.armorItems) {
+ MC.sendChat(Text.translatable("firmament.poweruser.entity.armor.item", debugFormat(armorItem)))
+ }
+ }
+ MC.sendChat(Text.stringifiedTranslatable("firmament.poweruser.entity.passengers", target.passengerList.size))
+ target.passengerList.forEach {
+ showEntity(target)
+ }
+ }
+
+
@Subscribe
fun copyInventoryInfo(it: HandledScreenKeyPressedEvent) {
if (it.screen !is AccessorHandledScreen) return