-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The NPCs are invisible #124
Comments
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 |
Are you setting a skin when creating the npc? Or just a blank npc? |
Yes, I'm setting skin for it.
|
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? |
yes, also make sure you(the player) are not online when creating them. |
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 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 |
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 |
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 = |
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 |
My code now I took from "examples" the author of this lib did. It works and spawned the NPC. |
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. |
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 |
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
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 |
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... 🤔 |
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
<#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
<#124 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AL3U2R5HPKGGR5CJN5NS7MDSVCUURANCNFSM4SF7AG5A>
.
|
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. |
Still an issue in the latest version. |
Can confirm, brand new user here running Paper Version 495 1.16.5-R0.1-Snapshot and NPCLibPlugin 2.11.1-Snapshot when I spawn a npc on server start it will appear invisible even if spawned with no skin. Weird thing is if I reload the plugin (Using PlugMan) the npc will become visible so I thought maybe spawning the npc right as the server started was causing this somehow and tried using a delayed task but no luck there, I ended up trying what someone recommended here which is to spawn an npc for each individual player when they join and that works fine, its messy and I assume not very efficient but for now it is a temporary fix I hope. |
I solved this issue in 1.16.5 by running the following code on player join. |
the player must be offline to reproduce it.
|
I'm giving people a solution. I created the NPC object while the server is starting, and ran npc#create and npc#show on join. I can't find a way to fix it properly, I don't know if there is. I think the issue lies somewhere between sending the packets and there being no players to receive them. |
Yeah your fix is much better than creating individual npcs for every player which was the solution I went with before, I will note that I ran into an null error with I switched it to
I'm assuming the difference is how we are initially defining our npc variable, here is my final improvised example from your solution which works great in case anyone finds it useful:
|
I'm not creating an npc per person, just running the method npc#create on join. npc#create is the method that sends the packets to spawn the npc, but I guess your solution works too. |
Your solution works, yes. But it might be better to let @JitseB fix this issue, one attempt to fix this could also be to delay the show method on the player by 1 tick on joining. That's to make sure the player has joined and loaded the world since that might be the root cause. Because, yes.. the server can throw packets at the client whenever it wants to. But the client also has to accept the packets and actually do something with them! So if the client receives an entity packet while it hasn't even loaded the world yet, it might just drop that packet and thus the NPC won't exist for the client because this library is packet-based, and thus the NPC only exists on the client; NOT the server! |
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
tested with npclib-plugin-2.10-SNAPSHOT.
The text was updated successfully, but these errors were encountered: