1.15.2 Set Bees to Attack player

Discussion in 'Spigot Plugin Development' started by David_Mayr, Mar 1, 2020.

  1. How can i set Bees to attack a specific player and not all?
    bee.setTarget doesnt work....
  2. I did...
    Bee bee = (Bee) location.getWorld().spawnEntity(location, EntityType.BEE);

    Sadly this attacks all Players.... I never said they dont attack at all...
  3. Did you try to invert Bee#setTarget and Bee#setAnger lines?
  4. Is this important? I will try it out now
    • Funny Funny x 1
  5. It can have its importance, since I'm not sure a bee can have a target if it's not angry :unsure:
  6. The bee attacks the target but when the target is out of reach the bee starts attacking other players too :(
  7. As its angered it will search for the nearest target if it lost the current one,loop through the distance of the target and the bee,and if higher than X set the anger back to 0
  8. How can i change this? Is there a way to replace this function? I heared you can create custom mobs or something?
  9. Hm, I think that is the normal behavior of a mob. Take the example of a Zombie: when it locks its target on you, it will follow you until you're out of reach, then it will lock its target on another player, etc..
  10. Yes you can create custom enitity to have custom goals,but that means working in NMS,wich is not supported here and we cannot give any help about it..
  11. You could always use the EntityTargetEvent to see if the target changed, and then from there set the anger back to 0.
    • Winner Winner x 1