mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-09-29 23:57:35 +02: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()) {
|
while (iterator.hasNext()) {
|
||||||
MapType map = iterator.next();
|
MapType map = iterator.next();
|
||||||
if (map.getWorld().getUUID().equals(world)) {
|
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));
|
renderManager.createTickets(map, updateBuffer.get(map));
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
@ -111,8 +117,6 @@ private void updateBlock(UUID world, Vector3i pos){
|
|||||||
synchronized (updateBuffer) {
|
synchronized (updateBuffer) {
|
||||||
for (MapType mapType : plugin.getMapTypes()) {
|
for (MapType mapType : plugin.getMapTypes()) {
|
||||||
if (mapType.getWorld().getUUID().equals(world)) {
|
if (mapType.getWorld().getUUID().equals(world)) {
|
||||||
mapType.getWorld().invalidateChunkCache(mapType.getWorld().blockPosToChunkPos(pos));
|
|
||||||
|
|
||||||
Vector2i tile = mapType.getTileRenderer().getHiresModelManager().posToTile(pos);
|
Vector2i tile = mapType.getTileRenderer().getHiresModelManager().posToTile(pos);
|
||||||
updateBuffer.put(mapType, tile);
|
updateBuffer.put(mapType, tile);
|
||||||
}
|
}
|
||||||
@ -129,6 +133,12 @@ public void flushTileBuffer() {
|
|||||||
|
|
||||||
synchronized (updateBuffer) {
|
synchronized (updateBuffer) {
|
||||||
for (MapType map : updateBuffer.keySet()) {
|
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));
|
renderManager.createTickets(map, updateBuffer.get(map));
|
||||||
}
|
}
|
||||||
updateBuffer.clear();
|
updateBuffer.clear();
|
||||||
|
Loading…
Reference in New Issue
Block a user