Skip to content

Commit

Permalink
disable auto chunk loading for both copied worlds and template worlds
Browse files Browse the repository at this point in the history
  • Loading branch information
Steanky committed Jul 30, 2023
1 parent 39e926d commit 2a07d71
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public FileSystemInstanceLoader(@NotNull InstanceManager instanceManager, @NotNu
}

return CompletableFuture.supplyAsync(source::copy, executor).thenApply(container -> {
container.enableAutoChunkLoad(false);
container.setChunkSupplier(chunkSupplier);
instanceManager.registerInstance(container);

Expand All @@ -88,6 +89,7 @@ private InstanceContainer createTemplateContainer(InstanceManager instanceManage
int chunkViewDistance) {
InstanceContainer container =
new InstanceContainer(UUID.randomUUID(), DimensionType.OVERWORLD, createChunkLoader(path));
container.enableAutoChunkLoad(false);
container.setChunkSupplier(chunkSupplier);

awaitChunkLoadSync(container, spawnPoint, chunkViewDistance);
Expand All @@ -99,7 +101,7 @@ private void awaitChunkLoadSync(Instance instance, Point spawnPoint, int chunkVi
Phaser phaser = new Phaser(1);
ChunkUtils.forChunksInRange(spawnPoint, chunkViewDistance, (chunkX, chunkZ) -> {
phaser.register();
instance.loadOptionalChunk(chunkX, chunkZ).whenComplete((chunk, throwable) -> phaser.arriveAndDeregister());
instance.loadChunk(chunkX, chunkZ).whenComplete((chunk, throwable) -> phaser.arriveAndDeregister());
});
phaser.arriveAndAwaitAdvance();
}
Expand Down
2 changes: 1 addition & 1 deletion minestom
6 changes: 3 additions & 3 deletions server/src/main/java/org/phantazm/server/ZombiesFeature.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ static void initialize(@NotNull EventNode<Event> globalEventNode, @NotNull Conte

ZombiesFeature.sceneRouter = new ZombiesSceneRouter(providers);

MinecraftServer.getSchedulerManager()
.scheduleTask(() -> sceneRouter.tick(System.currentTimeMillis()), TaskSchedule.immediate(),
TaskSchedule.nextTick());
MinecraftServer.getSchedulerManager().scheduleTask(() -> {
sceneRouter.tick(System.currentTimeMillis());
}, TaskSchedule.immediate(), TaskSchedule.nextTick());

commandManager.register(
new ZombiesCommand(parties, sceneRouter, keyParser, maps, viewProvider, sceneTransferHelper,
Expand Down

0 comments on commit 2a07d71

Please sign in to comment.