feat: Add the ability to disable toggle sprint under water

This commit is contained in:
Linnea Gräf
2025-06-26 21:53:35 +02:00
parent 4627064699
commit 490790077f
2 changed files with 22 additions and 10 deletions

View File

@@ -11,6 +11,7 @@ import moe.nea.firmament.events.WorldKeyboardEvent
import moe.nea.firmament.features.FirmamentFeature import moe.nea.firmament.features.FirmamentFeature
import moe.nea.firmament.gui.config.ManagedConfig import moe.nea.firmament.gui.config.ManagedConfig
import moe.nea.firmament.util.MC import moe.nea.firmament.util.MC
import moe.nea.firmament.util.tr
object Fixes : FirmamentFeature { object Fixes : FirmamentFeature {
override val identifier: String override val identifier: String
@@ -20,6 +21,7 @@ object Fixes : FirmamentFeature {
val fixUnsignedPlayerSkins by toggle("player-skins") { true } val fixUnsignedPlayerSkins by toggle("player-skins") { true }
var autoSprint by toggle("auto-sprint") { false } var autoSprint by toggle("auto-sprint") { false }
val autoSprintKeyBinding by keyBindingWithDefaultUnbound("auto-sprint-keybinding") val autoSprintKeyBinding by keyBindingWithDefaultUnbound("auto-sprint-keybinding")
val autoSprintUnderWater by toggle("auto-sprint-underwater") { true }
val autoSprintHud by position("auto-sprint-hud", 80, 10) { Point(0.0, 1.0) } val autoSprintHud by position("auto-sprint-hud", 80, 10) { Point(0.0, 1.0) }
val peekChat by keyBindingWithDefaultUnbound("peek-chat") val peekChat by keyBindingWithDefaultUnbound("peek-chat")
val hidePotionEffects by toggle("hide-mob-effects") { false } val hidePotionEffects by toggle("hide-mob-effects") { false }
@@ -36,7 +38,11 @@ object Fixes : FirmamentFeature {
keyBinding: KeyBinding, keyBinding: KeyBinding,
cir: CallbackInfoReturnable<Boolean> cir: CallbackInfoReturnable<Boolean>
) { ) {
if (keyBinding === MinecraftClient.getInstance().options.sprintKey && TConfig.autoSprint && MC.player?.isSprinting != true) if (keyBinding !== MinecraftClient.getInstance().options.sprintKey) return
if (!TConfig.autoSprint) return
val player = MC.player ?: return
if (player.isSprinting) return
if (!TConfig.autoSprintUnderWater && player.isTouchingWater) return
cir.returnValue = true cir.returnValue = true
} }
@@ -46,13 +52,17 @@ object Fixes : FirmamentFeature {
it.context.matrices.push() it.context.matrices.push()
TConfig.autoSprintHud.applyTransformations(it.context.matrices) TConfig.autoSprintHud.applyTransformations(it.context.matrices)
it.context.drawText( it.context.drawText(
MC.font, Text.translatable( MC.font, (
if (TConfig.autoSprint) if (MC.player?.isSprinting == true) {
"firmament.fixes.auto-sprint.on" Text.translatable("firmament.fixes.auto-sprint.sprinting")
else if (MC.player?.isSprinting == true) } else if (TConfig.autoSprint) {
"firmament.fixes.auto-sprint.sprinting" if (!TConfig.autoSprintUnderWater && MC.player?.isTouchingWater == true)
tr("firmament.fixes.auto-sprint.under-water", "In Water")
else else
"firmament.fixes.auto-sprint.not-sprinting" Text.translatable("firmament.fixes.auto-sprint.on")
} else {
Text.translatable("firmament.fixes.auto-sprint.not-sprinting")
}
), 0, 0, -1, true ), 0, 0, -1, true
) )
it.context.matrices.pop() it.context.matrices.pop()

View File

@@ -124,6 +124,8 @@
"firmament.config.fixes.auto-sprint-hud.description": "Show your current sprint state on your screen. Only visible if no auto sprint keybind is set.", "firmament.config.fixes.auto-sprint-hud.description": "Show your current sprint state on your screen. Only visible if no auto sprint keybind is set.",
"firmament.config.fixes.auto-sprint-keybinding": "Auto Sprint KeyBinding", "firmament.config.fixes.auto-sprint-keybinding": "Auto Sprint KeyBinding",
"firmament.config.fixes.auto-sprint-keybinding.description": "Toggle auto sprint via this keybinding.", "firmament.config.fixes.auto-sprint-keybinding.description": "Toggle auto sprint via this keybinding.",
"firmament.config.fixes.auto-sprint-underwater": "Sprint Under Water",
"firmament.config.fixes.auto-sprint-underwater.description": "Also Toggle Sprint under water. Sprinting under water puts you in the swimming animation which changes your camera and hitbox, which can be confusing if you stop and start moving a lot.",
"firmament.config.fixes.auto-sprint.description": "This is different from vanilla sprint in the way that it only marks the keybinding pressed for the first tick of walking.", "firmament.config.fixes.auto-sprint.description": "This is different from vanilla sprint in the way that it only marks the keybinding pressed for the first tick of walking.",
"firmament.config.fixes.disable-hurt-cam": "No Hurt Cam", "firmament.config.fixes.disable-hurt-cam": "No Hurt Cam",
"firmament.config.fixes.disable-hurt-cam.description": "Disable the damage screen shake animation.", "firmament.config.fixes.disable-hurt-cam.description": "Disable the damage screen shake animation.",