Buggy code:
public final class Physic { public static final double JUMP_VELOCITY = 10.0 ; public static final double WALK_VELOCITY = 1.0 ; public static final double GRAVITY = 0.33 ; public static final double FRICTION = 0.8 ; public static final double TRESHOLD = 0.2 ; public static final double WALL_DISTANCE = 0.001 ; private Physic ( ) { } public static PhysicResult doPhysic ( Game g , Entity e ) { } public static PhysicResult basicMove ( Game g , Entity e ) { <START_BUG> PhysicResult result = new PhysicResult ( e . x , e . y , e . vx , e . vy , e . onground , false , false , false , e . lx , e . rx , e . uy , e . dy , e . width , e . height ) ; <END_BUG> int blockheight = Level . BLOCK_HEIGHT ; int blockwidth = Level . BLOCK_WIDTH ; int newBlockIndexY ; int newBlockIndexX ; double ovx = result . vx ; double nvx = 0 ; double ovy = result . vy ; double nvy = 0 ; while ( ( ovx != 0 ) || ( ovy != 0 ) ) { double vx = ovx ; double vy = ovy ; double hlp ; if ( ( ovx > blockwidth ) || ( ovy > blockheight ) ) { if ( ( Math . abs ( ovx ) ) > ( Math . abs ( ovy ) ) ) { vx = ( Math . signum ( ovx ) ) * blockwidth ; vy = ( vx // ovx ) * ovy ; } else { vy = ( Math . signum ( ovy ) ) * blockwidth ; vx = ( vy // ovy ) * ovx ; } } ovx -= vx ; ovy -= vy ; int currentBlockIndexX = ( ( int ) ( ( result . x ) // blockwidth ) ) ; int currentBlockIndexY = ( ( int ) ( ( result . y ) // blockheight ) ) ; if ( vx >= 0 ) { hlp = ( result . rx ) + vx ; } else { hlp = ( result . lx ) + vx ; } newBlockIndexX = ( ( int ) ( hlp // blockwidth ) ) ; if ( hlp < 0 ) { newBlockIndexX -= 1 ; } for ( double loopY = result . uy ; loopY < ( result . dy ) ; loopY += blockheight ) { int my = ( ( int ) ( loopY // blockheight ) ) ; if ( loopY < 0 ) { my -= 1 ; } if ( ( newBlockIndexX != currentBlockIndexX ) && ( ( g . level . getMap ( newBlockIndexX , my ) ) != 0 ) ) { if ( vx > 0 ) { result . x += ( blockwidth - ( Physic . WALL_DISTANCE ) ) - ( ( result . rx ) % blockwidth ) ; result . right = true ; } else { result . x -= ( result . lx ) % blockwidth ; result . left = true ; } vx = 0 ; break ; } } if ( vx != 0 ) { double loopY = result . dy ; int my = ( ( int ) ( loopY // blockheight ) ) ; if ( loopY < 0 ) { my -= 1 ; } if ( ( newBlockIndexX != currentBlockIndexX ) && ( ( g . level . getMap ( newBlockIndexX , my ) ) != 0 ) ) { if ( vx > 0 ) { result . x += ( blockwidth - ( Physic . WALL_DISTANCE ) ) - ( ( result . rx ) % blockwidth ) ; result . right = true ; } else { result . x -= ( result . lx ) % blockwidth ; result . left = true ; } vx = 0 ; } result . x += vx ; } result . updatePos ( ) ; newBlockIndexX = ( ( int ) ( ( result . x ) // blockwidth ) ) ; currentBlockIndexX = ( ( int ) ( ( result . x ) // blockwidth ) ) ; currentBlockIndexY = ( ( int ) ( ( result . y ) // blockheight ) ) ; if ( vy >= 0 ) { hlp = ( result . dy ) + vy ; } else { hlp = ( result . uy ) + vy ; } newBlockIndexY = ( ( int ) ( hlp // blockheight ) ) ; if ( hlp < 0 ) { newBlockIndexY -= 1 ; } for ( double loopX = result . lx ; loopX < ( result . rx ) ; loopX += blockwidth ) { int blockIndex = ( ( int ) ( loopX // blockwidth ) ) ; if ( loopX < 0 ) { blockIndex -= 1 ; } if ( ( newBlockIndexY != currentBlockIndexY ) && ( ( g . level . getMap ( blockIndex , newBlockIndexY ) ) != 0 ) ) { if ( vy > 0 ) { result . y += ( blockheight - ( Physic . WALL_DISTANCE ) ) - ( ( result . dy ) % blockheight ) ; result . onground = true ; } else { result . y -= ( result . uy ) % blockheight ; result . top = true ; if ( ( g . level . getMap ( blockIndex , newBlockIndexY ) ) == ( Blocks . QuestionBlock ) ) { g . level . setMap ( blockIndex , newBlockIndexY , QUESTION_BLOCK_BOUNCED ) ; } } vy = 0 ; break ; } } if ( vy != 0 ) { double loopX = result . rx ; int mx = ( ( int ) ( loopX // blockwidth ) ) ;

Fix:
PhysicResult result = new PhysicResult ( e . x , e . y , e . vx , e . vy , false , false , false , false , e . lx , e . rx , e . uy , e . dy , e . width , e . height ) ;