From ddaebf403b0c47777e30bad42726bcc78fe28783 Mon Sep 17 00:00:00 2001 From: Ruslan Mykhailenko Date: Sat, 11 May 2024 17:27:00 +0300 Subject: [PATCH] refactor: check player pitch on each sneak --- .../kotlin/dev/rvbsm/fsit/event/ClientCommandCallback.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/dev/rvbsm/fsit/event/ClientCommandCallback.kt b/src/main/kotlin/dev/rvbsm/fsit/event/ClientCommandCallback.kt index a9662885..a97e4b79 100644 --- a/src/main/kotlin/dev/rvbsm/fsit/event/ClientCommandCallback.kt +++ b/src/main/kotlin/dev/rvbsm/fsit/event/ClientCommandCallback.kt @@ -33,8 +33,9 @@ fun interface ClientCommandCallback { if (mode != ClientCommandC2SPacket.Mode.RELEASE_SHIFT_KEY || !player.isOnGround) return val config = player.getConfig().onDoubleSneak.takeUnless { !it.sitting && !it.crawling } ?: return + if (player.pitch < config.minPitch) return - if (player.uuid !in sneaks && player.pitch > config.minPitch) { + if (player.uuid !in sneaks) { createSneak(player.uuid, config.delay).thenAcceptAsync { when { it && config.crawling && player.isNearGap() -> player.setPose(PlayerPose.Crawling) @@ -66,9 +67,8 @@ fun interface ClientCommandCallback { Direction.fromRotation(yaw.toDouble()).offsetZ * 0.1, ) - return world.isSpaceEmpty( - this, crawlingDimensions.getBoxAt(expectEmptyAt).contract(1.0e-6) - ) && !world.isSpaceEmpty(this, crawlingDimensions.getBoxAt(expectFullAt).contract(1.0e-6)) + return world.isSpaceEmpty(this, crawlingDimensions.getBoxAt(expectEmptyAt).contract(1.0e-6)) && + !world.isSpaceEmpty(this, crawlingDimensions.getBoxAt(expectFullAt).contract(1.0e-6)) } } }