Tweak NoSprint for better swimming behaviour

This commit is contained in:
Charlotte Som 2022-03-17 03:41:46 +00:00
parent 15323b2e4d
commit d6ff81fb16
2 changed files with 7 additions and 4 deletions

View file

@ -3,7 +3,10 @@ package codes.som.hibiscus.features.movement
import codes.som.hibiscus.api.event.EventPhase
import codes.som.hibiscus.api.feature.Feature
import codes.som.hibiscus.api.feature.FeatureCategory
import codes.som.hibiscus.events.*
import codes.som.hibiscus.events.MovePlayerEvent
import codes.som.hibiscus.events.NetworkMovingEvent
import codes.som.hibiscus.events.PlayerTickEvent
import codes.som.hibiscus.events.SendPacketEvent
import codes.som.hibiscus.mc
import codes.som.hibiscus.mixins.MixinExtUpdatePlayerAbilitiesC2SPacket
import codes.som.hibiscus.player
@ -51,8 +54,8 @@ class Flight : Feature("Flight", FeatureCategory.MOVEMENT) {
player.velocity = movement.multiply(0.25, 0.25, 0.25)
}
on(cond = { mode != FlightMode.VANILLA }) { _: PlayerInputTickEvent ->
// player.input.sneaking = false
on(cond = { mode != FlightMode.VANILLA }) { event: NetworkMovingEvent ->
event.sneaking = false
}
var lastMoveTime: Long = -1

View file

@ -7,7 +7,7 @@ import codes.som.hibiscus.player
class NoSprintingPacket : Feature("No Sprinting Packet", FeatureCategory.PLAYER) {
init {
on<NetworkMovingEvent>(cond = { !player.isTouchingWater }) {
on<NetworkMovingEvent>(cond = { !player.isSubmergedInWater && !player.isSwimming }) {
it.sprinting = false
}