Making an arrow invisible

Discussion in 'Plugin Development' started by ThrustLP, Jul 16, 2016.

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

    ThrustLP

    Hey guys! So basicly I am coding a plugin that makes potions shootable with an item. I want to spawn an arrow, make it invisble right after spawing and shoot it. And if it hits a player he gets an potion effect. So how can I make an arrow invisible after shooting it (but still use it to hit sb)


    Thank you guys!
     
  2. Offline

    MCMastery

    What have you tried

    Sorry we can't just give you the code :p That's not how people learn
     
  3. Offline

    ThrustLP

    @MCMastery

    I tried aaaall the things you can do with an LivingEntity but it didnt work. Now I did it like:

    Code:
    Projectile projectile = e.getPlayer().launchProjectile(Arrow.class);
                                projectile.setVelocity(projectile.getVelocity().multiply(0.8));
                                Main.getInstance().heal.add(projectile.getUniqueId().toString());
                           
                                for (Player p : Bukkit.getOnlinePlayers()) {
                                    ((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityDestroy(((CraftArrow) projectile).getHandle().getId()));
                                }
    Ant there is one problem. When the arrow spawns it is visible for 0,1 second or so. YOu know how I can solve that?
     
  4. Offline

    mine-care

    Well this is how long it takes for the packet to be created, sent, received, processed, executed and for all the entity packets to be sent when the arrow spawns. You could try spawning it really high up or on a random of in the map, destroy it, and then teleport it to the players location and using it as a normal arrow that exists on the server side ;) have t tried but you never know :D
     
  5. Offline

    TidalRyan

    Couldn't you just cancel the event?
     
  6. Isn't this exactly what tipped arrows do? Or am I missing something?
     
    ipodtouch0218 likes this.
  7. Offline

    TidalRyan

    @AlvinB I think it is just invisible tipped arrows, but with custom effects.
     
  8. Offline

    mine-care

    Which event?
     
Thread Status:
Not open for further replies.

Share This Page