[UnSolved] Increasing the target range on a custom entity

Discussion in 'Plugin Development' started by Jogy34, Dec 2, 2012.

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

    Jogy34

    For a custom zombie for a plugin I'm developing I'm trying to make it so that it is able to target players at a much higher range. I tried overwriting the getTarget() method and increasing the range that way but it seems to just act the same. Here's what I have for the getTarget() method:

    Code:
    @Override
    protected Entity findTarget()
    {
        EntityHuman entityhuman = this.world.findNearbyVulnerablePlayer(this, 64.0f);
     
        return entityhuman != null && this.n(entityhuman) ? entityhuman : null;
    }
    
    I looked over Jacek's BloodMoon code and that is what it looks like he does to increase the range of his custom mobs. Anyone know if I'm doing something wrong?

    Anyone?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 30, 2016
  2. Offline

    Jogy34

  3. Offline

    SirTyler

    API+ (Supports Custom mobs)
    Either use it or take a look at my source code.

    Quick Answer: its a value in the goalSelector and/or findTarget function.
     
  4. Offline

    Jogy34

    I'm not creating the custom mobs through Spout though. Does it have vanilla stuff in it?
     
  5. Offline

    SirTyler

    Spout does nothing for the custom mob support, API+ just uses that for other options such as Easier use of managing custom items. If you look at the source code you will see nothing BUT NMS classes are imported and used (Besides a few obvious exceptions).
     
  6. Offline

    Jogy34

    SirTyler I've look through your code and I've tried doing everything that looks like it has anything to do with the target range of the mob which was really only changing the navigation and the findTarget() method. Is there anything else you can give me as to how to do this?
     
  7. Offline

    Jacek

    You can do this with a custom pathfinder https://github.com/betterphp/BloodM...athfinderGoalNearestAttackableTarget.java#L48 it does not seem to work over distance greater and ~2 times the default values though. I think something else limits how far a mob will attempt to move in one go and this will sometimes set the move position to an entity outside of this limit.

    EDIT: Also I don't think findTarget() is used with the new AI for mobs.
     
Thread Status:
Not open for further replies.

Share This Page