In my attempts to fix the piston-not-smoothly-extending-retracting bug, I have found that the animation is only played if the server sends the Block Action packet, waits until the animation has finished client side, and then sends the extension arm block update. It goes: Piston Base update -> Anim Packet -> pause -> Piston arm update
So... I need a way to pause the extension / retraction function in C++ for around half a second without user input or locking everything up or derpy stuff like that.
How would I do it? Tried with system("pause") in Windows and it works, but requires user interaction so it's obviously not the solution.
Edit: this works, is it good practice?
So... I need a way to pause the extension / retraction function in C++ for around half a second without user input or locking everything up or derpy stuff like that.
How would I do it? Tried with system("pause") in Windows and it works, but requires user interaction so it's obviously not the solution.
Edit: this works, is it good practice?
Code:
#ifdef _WIN32
#include <windows.h>
Sleep(500);
#else
#include <unistd.h>
usleep(500* 1000);
#endif