mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-11-24 19:46:34 +01:00
Async flush AsyncWorld
This commit is contained in:
parent
e6dfdf0ecf
commit
01a7c9c388
@ -121,9 +121,19 @@ public class AsyncWorld extends DelegateFaweQueue implements World, HasFaweQueue
|
||||
}
|
||||
|
||||
public void changeWorld(World world, FaweQueue queue) {
|
||||
flush();
|
||||
this.parent = world;
|
||||
this.queue = queue;
|
||||
if (queue != this.queue) {
|
||||
if (this.queue != null) {
|
||||
final FaweQueue oldQueue = this.queue;
|
||||
TaskManager.IMP.async(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
oldQueue.flush();
|
||||
}
|
||||
});
|
||||
}
|
||||
this.queue = queue;
|
||||
}
|
||||
setParent(queue);
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ public class NMSRelighter implements Relighter{
|
||||
Map<Integer, Object> currentMap = lightQueue.get(index);
|
||||
if (currentMap == null) {
|
||||
currentMap = new Int2ObjectOpenHashMap<>();
|
||||
synchronized (lightQueue) {
|
||||
synchronized (this) {
|
||||
this.lightQueue.put(index, currentMap);
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public class WeakFaweQueueMap implements IFaweQueueMap {
|
||||
public Reference<FaweChunk> put(long key, Reference<FaweChunk> value) {
|
||||
if (parent.getProgressTask() != null) {
|
||||
try {
|
||||
parent.getProgressTask().run(FaweQueue.ProgressType.QUEUE, size() + 1);
|
||||
parent.getProgressTask().run(FaweQueue.ProgressType.QUEUE, size());
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user