Left Click with entity

Discussion in 'Spigot Plugin Development' started by Aussie, May 28, 2016.

  1. So say, an entity is invincible, the EntityDamageByEntity event doesn't work because damage is not inflicted. I need to test to see if a player left clicks/attacks an EntityPlayer a spawned and send the packet to.

    I create an entityplayer
    Send the spawn packets to a player
    Need to detect if that player attacks the entityplayer, but because the entityplayer is invincible, the damage event is run, any help on detecting left clicks on an entity that only exists for one player?
  2. If I am right, you are sending the hit packet to the server, the server does the harm to the entity. So even if the entity is invincible, you just have to listen to the packet. For packet help, check wiki.vg.

    I would cancel the damage event instead of making the entity invincible, that is easier than listening to packets.
  3. I haven't made the entity invincible, it's just like that by its self...
  4. you cannot listen with normal events
  5. Im sure you can just listen to the clientside attack packet. I think there wont be a damage event on the serverside since the entity technically doesnt exist on the server. Could be wrong though.
  6. Like I said, you can't listen with the bukkit API, you'd have to listen to the packets.
    Again, I recommend Ingrim4, but he's german
  7. oki, does he have english captions though to help?
  8. Not, but youtube have automatic generated ones that may help.