Invisible Gravity-Affected Projectile

Discussion in 'Spigot Plugin Development' started by BlackyPaw, Jun 12, 2016.

  1. Hey there,

    I am currently trying to figure out if there is a way to spawn a projectile that is affected by gravity (e.g. snowballs, eggs) but make it invisible and add a passenger on top of it. More specifically, I would like to put an item drop on top of it in order to make it appear as if items would be shot instead of a snowball or similar. My ultimate goal is to have more projectiles that have a different appearance than just snowballs and eggs. What I have tried so far, is sending the snowballs' invisible metadata flag and sending an entity destroy packet right after the snowball spawned and was given a passenger item. Unfortunately, none of these worked as of now.

    Do you know of a way to either make these projectiles invisible or somehow else make it appear as if items were shot? If so, please let me know.

    Best regards,
    BlackyPaw.
     
  2. Using ProtocolLib you could modify the outgoing packet that describes the entity as an arrow and turn it into an item. I won't go into detail as I'm on my phone and it would take too long. Perhaps someone elss could help further, if not I will be able to continue tomorrow late afternoon
     
  3. You could also spawn and armorstand and set its velocity
     
  4. @megamichiel That would be great, thank you a lot!
    @Leftwitch: Could be an option, too, yet it might not result in a trajectory as good as an invisible projectile. Also, how would I know exactly where the armor stand collided with another block, e.g. a wall or similar?
     
  5. To be honest, i just tought about entity colliding, cause for this i made a class so i know this is possible and works well, maybe a scheduler and check the distance between before and now when its <=0.3 (just and number cause i dont know how exact minecraft is) i guess it collided with a block when not its still moving
     
  6. Hey again,

    I have actually used @megamichiel 's idea and implemented it using ProtocolLib. Using some small workaround it actually works like a charm, Kudos to you! I have also created a Gist providing the code I am using - it could be improved quite a bit but it should demonstrate how the technique works quite well. Feel free to use it as is, if you want.

    Again, thank you @megamichiel, you're great!

    Best regards,
    BlackyPaw.