From 2a07d717fbdb5f6b5597af848c9609463c6013fb Mon Sep 17 00:00:00 2001 From: steank Date: Sun, 30 Jul 2023 09:23:26 -0700 Subject: [PATCH] disable auto chunk loading for both copied worlds and template worlds --- .../phantazm/core/instance/FileSystemInstanceLoader.java | 4 +++- minestom | 2 +- .../src/main/java/org/phantazm/server/ZombiesFeature.java | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/org/phantazm/core/instance/FileSystemInstanceLoader.java b/core/src/main/java/org/phantazm/core/instance/FileSystemInstanceLoader.java index 6d7eb9451..5f975c395 100644 --- a/core/src/main/java/org/phantazm/core/instance/FileSystemInstanceLoader.java +++ b/core/src/main/java/org/phantazm/core/instance/FileSystemInstanceLoader.java @@ -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); @@ -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); @@ -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(); } diff --git a/minestom b/minestom index e400a1de1..5916290c0 160000 --- a/minestom +++ b/minestom @@ -1 +1 @@ -Subproject commit e400a1de178b88ef769393a4d6c2acd7a802c582 +Subproject commit 5916290c0ce29abd070c121791e6518569f9158a diff --git a/server/src/main/java/org/phantazm/server/ZombiesFeature.java b/server/src/main/java/org/phantazm/server/ZombiesFeature.java index 7555ef42b..e7e42082a 100644 --- a/server/src/main/java/org/phantazm/server/ZombiesFeature.java +++ b/server/src/main/java/org/phantazm/server/ZombiesFeature.java @@ -176,9 +176,9 @@ static void initialize(@NotNull EventNode 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,