Solved Getting the itemstack a projectile has been shot from

Discussion in 'Plugin Help/Development/Requests' started by BizarrePlatinum, Jun 27, 2015.

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

    BizarrePlatinum

    I am currently trying to do some things involving arrows, say if it is named "Fire Arrow", the entity it hits(if it is living) will be caught on fire. However, I cannot figure out how I could test the name of the itemstack used to launch the projectile. If someone could assist with that, or provide me with a better/easier way, it would be greatly appreciated.
     
  2. Offline

    Boomer

    entity damaged by entity event, cause is projectile , getDamager would be the projectile object that did it
    Thats as much as you can get from there, the who/what/where that launched the projectile is not obtainable from that event.

    However, the projectilelaunch event will let you get the launcher, if its a player, what the projectile is, the projectile object... So you can capture the projectile object information when it is launched, and you can access the projectile object information when it does the damaging and that is the only bridge between the pieces of information.

    Suggestion:
    Test the projectile during the launch. Get the UUID of the projectile if it matches your special type of arrows. Add it to an exposed Set of UUIDs

    Then, when a projectile damages an entity, and is an arrow ... see if its uuid is in the set - if so, then its your special arrow, and you can remove its uuid from the set, and do the other things you need to trigger now. If it isnt the uuid you are looking for, its just a regular arrow, no need to do fancy things with it.
     
  3. Offline

    xTrollxDudex

    Add entity metadata when it is dropped and set the velocity of it. You can check the change in velocity if it impacts an entity.
     
  4. Offline

    BizarrePlatinum

    @Boomer I see what you're saying now, thank you very much. /solved.
     
Thread Status:
Not open for further replies.

Share This Page