Solved Make a nms entity invinsible

Discussion in 'Plugin Development' started by spiroulis, Mar 25, 2015.

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

    spiroulis

    Hi so im kinda new with nms, i followed TeePees tutorial and after playing some weeks with what i could do, i wanted to make an invisible villager. Now i tried doing this before and it did work but for a reason it doesnt anymore...can someone explain to me why?
    Code:
    public class CustomEntityVillager extends EntityVillager{
    
        public CustomEntityVillager(World world) {
            super(world);
            try {
                Field bField = PathfinderGoalSelector.class.getDeclaredField("b");
                bField.setAccessible(true);
                Field cField = PathfinderGoalSelector.class.getDeclaredField("c");
                cField.setAccessible(true);
                bField.set(goalSelector, new UnsafeList<PathfinderGoalSelector>());
                bField.set(targetSelector, new UnsafeList<PathfinderGoalSelector>());
                cField.set(goalSelector, new UnsafeList<PathfinderGoalSelector>());
                cField.set(targetSelector, new UnsafeList<PathfinderGoalSelector>());
                } catch (Exception exc) {
                exc.printStackTrace();
                // This means that the name of one of the fields changed names or declaration and will have to be re-examined.
                }
           
                this.setInvisible(true);
            }
    
    }
    also another problem i held for another thread but this might have to do something with the villager problem, sometimes when i start my server i get a message saying "Skipping entity with id (entity's id)". Thanks in advance :)
     
  2. Offline

    Funergy

    @spiroulis An EntityVillager needs the PathfinderGoalFloat.
    What you are doing is clearing the whole entity its pathfinders but not giving him pathfindergoal float.
     
  3. Offline

    spiroulis

    @Funergy im sorry i should have explained that earlier, the reason im making this villager is because i want some other custom mobs i made to hunt him. I dont want the villager to do anything i just want him to be invinsible to the players. Im sure it spawned cause other than some printing i did, the monsters hunted down and killed him. And no errors :)
     
  4. Offline

    Funergy

    @spiroulis well thats easy. You NEED to give him that path finder. and if you want that he does nothing.
    Just return every method that you want to disable. Look into the EntityVillager class.
    In 1.7.5 I thought the e() method was the move method. then just create the e() method in your class and return it.
     
  5. Offline

    spiroulis

  6. Online

    timtower Administrator Administrator Moderator

    Locked on request
     
Thread Status:
Not open for further replies.

Share This Page