1.8.8 projectile-related issues

Discussion in 'Plugin Development' started by Music4lity, Nov 6, 2020.

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

    Music4lity

    I'm coding a plugin for 1.8.8 and I'm running into a couple of issues:
    1. How can I determine if a projectile hit a block or an entity? I would use ProjectileHitEvent, but this doesn't have a method for determining if what was hit was a block or an entity.
    2. How can I determine the name/lore of a projectile from whence it was an item before it became an entity? I could use ProjectileLaunchEvent and get the ItemMeta from the item in the hand, but that won't work will it? Since the item is now a projectile?
    What I'm trying to do is make special enderpearls that do different things based on their name/lore. When they're launched, their UUIDs are added to a HashSet if they meet the name/lore criteria. When they hit a block, they are despawned and removed from the HashSet instead of teleporting and when they hit a player or mob entity, they carry out those special actions.
     
  2. Offline

    Kars

    1. You can probably use getEntityType and it will return UNKNOWN if it did not hit any of the existing entity types. 1.16 does have getHitBlock in ProjectileHitEvent, if you ever consider upgrading.
    2. ProjectileLaunchEvent has getEntity which returns the projectile. A hard comparison between this and the projectile from ProjectileHitEvent might not work but as Projectile is an Entity you can compare entity id (getEntityId).
    Good luck.
     
Thread Status:
Not open for further replies.

Share This Page