This is a snippet from Minecraft that I am trying to understand, there seems to be two conditionals which conflict each other
The labeled if statement requires var3 to be false and (this.movementInput.moveForward >= var2) to be true, but var3 is (this.movementInput.moveForward >= var2) so it reads as if the statement will always evaluate to false because the second and third conditionals will never be the same
boolean var3 = this.movementInput.moveForward >= var2; //evaluates to true if moving which I am for the purpose of this
boolean var4 = true; //cut out bit which evaluates to true
if (this.onGround && !var3 && this.movementInput.moveForward >= var2 && !this.isSprinting() && var4) //This line is confusing me since the second and third conditional conflict
{
}
If the conditional evaluates true then it sets a counter to detect a double tap to enable sprint. Since sprint works then somehow this evaluates to true. I have seen this kind of code appear several times in Minecraft and I can't understand how on earth the same condition evaluates to true and false at the same time unless its the health of Schrodinger's cat.
There are also other several unnecessary lines of code and its weird because I thought Minecraft lagged because Java sucks.
I looked at it in a debugger and it says that somehow it evaluates to true if the jump button is pressed, so I assume the input is being updated by another thread whilst this code running