NPC dissapears when far away

Discussion in 'Plugin Development' started by guitargun, Nov 17, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    guitargun

    so I have my own npc library.. the problem I am having is that the NPC disappears when you are out of it view range. Is there a solution to this?
    or should I just resent the packets when the player enters its viewing range?
     
  2. Offline

    FabeGabeMC

    @guitargun It's probably client side. Did you test it with another player?
     
  3. Offline

    guitargun

    yup. happens to everyone who gets to far away.. current fix is let the player relog
     
  4. Offline

    FabeGabeMC

    @guitargun Maybe the chunk unloaded? If that is the case, try listening for a ChunkUnloadEvent.
     
  5. Offline

    guitargun

    already tried.. no effect..
     
  6. @guitargun maybe send a chunk update packet of the chunk the npc is in?
     
  7. Offline

    CoolDude53

    Double checking, are you using LivingEntity#setRemoveWhenFarAway(false) somewhere?
     
  8. Offline

    WinX64

    Your client will automatically despawn anything that is not within a range of 128 blocks from you, regardless of what the server told the client. It's the server's job to handle entity spawning/despawning when someone enters/leaves the viewable distance field.
    So, yeah, either handle that yourself or don't let anyone go too far away from your NPC.
    Check this for further reference.
     
Thread Status:
Not open for further replies.

Share This Page