Solved Custom entity not attacking other custom entity 1.9

Discussion in 'Spigot Plugin Development' started by Sillyman, May 21, 2016.

  1. So I have two custom zombie classes that are identical using NMS. The only difference is that they are meant to target and attack each other. I'm not going to post the code because it is unneeded as it is exactly this: https://bukkit.org/threads/how-to-override-default-minecraft-mobs.216788/ updated for 1.9 and replacing the targeted entity with my custom mob.

    Also I have done my own testing. I do not receive any errors when putting in my custom mob and the attacking works if i set it to both the player and a skeleton. It seems to just not want to attack any of my custom entities. If anyone can think of any reason as to why it won't would be much appreciated. At this point I'm pretty stumped and can't think of any other reasons for it to be acting up. I'm sure i'm missing something simple.

    EDIT: And yes, I am registering the entity as required. Everything works if it is targeting a minecraft entity, just not my custom entity.

    Thank you in advance.
     
  2. have you tried this one ?

    Code (Java):
    @EventHandler
        public void onEntityTargetEvent (final EntityTargetEvent event) {
           if(event.getEntity().getType()== EntityType.ZOMBIE){
            //create a variable to store the zombie.
            Zombie zombie =(Zombie) event.getTarget();
            event.setTarget(zombie);
        }
     
  3. That is not what I am trying to do. My custom entity won't target the specific custom entity in the first place. My entity should be targeting the other entity throw NMS, without the need of a Bukkit event.
     
  4. Nevermind, I delved into it more and fixed the problem.

    Thanks for taking your time.