Tweak NoSprint for better swimming behaviour

main
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.event.EventPhase
import codes.som.hibiscus.api.feature.Feature import codes.som.hibiscus.api.feature.Feature
import codes.som.hibiscus.api.feature.FeatureCategory 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.mc
import codes.som.hibiscus.mixins.MixinExtUpdatePlayerAbilitiesC2SPacket import codes.som.hibiscus.mixins.MixinExtUpdatePlayerAbilitiesC2SPacket
import codes.som.hibiscus.player 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) player.velocity = movement.multiply(0.25, 0.25, 0.25)
} }
on(cond = { mode != FlightMode.VANILLA }) { _: PlayerInputTickEvent -> on(cond = { mode != FlightMode.VANILLA }) { event: NetworkMovingEvent ->
// player.input.sneaking = false event.sneaking = false
} }
var lastMoveTime: Long = -1 var lastMoveTime: Long = -1

View File

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