Fix spawn chunk NPC loading issues, fixes #1332 (#1625)

Some misplaced code unintentionally caused chunks to load in the middle of the startup sequence (after NPCs refused to spawn in the chunk, but before the server was fully started), meaning any chunk that normally loads within a few seconds of startup would be loaded already at that time, meaning a chunk load event never fires, and thus any NPCs at that location simply don't spawn in until the chunk is allowed to naturally unload and is later loaded again.
This commit is contained in:
Alex "mcmonkey" Goodwin 2018-11-30 06:34:47 -08:00 committed by fullwall
parent 3ca12de138
commit 05abc9299c

View File

@ -221,8 +221,6 @@ public class CitizensNPC extends AbstractNPC {
} }
} }
getEntity().teleport(at);
if (!couldSpawn) { if (!couldSpawn) {
Messaging.debug("Retrying spawn of", getId(), "later due to chunk being unloaded.", Messaging.debug("Retrying spawn of", getId(), "later due to chunk being unloaded.",
Util.isLoaded(at) ? "Util.isLoaded true" : "Util.isLoaded false"); Util.isLoaded(at) ? "Util.isLoaded true" : "Util.isLoaded false");
@ -232,6 +230,8 @@ public class CitizensNPC extends AbstractNPC {
return false; return false;
} }
getEntity().teleport(at);
NMS.setHeadYaw(getEntity(), at.getYaw()); NMS.setHeadYaw(getEntity(), at.getYaw());
// Set the spawned state // Set the spawned state