Skip to content

Commit

Permalink
refactor: check player pitch on each sneak
Browse files Browse the repository at this point in the history
  • Loading branch information
rvbsm committed May 12, 2024
1 parent aa73e12 commit ddaebf4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/kotlin/dev/rvbsm/fsit/event/ClientCommandCallback.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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))
}
}
}

0 comments on commit ddaebf4

Please sign in to comment.