Solved Entity packet removed from client when out of range

Discussion in 'Spigot Plugin Help' started by Enotkin, Jun 4, 2017.

Thread Status:
Not open for further replies.
  1. Entity packet removed from client when out of range. How to fix that?
    I can fix that with PlayerMoveEvent, when player enters the range i will send this packet, but I think this is a bad decision.

    Sorry for my English :(
     
  2. md_5

    Administrator Developer

    Not idea what you're asking.
    What do you want to do?
     
  3. Hi, im sending EntityArmorStand, for example:
    Code (Text):
            EntityArmorStand armorStand = new EntityArmorStand(((CraftWorld) location.getWorld()).getHandle());
            armorStand.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
            ((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutSpawnEntityLiving(armorStand));
    When a player flies away from the location of this EntityArmorStand, it is deleted on the client. How to fix that?
     
    #3 Enotkin, Jun 4, 2017
    Last edited: Jun 4, 2017
  4. md_5

    Administrator Developer

    You would need to spawn it back when the player gets close. This is what the server does for actual armor stands.
     
    • Like Like x 1
  5. How can this be done better? Create a list of players who are nearby and send to those who have approached (check onPlayerMoveEvent or Task) or is there an option better? This was my question originally, sorry for my incorrect expression of thoughts :(
     
    #5 Enotkin, Jun 4, 2017
    Last edited: Jun 4, 2017
    • Like Like x 1
  6. Why dont you just spawn it?
     
  7. md_5

    Administrator Developer

    This is probably the best option. Maybe you could use ProtocolLib to hide it from players that dont need to see it.
     
    • Like Like x 1
Thread Status:
Not open for further replies.