I need to add delay without using Thread.sleep() or a while loop doing nothing. The game im editing(Minecraft) clock runs on "Ticks" but they can fluctuate depending on your FPS.
public void onTick() {//Called every "Tick"
if(variable){ //If my variable is true
boolean = true; //Setting my boolean to true
/**
*Doing a bunch of things.
**/
//I need a delay for about one second here.
boolean = false; //Setting my boolean to false;
}
}
The reason why i need a delay is because if i dont have one the code runs too fast and misses it and does not toggle.