Paper/Spigot-Server-Patches/0380-Do-less-work-if-we-hav...

41 lines
2.5 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Paul Sauve <paul@burngames.net>
Date: Sun, 14 Jul 2019 21:05:03 -0500
Subject: [PATCH] Do less work if we have a custom Bukkit generator
If the Bukkit generator already has a spawn, use it immediately instead
of spending time generating one that we won't use
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 7e832d2610f9c0d805c7f289de5098d9b5f09402..824c3763a56171ceb5f7163783cd46154b7e181e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -513,11 +513,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
} else if (flag1) {
iworlddataserver.setSpawn(BlockPosition.ZERO.up());
} else {
- WorldChunkManager worldchunkmanager = chunkgenerator.getWorldChunkManager();
- List<BiomeBase> list = worldchunkmanager.b();
- Random random = new Random(worldserver.getSeed());
- BlockPosition blockposition = worldchunkmanager.a(0, worldserver.getSeaLevel(), 0, 256, list, random);
- ChunkCoordIntPair chunkcoordintpair = blockposition == null ? new ChunkCoordIntPair(0, 0) : new ChunkCoordIntPair(blockposition);
+ // Paper start - moved down
// CraftBukkit start
if (worldserver.generator != null) {
Random rand = new Random(worldserver.getSeed());
@@ -533,6 +529,14 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
}
}
// CraftBukkit end
+ // Paper start - if the generator created a spawn for us, then there is no need for us to also create a spawn -
+ // only do it if the generator did not
+ WorldChunkManager worldchunkmanager = chunkgenerator.getWorldChunkManager();
+ List<BiomeBase> list = worldchunkmanager.b();
+ Random random = new Random(worldserver.getSeed());
+ BlockPosition blockposition = worldchunkmanager.a(0, worldserver.getSeaLevel(), 0, 256, list, random);
+ ChunkCoordIntPair chunkcoordintpair = blockposition == null ? new ChunkCoordIntPair(0, 0) : new ChunkCoordIntPair(blockposition);
+ // Paper end
if (blockposition == null) {
MinecraftServer.LOGGER.warn("Unable to find spawn biome");