Posted April 1, 20205 yr I am currently using Java's built in Timer for my code, however I am facing problems such as it still running whilst the game is paused. Is there a built in Timer for forge? In my case, I need: A timer that runs code after a fixed time E.g when a key is pressed, wait five seconds then do something A timer that runs code every tick for a fixed time E.g when a key is pressed, do something constantly for five seconds Any Help would be greatly appreciated! - Roman Edit: This is my first mod so if anything seems too obvious, please share because I'll have learned something! Edited April 1, 20205 yr by ultra_reemun Experience
April 1, 20205 yr Author 4 minutes ago, diesieben07 said: Note that your current code is inherently broken, because it uses a separate thread and thus will break Minecraft's single-threaded assumptions. Usually when you need delays you use a tick event and count ticks. Thanks for pointing that out, I didn't realise the implications. I will look into Forge's tick events as I'm new to modding Minecraft. Thanks for the help! Edited April 1, 20205 yr by ultra_reemun Half asleep
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.