Loads all DataBlocks stored by this BlockDataManager. Not supported for PDC. @return A CompletableFuture for the loading task.
()
| 350 | * @return A CompletableFuture for the loading task. |
| 351 | */ |
| 352 | public CompletableFuture<Void> loadAll() { |
| 353 | save(); |
| 354 | loading.values().forEach(f -> f.cancel(true)); |
| 355 | loading.clear(); |
| 356 | dataBlocks.clear(); |
| 357 | return backend.loadAll().thenApply(chunkMap -> { |
| 358 | chunkMap.forEach((cPos, data) -> { |
| 359 | JSONMap chunkData = JSONParser.parseMap(data); |
| 360 | dataBlocks.computeIfAbsent(cPos, k -> new HashMap<>()); |
| 361 | chunkData.keySet().forEach(bPos -> load(bPos, chunkData.getMap(bPos), cPos)); |
| 362 | }); |
| 363 | return null; |
| 364 | }); |
| 365 | } |
| 366 | |
| 367 | /** |
| 368 | * @return All DataBlocks currently loaded in this BlockDataManager |