Want a better Minecraft server? Read about SpigotMC here!
Separate names with a comma.
Discussion in 'Spigot Plugin Development' started by David_Mayr, Mar 1, 2020.
How can i set Bees to attack a specific player and not all?
bee.setTarget doesnt work....
I don't think bees can attack when not angered,you should try setting the anger level and then a target
A Bee can't attack a player if it's not angry. Check https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Bee.html#setAnger-int-
Bee bee = (Bee) location.getWorld().spawnEntity(location, EntityType.BEE);
Sadly this attacks all Players.... I never said they dont attack at all...
Did you try to invert Bee#setTarget and Bee#setAnger lines?
Is this important? I will try it out now
It can have its importance, since I'm not sure a bee can have a target if it's not angry
The bee attacks the target but when the target is out of reach the bee starts attacking other players too
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
How can i change this? Is there a way to replace this function? I heared you can create custom mobs or something?
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..
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..
You could always use the EntityTargetEvent to see if the target changed, and then from there set the anger back to 0.