NPCLib
NPCLib copied to clipboard
NPCs Not Spawning
Describe the bug NPCs don't always spawn.
NPCLib usage option 3
NPCLib JAR name npclib-plugin-2.8-SNAPSHOT.jar
Server version This server is running CraftBukkit version git-Spigot-ad703da-e2403a3 (MC: 1.16.1) (Implementing API version 1.16.1-R0.1-SNAPSHOT) (latest at the time of posting this)
To Reproduce Steps to reproduce the behavior: Try to spawn NPCs. Using example 1 as an example:
@EventHandler
public void onPlayerToggleSneak(PlayerToggleSneakEvent event) {
if (event.isSneaking()) {
return;
}
NPC npc = npcLib.createNPC();
npc.setLocation(event.getPlayer().getLocation());
npc.create();
npc.show(event.getPlayer());
}
Also, it seems to work even less if you try to make the NPC be on fire.
Expected behavior A NPC spawns every time.
Screenshots I tried getting a mp4 of the issue, but couldn't.
Sometimes after a while it just stops working.
Additional context ~Add any other context about the problem here.~
I managed to get a clip off the issue with NPCs on fire. But the same thing happens with normal NPCs except after a while they don't work at all.
https://i.eazyftw.com/5JyU75h.mp4
Figured out it only works when you're looking down. (30+ pitch)
Could be related/similar or the same as #96
I've had a somewhat similar issue when spawning in an NPC while not looking at it causes it to not load properly. However, after spawning properly it continues to work fine. Canceling the NPCHideEvent if the plugin tries to hide it automatically fixed the problem.
Edit: Having this issue on all versions 1.8.3 to 1.16.1
Came across this today as well. It's pretty common for players to spawn NPCs at their location and to have them trip out and be invisible is odd. Might be worth a one-off check in this specific scenario as I wouldn't call this an edge case.
Took some debugging to figure out I needed to really not spawn it on top of me.