H0rn Posted August 14, 2017 Share Posted August 14, 2017 Sorry for noob question but how can I use sleep until for example sleep until my player hasnt animated in say 10 seconds? isAnimating() isn't reliable for furnaces etc :(? Quote Link to comment Share on other sites More sharing options...
IDontEB Posted August 14, 2017 Share Posted August 14, 2017 6 minutes ago, OllieW said: Sorry for noob question but how can I use sleep until for example sleep until my player hasnt animated in say 10 seconds? isAnimating() isn't reliable for furnaces etc :(? There's one of two ways to solve this: Either you get creative and look for something else to sleep for or create a method which sleeps until player hasnt animated for 10 seconds. Im pretty sure the first one would be easier for you. ex: check for items in inv or something Quote Link to comment Share on other sites More sharing options...
Deceiver Posted August 14, 2017 Share Posted August 14, 2017 sleepuntil() -> !getinv.contains(ore/bar), 30000 Quote Link to comment Share on other sites More sharing options...
Team Cape Posted August 14, 2017 Share Posted August 14, 2017 (edited) 1 hour ago, Deceiver said: sleepuntil() -> !getinv.contains(ore/bar), 30000 Do NOT do this. If anything goes wrong, you'll be sitting there for up to 30 seconds just doing nothing. I normally use a Timer class for the following code, but this will still work and maintains the same jist. Here is the pastebin because the forums won't let me post it: https://pastebin.com/7H9GYHcK Edit #2: For some reason, my last edit deleted everything I wrote (?) so I just rewrote it. Edited August 14, 2017 by Team Cape 3 1 Quote Link to comment Share on other sites More sharing options...
Juggles Posted August 14, 2017 Share Posted August 14, 2017 Sleep timer. I have a snippet posted in the Snippet section, might be a few pages back Quote Link to comment Share on other sites More sharing options...
dreameo Posted August 14, 2017 Share Posted August 14, 2017 (edited) For furnace, you would want to cond sleep when widget are null or no longer visible. You want to interact with furnace if you been idle for x seconds private boolean idleFor(int millis){ if(myPlayer().isAnimating()) { timeSinceAnimation = System.currentTimeMillis(); } else { timeSinceIdle = System.currentTimeMillis(); } return timeSinceAnimation + millis < timeSinceIdle; } variables are global Edited August 14, 2017 by dreameo Quote Link to comment Share on other sites More sharing options...