aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches-Unmapped/0373-Do-less-work-if-we-have-a-custom-Bukkit-generator.patch
blob: 8283803f1a1b59b70af43a39620434e2e32864e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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 74c4462bc32e966055732944dfb931e75d7fad1f..b3401b59e0b99b32e3a600b3c33163a85f7c3ab2 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -629,12 +629,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
         } else if (flag1) {
             iworlddataserver.setSpawn(BlockPosition.ZERO.up(), 0.0F);
         } else {
-            WorldChunkManager worldchunkmanager = chunkgenerator.getWorldChunkManager();
-            Random random = new Random(worldserver.getSeed());
-            BlockPosition blockposition = worldchunkmanager.a(0, worldserver.getSeaLevel(), 0, 256, (biomebase) -> {
-                return biomebase.b().b();
-            }, 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());
@@ -650,6 +645,15 @@ 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();
+            Random random = new Random(worldserver.getSeed());
+            BlockPosition blockposition = worldchunkmanager.a(0, worldserver.getSeaLevel(), 0, 256, (biomebase) -> {
+                return biomebase.b().b();
+            }, 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");