Vinetos

[Packets Bukkit] PNJ without IA

Aug 27th, 2015
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. final Location loc = p.getLocation();
  2. WorldServer worldServer = ((CraftWorld) loc.getWorld()).getHandle();
  3. final EntityVillager pnj = new EntityVillager(worldServer);
  4.  
  5. pnj.setLocation(loc.getX(), loc.getY(), loc.getZ(), 0, 0);
  6. pnj.setCustomName("Informations");
  7. pnj.setCustomNameVisible(false);
  8. pnj.setInvisible(true);
  9. pnj.setProfession(2);
  10. worldServer.addEntity(pnj);
  11.  
  12. EntityVillager entityVillager = pnj;
  13.  
  14. try {
  15. Field bField = PathfinderGoalSelector.class.getDeclaredField("b");
  16. bField.setAccessible(true);
  17. Field cField = PathfinderGoalSelector.class.getDeclaredField("c");
  18. cField.setAccessible(true);
  19. bField.set(entityVillager.goalSelector, new UnsafeList<PathfinderGoalSelector>());
  20. bField.set(entityVillager.targetSelector, new UnsafeList<PathfinderGoalSelector>());
  21. cField.set(entityVillager.goalSelector, new UnsafeList<PathfinderGoalSelector>());
  22. cField.set(entityVillager.targetSelector, new UnsafeList<PathfinderGoalSelector>());
  23. } catch (Exception exc) {
  24. exc.printStackTrace();
  25. }
Advertisement
Add Comment
Please, Sign In to add comment