From 05abc9299c2c54b84f96ad488ddfddb5bd66dca7 Mon Sep 17 00:00:00 2001 From: "Alex \"mcmonkey\" Goodwin" Date: Fri, 30 Nov 2018 06:34:47 -0800 Subject: [PATCH] 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. --- main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java b/main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java index af08c7401..d92f162c0 100644 --- a/main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java +++ b/main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java @@ -221,8 +221,6 @@ public class CitizensNPC extends AbstractNPC { } } - getEntity().teleport(at); - if (!couldSpawn) { Messaging.debug("Retrying spawn of", getId(), "later due to chunk being unloaded.", Util.isLoaded(at) ? "Util.isLoaded true" : "Util.isLoaded false"); @@ -232,6 +230,8 @@ public class CitizensNPC extends AbstractNPC { return false; } + getEntity().teleport(at); + NMS.setHeadYaw(getEntity(), at.getYaw()); // Set the spawned state