This commit is contained in:
Anuken
2020-05-02 23:15:36 -04:00
parent cb6920b8be
commit dd68241d1f
7 changed files with 40 additions and 21 deletions

View File

@@ -41,27 +41,31 @@ public class AsyncLogic{
}
public void begin(){
//sync begin
for(AsyncProcess p : processes){
p.begin();
}
if(Vars.state.isPlaying()){
//sync begin
for(AsyncProcess p : processes){
p.begin();
}
futures.clear();
futures.clear();
//submit all tasks
for(AsyncProcess p : processes){
if(p.shouldProcess()){
futures.add(executor.submit(p::process));
//submit all tasks
for(AsyncProcess p : processes){
if(p.shouldProcess()){
futures.add(executor.submit(p::process));
}
}
}
}
public void end(){
complete();
if(Vars.state.isPlaying()){
complete();
//sync end (flush data)
for(AsyncProcess p : processes){
p.end();
//sync end (flush data)
for(AsyncProcess p : processes){
p.end();
}
}
}