mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2025-01-14 12:11:46 +01:00
Invalidate chunk-cache after a world-save, not directly with the block-change event
To prevent the chunk being loaded again before the changes are being saved to disk.
This commit is contained in:
parent
41a782528d
commit
e8fc7028d0
@ -60,6 +60,12 @@ public void onWorldSaveToDisk(final UUID world) {
|
||||
while (iterator.hasNext()) {
|
||||
MapType map = iterator.next();
|
||||
if (map.getWorld().getUUID().equals(world)) {
|
||||
|
||||
//invalidate caches of updated chunks
|
||||
for (Vector2i chunk : updateBuffer.get(map)) {
|
||||
map.getWorld().invalidateChunkCache(chunk);
|
||||
}
|
||||
|
||||
renderManager.createTickets(map, updateBuffer.get(map));
|
||||
iterator.remove();
|
||||
}
|
||||
@ -111,8 +117,6 @@ private void updateBlock(UUID world, Vector3i pos){
|
||||
synchronized (updateBuffer) {
|
||||
for (MapType mapType : plugin.getMapTypes()) {
|
||||
if (mapType.getWorld().getUUID().equals(world)) {
|
||||
mapType.getWorld().invalidateChunkCache(mapType.getWorld().blockPosToChunkPos(pos));
|
||||
|
||||
Vector2i tile = mapType.getTileRenderer().getHiresModelManager().posToTile(pos);
|
||||
updateBuffer.put(mapType, tile);
|
||||
}
|
||||
@ -129,6 +133,12 @@ public void flushTileBuffer() {
|
||||
|
||||
synchronized (updateBuffer) {
|
||||
for (MapType map : updateBuffer.keySet()) {
|
||||
|
||||
//invalidate caches of updated chunks
|
||||
for (Vector2i chunk : updateBuffer.get(map)) {
|
||||
map.getWorld().invalidateChunkCache(chunk);
|
||||
}
|
||||
|
||||
renderManager.createTickets(map, updateBuffer.get(map));
|
||||
}
|
||||
updateBuffer.clear();
|
||||
|
Loading…
Reference in New Issue
Block a user