mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2025-02-17 21:11:26 +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) {
|
public void changeWorld(World world, FaweQueue queue) {
|
||||||
flush();
|
|
||||||
this.parent = world;
|
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);
|
setParent(queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ public class NMSRelighter implements Relighter{
|
|||||||
Map<Integer, Object> currentMap = lightQueue.get(index);
|
Map<Integer, Object> currentMap = lightQueue.get(index);
|
||||||
if (currentMap == null) {
|
if (currentMap == null) {
|
||||||
currentMap = new Int2ObjectOpenHashMap<>();
|
currentMap = new Int2ObjectOpenHashMap<>();
|
||||||
synchronized (lightQueue) {
|
synchronized (this) {
|
||||||
this.lightQueue.put(index, currentMap);
|
this.lightQueue.put(index, currentMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ public class WeakFaweQueueMap implements IFaweQueueMap {
|
|||||||
public Reference<FaweChunk> put(long key, Reference<FaweChunk> value) {
|
public Reference<FaweChunk> put(long key, Reference<FaweChunk> value) {
|
||||||
if (parent.getProgressTask() != null) {
|
if (parent.getProgressTask() != null) {
|
||||||
try {
|
try {
|
||||||
parent.getProgressTask().run(FaweQueue.ProgressType.QUEUE, size() + 1);
|
parent.getProgressTask().run(FaweQueue.ProgressType.QUEUE, size());
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user