feat: Add the ability to disable toggle sprint under water
This commit is contained in:
@@ -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,8 +38,12 @@ 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
|
||||||
cir.returnValue = true
|
if (!TConfig.autoSprint) return
|
||||||
|
val player = MC.player ?: return
|
||||||
|
if (player.isSprinting) return
|
||||||
|
if (!TConfig.autoSprintUnderWater && player.isTouchingWater) return
|
||||||
|
cir.returnValue = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@@ -46,14 +52,18 @@ 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)
|
||||||
else
|
tr("firmament.fixes.auto-sprint.under-water", "In Water")
|
||||||
"firmament.fixes.auto-sprint.not-sprinting"
|
else
|
||||||
), 0, 0, -1, true
|
Text.translatable("firmament.fixes.auto-sprint.on")
|
||||||
|
} else {
|
||||||
|
Text.translatable("firmament.fixes.auto-sprint.not-sprinting")
|
||||||
|
}
|
||||||
|
), 0, 0, -1, true
|
||||||
)
|
)
|
||||||
it.context.matrices.pop()
|
it.context.matrices.pop()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.",
|
||||||
|
|||||||
Reference in New Issue
Block a user