Get action from EntityDamageByEntityEvent?

Discussion in 'Plugin Development' started by TigerHix, Aug 16, 2013.

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

    TigerHix

    Let's say I made a gun (pickaxe actually).

    Right-clicking it will fire bullets (just some smoke actually) and plugin will check if smoke hit entity, if yes it will damage entity by 7.0. No problem here, and damage cause will be ENTITY_ATTACK.

    Left-clicking it will give a melee attack. Here's what I wrote: (Pseudo code)

    on EntityDamageByEntity event:
    if (damager holding gun) damage entity by 10.0

    Problem is, EntityDamageByEntity event will check both right-click or left-click, means the right-clicking code will be overlapped by this event. So whether you fire bullets or melee, the damage will always be 10.0

    Is there any solution?
     
  2. Offline

    Chinwe

    Would you be able to check for the original damage?
    Left click -> ~0.5 heart of damage (normal melee)
    Right click -> no damage
     
    TigerHix likes this.
  3. Offline

    TigerHix

    Great! :D
    Thanks for your help!
     
Thread Status:
Not open for further replies.

Share This Page