Skip to content

Commit

Permalink
fix world loading
Browse files Browse the repository at this point in the history
  • Loading branch information
Faithcaio committed Nov 26, 2023
1 parent 802a6a4 commit 446aedf
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.TicketType;
import net.minecraft.server.level.progress.ChunkProgressListener;
import net.minecraft.util.TimeUtil;
import net.minecraft.world.Difficulty;
import net.minecraft.world.entity.ai.village.VillageSiege;
import net.minecraft.world.entity.npc.CatSpawner;
Expand Down Expand Up @@ -953,20 +954,20 @@ private void loadSpawnChunks(final ServerLevel world) {
chunkStatusListener.updateSpawnPos(chunkPos);
final ServerChunkCache serverChunkProvider = world.getChunkSource();
// serverChunkProvider.getLightEngine().setTaskPerBatch(500);
((MinecraftServerAccessor) this.server).accessor$nextTickTimeNanos(Util.getMillis());
((MinecraftServerAccessor) this.server).accessor$nextTickTimeNanos(Util.getNanos());
serverChunkProvider.addRegionTicket(SpongeWorldManager.SPAWN_CHUNKS, chunkPos, 11, world.dimension().location());

while (serverChunkProvider.getTickingGenerated() != 441) {
((MinecraftServerAccessor) this.server).accessor$nextTickTimeNanos(Util.getMillis() + 10L);
((MinecraftServerAccessor) this.server).accessor$nextTickTimeNanos(Util.getNanos() + 10L * TimeUtil.NANOSECONDS_PER_MILLISECOND);
((MinecraftServerAccessor) this.server).accessor$waitUntilNextTick();
}

((MinecraftServerAccessor) this.server).accessor$nextTickTimeNanos(Util.getMillis() + 10L);
((MinecraftServerAccessor) this.server).accessor$nextTickTimeNanos(Util.getNanos() + 10L * TimeUtil.NANOSECONDS_PER_MILLISECOND);
((MinecraftServerAccessor) this.server).accessor$waitUntilNextTick();

this.updateForcedChunks(world, serverChunkProvider);

((MinecraftServerAccessor) this.server).accessor$nextTickTimeNanos(Util.getMillis() + 10L);
((MinecraftServerAccessor) this.server).accessor$nextTickTimeNanos(Util.getNanos() + 10L * TimeUtil.NANOSECONDS_PER_MILLISECOND);
((MinecraftServerAccessor) this.server).accessor$waitUntilNextTick();
chunkStatusListener.stop();
// serverChunkProvider.getLightEngine().setTaskPerBatch(5);
Expand Down

0 comments on commit 446aedf

Please sign in to comment.