From 2398dded541cc6f78b2fe1f80ab28fb33ca7ffe6 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Tue, 12 Jan 2016 12:28:29 +1100 Subject: [PATCH] Fix double jump resulting in extremely fast noclip. (Thanks BDlikes) --- ClassicalSharp/Entities/LocalPlayer.Physics.cs | 8 +++++--- ClassicalSharp/Entities/LocalPlayer.cs | 10 +++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ClassicalSharp/Entities/LocalPlayer.Physics.cs b/ClassicalSharp/Entities/LocalPlayer.Physics.cs index 933b51b1f..a434ead8d 100644 --- a/ClassicalSharp/Entities/LocalPlayer.Physics.cs +++ b/ClassicalSharp/Entities/LocalPlayer.Physics.cs @@ -10,7 +10,7 @@ namespace ClassicalSharp { bool useLiquidGravity = false; // used by BlockDefinitions. bool canLiquidJump = true; - bool firstJump = true, secondJump = true; + bool firstJump = false, secondJump = false; void UpdateVelocityState( float xMoving, float zMoving ) { if( !NoclipSlide && (noClip && xMoving == 0 && zMoving == 0) ) @@ -101,8 +101,10 @@ namespace ClassicalSharp { float yMul = Math.Max( 1f, multiply / 5 ) * modifier; float horMul = multiply * modifier; - if( !secondJump ) { horMul *= 93f; yMul *= 10f; } - else if( !firstJump ) { horMul *= 46.5f; yMul *= 7.5f; } + if( !(flying || noClip) ) { + if( secondJump ) { horMul *= 93f; yMul *= 10f; } + else if( firstJump ) { horMul *= 46.5f; yMul *= 7.5f; } + } if( TouchesAnyWater() && !flying && !noClip ) { MoveNormal( xMoving, zMoving, 0.02f * horMul, waterDrag, liquidGrav, yMul ); diff --git a/ClassicalSharp/Entities/LocalPlayer.cs b/ClassicalSharp/Entities/LocalPlayer.cs index 696cd8016..6e9dc72d9 100644 --- a/ClassicalSharp/Entities/LocalPlayer.cs +++ b/ClassicalSharp/Entities/LocalPlayer.cs @@ -116,7 +116,7 @@ namespace ClassicalSharp { HandleInput( ref xMoving, ref zMoving ); UpdateVelocityState( xMoving, zMoving ); PhysicsTick( xMoving, zMoving ); - if( onGround ) { firstJump = true; secondJump = true; } + if( onGround ) { firstJump = false; secondJump = false; } nextPos = Position; Position = lastPos; @@ -318,12 +318,12 @@ namespace ClassicalSharp { } else if( key == keys[KeyBinding.NoClip] && CanNoclip && HacksEnabled ) { noClip = !noClip; } else if( key == keys[KeyBinding.Jump] && !onGround && !(flying || noClip) ) { - if( firstJump && CanDoubleJump && DoubleJump ) { + if( !firstJump && CanDoubleJump && DoubleJump ) { DoNormalJump(); - firstJump = false; - } else if( secondJump && CanDoubleJump && DoubleJump ) { + firstJump = true; + } else if( !secondJump && CanDoubleJump && DoubleJump ) { DoNormalJump(); - secondJump = false; + secondJump = true; } } else { return false;