feat: add FPS, day count and ping huds
This commit is contained in:
@@ -29,6 +29,7 @@ import moe.nea.firmament.features.inventory.buttons.InventoryButtons
|
||||
import moe.nea.firmament.features.inventory.storageoverlay.StorageOverlay
|
||||
import moe.nea.firmament.features.mining.PickaxeAbility
|
||||
import moe.nea.firmament.features.mining.PristineProfitTracker
|
||||
import moe.nea.firmament.features.misc.Hud
|
||||
import moe.nea.firmament.features.world.FairySouls
|
||||
import moe.nea.firmament.features.world.Waypoints
|
||||
import moe.nea.firmament.util.compatloader.ICompatMeta
|
||||
@@ -67,6 +68,7 @@ object FeatureManager : DataHolder<FeatureManager.Config>(serializer(), "feature
|
||||
loadFeature(SaveCursorPosition)
|
||||
loadFeature(PriceData)
|
||||
loadFeature(Fixes)
|
||||
loadFeature(Hud)
|
||||
loadFeature(DianaWaypoints)
|
||||
loadFeature(ItemRarityCosmetics)
|
||||
loadFeature(PickaxeAbility)
|
||||
|
||||
77
src/main/kotlin/features/misc/Hud.kt
Normal file
77
src/main/kotlin/features/misc/Hud.kt
Normal file
@@ -0,0 +1,77 @@
|
||||
package moe.nea.firmament.features.misc
|
||||
|
||||
import moe.nea.firmament.annotations.Subscribe
|
||||
import moe.nea.firmament.events.HudRenderEvent
|
||||
import moe.nea.firmament.features.FirmamentFeature
|
||||
import moe.nea.firmament.gui.config.ManagedConfig
|
||||
import moe.nea.firmament.util.MC
|
||||
import moe.nea.firmament.util.tr
|
||||
import moe.nea.jarvis.api.Point
|
||||
import net.minecraft.client.network.PlayerListEntry
|
||||
import net.minecraft.text.Text
|
||||
|
||||
object Hud : FirmamentFeature {
|
||||
override val identifier: String
|
||||
get() = "hud"
|
||||
|
||||
object TConfig : ManagedConfig(identifier, Category.MISC) {
|
||||
var dayCount by toggle("day-count") { false }
|
||||
val dayCountHud by position("day-count-hud", 80, 10) { Point(0.5, 0.8) }
|
||||
var fpsCount by toggle("fps-count") { false }
|
||||
val fpsCountHud by position("fps-count-hud", 80, 10) { Point(0.5, 0.9) }
|
||||
var pingCount by toggle("ping-count") { false }
|
||||
val pingCountHud by position("ping-count-hud", 80, 10) { Point(0.5, 1.0) }
|
||||
}
|
||||
|
||||
override val config: ManagedConfig
|
||||
get() = TConfig
|
||||
|
||||
@Subscribe
|
||||
fun onRenderHud(it: HudRenderEvent) {
|
||||
if (TConfig.dayCount) {
|
||||
it.context.matrices.push()
|
||||
TConfig.dayCountHud.applyTransformations(it.context.matrices)
|
||||
val day = (MC.world?.timeOfDay ?: 0L) / 24000
|
||||
it.context.drawText(
|
||||
MC.font,
|
||||
Text.literal(String.format(tr("firmament.config.hud.day-count-hud.display", "Day: %s").string, day)),
|
||||
36,
|
||||
MC.font.fontHeight,
|
||||
-1,
|
||||
true
|
||||
)
|
||||
it.context.matrices.pop()
|
||||
}
|
||||
|
||||
if (TConfig.fpsCount) {
|
||||
it.context.matrices.push()
|
||||
TConfig.fpsCountHud.applyTransformations(it.context.matrices)
|
||||
it.context.drawText(
|
||||
MC.font, Text.literal(
|
||||
String.format(
|
||||
tr("firmament.config.hud.fps-count-hud.display", "FPS: %s").string, MC.instance.currentFps
|
||||
)
|
||||
), 36, MC.font.fontHeight, -1, true
|
||||
)
|
||||
it.context.matrices.pop()
|
||||
}
|
||||
|
||||
if (TConfig.pingCount) {
|
||||
it.context.matrices.push()
|
||||
TConfig.pingCountHud.applyTransformations(it.context.matrices)
|
||||
val ping = MC.player?.let {
|
||||
val entry: PlayerListEntry? = MC.networkHandler?.getPlayerListEntry(it.uuid)
|
||||
entry?.latency ?: -1
|
||||
} ?: -1
|
||||
it.context.drawText(
|
||||
MC.font, Text.literal(
|
||||
String.format(
|
||||
tr("firmament.config.hud.ping-count-hud.display", "Ping: %s ms").string, ping
|
||||
)
|
||||
), 36, MC.font.fontHeight, -1, true
|
||||
)
|
||||
|
||||
it.context.matrices.pop()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -137,6 +137,21 @@
|
||||
"firmament.config.fixes.peek-chat.description": "Hold this keybinding to view the chat as if you have it opened, but while still being able to control your character.",
|
||||
"firmament.config.fixes.player-skins": "Fix unsigned Player Skins",
|
||||
"firmament.config.fixes.player-skins.description": "Mark all player skins as signed, preventing console spam, and some rendering issues.",
|
||||
"firmament.config.hud": "Hud",
|
||||
"firmament.config.hud.day-count": "Day Count",
|
||||
"firmament.config.hud.day-count-hud": "Day Count Hud",
|
||||
"firmament.config.hud.day-count-hud.description": "Shows day.",
|
||||
"firmament.config.hud.day-count-hud.display": "Day: %s",
|
||||
"firmament.config.hud.day-count.description": "A HUD showing current day.",
|
||||
"firmament.config.hud.fps-count": "FPS Count",
|
||||
"firmament.config.hud.fps-count-hud": "FPS Count Hud",
|
||||
"firmament.config.hud.fps-count-hud.description": "Shows FPS.",
|
||||
"firmament.config.hud.fps-count-hud.display": "FPS: %s",
|
||||
"firmament.config.hud.fps-count.description": "A HUD showing current FPS.",
|
||||
"firmament.config.hud.ping-count": "Ping Count",
|
||||
"firmament.config.hud.ping-count-hud": "Ping Count Hud",
|
||||
"firmament.config.hud.ping-count-hud.description": "Shows Ping.",
|
||||
"firmament.config.hud.ping-count-hud.display": "Ping %s",
|
||||
"firmament.config.inventory-buttons-config": "Inventory Buttons",
|
||||
"firmament.config.inventory-buttons-config.hover-text": "Hover Tooltip",
|
||||
"firmament.config.inventory-buttons-config.hover-text.description": "Hovering over inventory buttons will show the command they run.",
|
||||
|
||||
Reference in New Issue
Block a user