NPCLib
NPCLib copied to clipboard
The NPCs are invisible
Describe the bug The NPCs are invisible, only the hologram is shown.
Server version Spigot-21fe707-e1ebe52 (MC: 1.8.8) (Implementing API version 1.8.8-R0.1-SNAPSHOT) & spigot 1.16.3
To Reproduce
- Create an NPC (The player must be offline when you create it! otherwise will work as expected.)
- Join the server
- Show the NPC to the player.
tested with npclib-plugin-2.10-SNAPSHOT.
The exact same thing happens to me in version 1.16 I hope they fix it soon, it becomes impossible to use having this problem.
same here tested with 2.9 and 2.10
Are you setting a skin when creating the npc? Or just a blank npc?
Yes, I'm setting skin for it.
npc.setLocation(loc)
npc.setSkin(skin)
npc.create()
Same for me, the name appears but the skin doesn't. It's invisible.
I'll look into it when I get the chance.
I can’t seem to replicate it, are you spawning in a bunch of npcs at a time? I.e. looping through a set of locations and creating an npc for each?
@andrei923 @iNezuko would you mind sharing your code?
looping through a set of locations and creating an NPC for each?
yes, also make sure you(the player) are not online when creating them.
I can’t seem to replicate it, are you spawning in a bunch of npcs at a time? I.e. looping through a set of locations and creating an npc for each?
@andrei923 @iNezuko would you mind sharing your code?
I'm using 1.16.4 (from the updated version someone shared on the issues). I'm using single NPC. Edit: oh it was you
https://pastebin.com/dYuXMJti
https://pastebin.com/nFSTyz70
My gamemode relies on NPCs made from packets. This lib seems to have saved my time, but yeah. If it's an issue of the version then I can downgrade to 1.16.2
I also tried changing the skin int and replacing it with Skin skin
looping through a set of locations and creating an NPC for each?
yes, also make sure you(the player) are not online when creating them.
I had this issue in the past, I believe it was a limitation of the mineskin api. I fixed the issue by serializing and saving the skin object in a config and retrieving it later so I only have to make the api call once.
Here’s my serializable skin class https://github.com/Mooselk/All-In-One-Lobby/blob/master/src/main/java/me/kate/lobby/npcs/api/skin/Skin.java
I can’t seem to replicate it, are you spawning in a bunch of npcs at a time? I.e. looping through a set of locations and creating an npc for each? @andrei923 @iNezuko would you mind sharing your code?
I'm using 1.16.4 (from the updated version someone shared on the issues). I'm using single NPC. Edit: oh it was you
https://pastebin.com/dYuXMJti
https://pastebin.com/nFSTyz70
My gamemode relies on NPCs made from packets. This lib seems to have saved my time, but yeah. If it's an issue of the version then I can downgrade to 1.16.2
I also tried changing the skin int and replacing it with Skin skin
That’s very strange, do you have the same issue if you create the skin object manually? You can do this by copy pasting the signature and value from mineskin and creating the skin object Skin(value, signature)
That’s very strange, do you have the same issue if you create the skin object manually? You can do this by copy pasting the signature and value from mineskin and creating the skin object Skin(value, signature)
Yes I did it with Skin skin = I'll try the one from your code in a second.
That’s very strange, do you have the same issue if you create the skin object manually? You can do this by copy pasting the signature and value from mineskin and creating the skin object Skin(value, signature)
Loaded class net.jitse.npclib.api.skin.Skin from NPCLibPlugin v2.9.1-SNAPSHOT which is not a depend, softdepend or loadbefore of this plugin.
I have added Depend on npclib and put it inside plugins folder (also before shaded it in maven but I undid it)
My code looks like this: https://pastebin.com/mtvZes5q
Still invisible.
Edit: I have changed from Depend to depend. The error vanished, but the skin still doesnt show up
Edit: It seems to not even create the NPC as it's not showing a Hitbox, or maybe because it's packets. I don't know how it works yet. https://gyazo.com/3a1a37619fcd8fa3a3963ec1cdfad0cc
Edit: I removed the setskin code and the NPC still wont show.
Edit: I downgraded the versions to 1.16.2 and used supporting version. Still throws error. Has to be something wtih code.
Edit!: I tried checking if npc is created and shown. It returns true for "created" and false for shown. Then I tried showing it against and got Task #2571 for SWSettlements v1.0-SNAPSHOT generated an exception java.lang.IllegalArgumentException: NPC is already shown to player
That’s very strange, do you have the same issue if you create the skin object manually? You can do this by copy pasting the signature and value from mineskin and creating the skin object Skin(value, signature)
My code now I took from "examples" the author of this lib did. It works and spawned the NPC.
https://pastebin.com/pS1s26Ks
My code now I took from "examples" the author of this lib did. It works and spawned the NPC.
https://pastebin.com/pS1s26Ks
Good to here that it’s working now, still confused as to why it wasn’t before.
@andrei923 looks like it was an issue with rate limiting, especially if your loading the npcs again and again. Each request for a given skin has a 60 second cool down.
I’d recommend serializing and saving your skins so you only need to make the api call once.
Good to here that it’s working now, still confused as to why it wasn’t before.
I'm p sure the NPC has to be created when the player is on the server. Or like couple minutes after start.
is not related to the skin, tried without setting the skin, the same result, the bug was added in 2.8
Good to here that it’s working now, still confused as to why it wasn’t before.
I'm p sure the NPC has to be created when the player is on the server.
that's the bug, meaning that you have to create an NPC every time a player joins.
that's the bug, meaning that you have to create an NPC every time a player joins.
Works for me as I'd make them spawn like this anyways. Hope you can figure it out soon
I’d recommend serializing and saving your skins so you only need to make the api call once.
Would it work with saving the data of the skin. Value and signature? How it would look like in the code?
Would it work with saving the data of the skin. Value and signature? How it would look like in the code?
You’d just need to save the value and signature under the id so you can grab it later.
Here’s my skin class https://github.com/Mooselk/All-In-One-Lobby/blob/master/src/main/java/me/kate/lobby/npcs/api/skin/Skin.java
And fetching methods https://github.com/Mooselk/All-In-One-Lobby/blob/master/src/main/java/me/kate/lobby/cache/SkinCache.java
is not related to the skin, tried without setting the skin, the same result, the bug was added in 2.8
I need to see how you’re showing the npc, I’m still unable to replicate your issue.
Have you tried hiding and unhiding the npc? I’m trying to narrow this down as much as possible before I go digging.
is not related to the skin, tried without setting the skin, the same result, the bug was added in 2.8
I need to see how you’re showing the npc, I’m still unable to replicate your issue.
Have you tried hiding and unhiding the npc? I’m trying to narrow this down as much as possible before I go digging.
yes, the NPC is still hidden, it throws the "NPC is already shown to player" error, the hologram works.
Creating a new NPC Object for every player and using the code from #130 worked for me. It seems, like it's a issue with the NPCs getting created before the skin finished downloading... 🤔
Creating a new NPC Object for every player and using the code from #130 worked for me. It seems like it's an issue with the NPCs getting created before the skin finished downloading... 🤔
it's not related to the skin, you don't need to set the skin to reproduce it.
Well without skins it kinda worked for me.
Am Mi., 16. Dez. 2020 um 13:53 Uhr schrieb andrei923 < [email protected]>:
Creating a new NPC Object for every player and using the code from #130 https://github.com/MinecraftLibraries/NPCLib/pull/130 worked for me. It seems like it's an issue with the NPCs getting created before the skin finished downloading... 🤔
it's not related to the skin, you don't need to set the skin to reproduce it. [image: 2020-12-16_14 52 47] https://user-images.githubusercontent.com/29291628/102350990-679af500-3fae-11eb-90c9-a0ab84274a35.png
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/MinecraftLibraries/NPCLib/issues/124#issuecomment-746244716, or unsubscribe https://github.com/notifications/unsubscribe-auth/AL3U2R5HPKGGR5CJN5NS7MDSVCUURANCNFSM4SF7AG5A .
Creating a new NPC Object for every player and using the code from #130 worked for me.
this.
Creating a new NPC Object for every player and using the code from #130 worked for me.
this.
what do you mean?
Please note that showing the NPCs to the players async results in strange behavior like this. Always make sure that player related mechanics act on the main server thread!
Version 2.7.2 works as it should, In 2.8 it doesn't.