[NMS] Overriding Some Hostile Mobs

Discussion in 'Plugin Development' started by TheDummy, Jul 20, 2014.

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

    TheDummy

    Hello Bukkit Dev community. I've read Jacek's overriding tutorial and experimented with overriding mobs. I have been able to override passive mobs (cows, sheep, etc). I've also been able to override some hostile mobs like Skeletons and Zombies. The problem is when I try to override mobs like Enderman, Pig Zombie, Ghast, Blaze, etc.

    I want to have them move to a hard coded block (for testing purposes). I have cleared the PathfinderGoals so that there is just the float Pathfinder and my custom PathfinderGoal. In my custom PathfinderGoal, I use the entity navigation to guide them to the block when spawned. However, I get the following issues:
    1. Endermen, Ghast, Blaze: Stand still.
    2. Zombie Pigmen: Wander as if they have pathfinders.
    Has anyone had this issue? Can anyone help?

    Notes: Not using any Mob API and it's the 1.7.9 version. PathfinderGoal is very simple. Doing output from it shows that it's being called but nothing happens for (1.) and is not called at all for (2.)
     
  2. Offline

    Garris0n

    You have to force the "new AI" via a certain boolean method. See if you can find it :p
     
  3. Offline

    TheDummy

    Garris0n Thank you. I found the method that was true in Zombie and false in PigZombie and it seems as though the AI now works for pigmen.
    Code:java
    1. public void bj();


    As for the Enderman, Ghast, and Blaze, I was not able to find a boolean function for them. I noticed they also don't have PathfinderGoals that are initially set on construction. I suppose they work entirely on a tick function, but I did try fiddling with a few of them, but I did not manage to get it to work. Do their PathfinderGoals work? Can they be enabled? Is the tick method approach the correct way?
     
  4. Offline

    Garris0n

    Ah, so you (sort-of) found it :p

    The method is from EntityInsentient (here). It is bk() as of 1.7.10, and was bj() in 1.7.9, and was something else in .2...gotta love obfuscation.

    Anyway, it's the same method for everything. I'm not exactly sure how ghasts or blazes will react to being told they have pathfinders (seeing as they're flying mobs), but I'd expect it to at least work for endermen.

    Either way, the default is false, so mobs that don't have the AI just don't override the method in the first place. Zombies override it because they do have the AI, and pigzombies override it again because they extend EntityZombie but still use the old AI. As I said, it's all the same method from EntityInsentient, so just override it in all the entities.
     
  5. Offline

    TheDummy

    Garris0n Oh I see. Thank you. I'll experiment with it.
     
Thread Status:
Not open for further replies.

Share This Page