Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/main/java/xyz/nucleoid/fantasy/RuntimeWorldManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.registry.SimpleRegistry;
import net.minecraft.registry.entry.RegistryEntryInfo;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.world.ChunkTicketManager;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.text.Text;
import net.minecraft.util.ProgressListener;
Expand Down Expand Up @@ -47,6 +48,7 @@ RuntimeWorld add(RegistryKey<World> worldKey, RuntimeWorldConfig config, Runtime
((RemoveFromRegistry<?>) dimensionsRegistry).fantasy$setFrozen(isFrozen);

RuntimeWorld world = config.getWorldConstructor().createWorld(this.server, worldKey, config, style);
this.promoteForcedChunksToTickets(world);

this.serverAccess.getWorlds().put(world.getRegistryKey(), world);
ServerWorldEvents.LOAD.invoker().onWorldLoad(this.server, world);
Expand All @@ -57,6 +59,13 @@ RuntimeWorld add(RegistryKey<World> worldKey, RuntimeWorldConfig config, Runtime
return world;
}

private void promoteForcedChunksToTickets(ServerWorld world) {
ChunkTicketManager chunkTicketManager = world.getPersistentStateManager().get(ChunkTicketManager.STATE_TYPE);
if (chunkTicketManager != null) {
chunkTicketManager.promoteToRealTickets();
}
}

void delete(ServerWorld world) {
RegistryKey<World> dimensionKey = world.getRegistryKey();

Expand Down