Solved Attach lead to arrow

Discussion in 'Spigot Plugin Development' started by TheNCoder, Jun 9, 2021.

Thread Status:
Not open for further replies.
  1. How can I attach a lead to an arrow? I want it just for a visual purpose.
    I tried to send an attach entity packet to player like this:
    Code (Text):
     connection.sendPacket(new PacketPlayOutAttachEntity(((CraftArrow) arrow).getHandle(), ((CraftPlayer) player).getHandle()));
    but it didn't work.
     
  2. I don't know if you can attach a lead to an arrow but an idea is to have an invisible entity that gets constantly teleported to the arrow and attach the lead to that.
     
    • Agree Agree x 1
  3. I tried to avoid this, but if it's the only way...
     
  4. It is unfortunatly, the entity must implement LivingEntity to be able to have a leash attached to it, and since you cannot attach the Player to the Arrow you'll have to use another Entity.

    You can also consider adding a passenger to the arrow so you won't have to teleport it.
     
    • Agree Agree x 1
  5. That is what I'm doing
     
Thread Status:
Not open for further replies.