diff options
author | Linnea Gräf <nea@nea.moe> | 2025-03-15 17:52:35 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2025-03-15 17:52:35 +0100 |
commit | 03cf4e465cf6b3412f3c0990cb642bf5db264b4c (patch) | |
tree | d4fcb4d94d8ae2eba18849511c6863023278e518 /src/main/kotlin/features/debug/AnimatedClothingScanner.kt | |
parent | ce2e4f48d4631a48162203872f8fd87c5aeab49e (diff) | |
download | Firmament-03cf4e465cf6b3412f3c0990cb642bf5db264b4c.tar.gz Firmament-03cf4e465cf6b3412f3c0990cb642bf5db264b4c.tar.bz2 Firmament-03cf4e465cf6b3412f3c0990cb642bf5db264b4c.zip |
feat: Add dye logger for armor stands
Diffstat (limited to 'src/main/kotlin/features/debug/AnimatedClothingScanner.kt')
-rw-r--r-- | src/main/kotlin/features/debug/AnimatedClothingScanner.kt | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/main/kotlin/features/debug/AnimatedClothingScanner.kt b/src/main/kotlin/features/debug/AnimatedClothingScanner.kt new file mode 100644 index 0000000..11b47a9 --- /dev/null +++ b/src/main/kotlin/features/debug/AnimatedClothingScanner.kt @@ -0,0 +1,51 @@ +package moe.nea.firmament.features.debug + +import net.minecraft.component.DataComponentTypes +import net.minecraft.entity.Entity +import moe.nea.firmament.annotations.Subscribe +import moe.nea.firmament.commands.thenExecute +import moe.nea.firmament.commands.thenLiteral +import moe.nea.firmament.events.CommandEvent +import moe.nea.firmament.events.EntityUpdateEvent +import moe.nea.firmament.util.MC +import moe.nea.firmament.util.skyBlockId +import moe.nea.firmament.util.tr + +object AnimatedClothingScanner { + + var observedEntity: Entity? = null + + @OptIn(ExperimentalStdlibApi::class) + @Subscribe + fun onUpdate(event: EntityUpdateEvent) { + if (event.entity != observedEntity) return + if (event is EntityUpdateEvent.EquipmentUpdate) { + event.newEquipment.forEach { + val id = it.second.skyBlockId?.neuItem + val colour = it.second.get(DataComponentTypes.DYED_COLOR) + ?.rgb?.toHexString(HexFormat.UpperCase) + ?.let { " #$it" } ?: "" + MC.sendChat(tr("firmament.fitstealer.update", + "[FIT CHECK][${MC.currentTick}] ${it.first.asString()} => ${id}${colour}")) + } + } + } + + @Subscribe + fun onSubCommand(event: CommandEvent.SubCommand) { + event.subcommand("dev") { + thenLiteral("stealthisfit") { + thenExecute { + observedEntity = + if (observedEntity == null) MC.instance.targetedEntity else null + + MC.sendChat( + observedEntity?.let { + tr("firmament.fitstealer.targeted", "Observing the equipment of ${it.name}.") + } ?: tr("firmament.fitstealer.targetlost", "No longer logging equipment."), + ) + } + } + } + } +} |