use of net.minecraft.world.ForcedChunksSaveData 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;
}
use of net.minecraft.world.ForcedChunksSaveData in project Arclight by IzzelAliz.
the class MinecraftServerMixin method loadInitialChunks.
/**
* @author IzzelAliz
* @reason
*/
@Overwrite
public void loadInitialChunks(IChunkStatusListener listener) {
this.setUserMessage(new TranslationTextComponent("menu.generatingTerrain"));
ServerWorld serverworld = this.getWorld(DimensionType.OVERWORLD);
this.forceTicks = true;
LOGGER.info("Preparing start region for dimension " + DimensionType.getKey(serverworld.dimension.getType()));
BlockPos blockpos = serverworld.getSpawnPoint();
listener.start(new ChunkPos(blockpos));
ServerChunkProvider serverchunkprovider = serverworld.getChunkProvider();
serverchunkprovider.getLightManager().func_215598_a(500);
this.serverTime = Util.milliTime();
serverchunkprovider.registerTicket(TicketType.START, new ChunkPos(blockpos), 11, Unit.INSTANCE);
while (serverchunkprovider.getLoadedChunksCount() != 441) {
this.executeModerately();
}
this.executeModerately();
for (DimensionType dimensiontype : DimensionType.getAll()) {
ServerWorld serverWorld = this.getWorld(dimensiontype);
if (((WorldBridge) serverWorld).bridge$getWorld().getKeepSpawnInMemory()) {
ForcedChunksSaveData forcedchunkssavedata = serverWorld.getSavedData().get(ForcedChunksSaveData::new, "chunks");
if (forcedchunkssavedata != null) {
LongIterator longiterator = forcedchunkssavedata.getChunks().iterator();
while (longiterator.hasNext()) {
long i = longiterator.nextLong();
ChunkPos chunkpos = new ChunkPos(i);
serverWorld.getChunkProvider().forceChunk(chunkpos, true);
}
}
}
Bukkit.getPluginManager().callEvent(new WorldLoadEvent(((WorldBridge) serverWorld).bridge$getWorld()));
}
this.executeModerately();
listener.stop();
serverchunkprovider.getLightManager().func_215598_a(5);
this.forceTicks = false;
}
Aggregations