use of io.izzel.arclight.common.bridge.world.dimension.DimensionTypeBridge in project Arclight by IzzelAliz.
the class MinecraftServerMixin method loadSpawn.
public void loadSpawn(IChunkStatusListener listener, ServerWorld serverWorld) {
if (!((WorldBridge) serverWorld).bridge$getWorld().getKeepSpawnInMemory()) {
return;
}
this.setUserMessage(new TranslationTextComponent("menu.generatingTerrain"));
this.forceTicks = true;
LOGGER.info("Preparing start region for dimension '{}'/{}", serverWorld.getWorldInfo().getWorldName(), DimensionType.getKey(((DimensionTypeBridge) serverWorld.dimension.getType()).bridge$getType()));
BlockPos pos = serverWorld.getSpawnPoint();
listener.start(new ChunkPos(pos));
ServerChunkProvider chunkProvider = serverWorld.getChunkProvider();
chunkProvider.getLightManager().func_215598_a(500);
this.serverTime = Util.milliTime();
chunkProvider.registerTicket(TicketType.START, new ChunkPos(pos), 11, Unit.INSTANCE);
while (chunkProvider.getLoadedChunksCount() != 441) {
this.executeModerately();
}
this.executeModerately();
DimensionType type = serverWorld.dimension.getType();
ForcedChunksSaveData chunks = serverWorld.getSavedData().get(ForcedChunksSaveData::new, "chunks");
if (chunks != null) {
ServerWorld world = this.getWorld(type);
LongIterator iterator = chunks.getChunks().iterator();
while (iterator.hasNext()) {
long i = iterator.nextLong();
ChunkPos chunkPos = new ChunkPos(i);
world.getChunkProvider().forceChunk(chunkPos, true);
}
}
this.executeModerately();
listener.stop();
chunkProvider.getLightManager().func_215598_a(5);
this.forceTicks = false;
}
Aggregations