Merge pull request #877 from Lolmewn/patch-1

Add NPC_METADATA_MARKER before teleporting
This commit is contained in:
fullwall 2016-08-02 16:10:02 +08:00 committed by GitHub
commit 7d11994b3d

View File

@ -196,6 +196,8 @@ public class CitizensNPC extends AbstractNPC {
entityController.spawn(at, this);
getEntity().setMetadata(NPC_METADATA_MARKER, new FixedMetadataValue(CitizensAPI.getPlugin(), true));
boolean couldSpawn = !Util.isLoaded(at) ? false : NMS.addEntityToWorld(getEntity(), SpawnReason.CUSTOM);
// send skin packets, if applicable, before other NMS packets are sent
@ -219,8 +221,6 @@ public class CitizensNPC extends AbstractNPC {
NMS.setHeadYaw(getEntity(), at.getYaw());
getEntity().setMetadata(NPC_METADATA_MARKER, new FixedMetadataValue(CitizensAPI.getPlugin(), true));
// Set the spawned state
getTrait(CurrentLocation.class).setLocation(at);
getTrait(Spawned.class).setSpawned(true);