How to make an entity follow?

Discussion in 'Plugin Development' started by Kilorbine, Mar 18, 2015.

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

    Kilorbine

    Hi guy!
    To make it simple : i want to make an Iron Golem follow the player.

    I have made a custom golem, but i'm not able to ake it follow the player :(
    I've try a lot of tutorial but I always hae some error :/


    Code:
    class MineIronGolem extends EntityIronGolem {
        public MineIronGolem(World world)
        {
            super(world);
        }
        EntityTameableAnimal test;
       
        public void setMage(EntityLiving e)
        {
            super.setGoalTarget(e);
            super.t
            super.setPlayerCreated(true);
            super.setInvisible(false);
            this.goalSelector.a(1, new PathfinderGoalMoveTowardstarget(this, 1.0D, true));
            super.goalSelector.a(0, PathfinderGoalGoToTarget(e, 1.0D, true));
           
        }
    }

    My first idea was to make IronGolem a tameable Entity, it would has been more simple.
    But i didn't succed
     
  2. @Kilorbine
    Well, the problem is that the golem doesn`t has a target.
     
  3. there is no ; after super.t
     
  4. Offline

    Kilorbine

    @FisheyLP : the super.t was commented when i compiled.
    Is there any way to make the golem just follow the player? :(
     
  5. Offline

    EpicCraft21

    https://bukkit.org/threads/making-mobs-follow-a-player.110360/

    try setting an iron golem's target to the player with .setTarget
    That will make the iron golem attack the player though, so add an entitydamagebyentity event and cancel it.
     
    Kilorbine likes this.
  6. Offline

    Kilorbine

    @EpicCraft21 : Yes, this is what i will do, thx.
    For now i have another error : it spam, but it is invisible and a .setInvisible(false) does not work :/
     
  7. Offline

    EpicCraft21

    This may or may not fix the problem, but try clearing the effects on the golem.
     
  8. Offline

    Kilorbine

Thread Status:
Not open for further replies.

Share This Page