Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- final Location loc = p.getLocation();
- WorldServer worldServer = ((CraftWorld) loc.getWorld()).getHandle();
- final EntityVillager pnj = new EntityVillager(worldServer);
- pnj.setLocation(loc.getX(), loc.getY(), loc.getZ(), 0, 0);
- pnj.setCustomName("Informations");
- pnj.setCustomNameVisible(false);
- pnj.setInvisible(true);
- pnj.setProfession(2);
- worldServer.addEntity(pnj);
- EntityVillager entityVillager = pnj;
- try {
- Field bField = PathfinderGoalSelector.class.getDeclaredField("b");
- bField.setAccessible(true);
- Field cField = PathfinderGoalSelector.class.getDeclaredField("c");
- cField.setAccessible(true);
- bField.set(entityVillager.goalSelector, new UnsafeList<PathfinderGoalSelector>());
- bField.set(entityVillager.targetSelector, new UnsafeList<PathfinderGoalSelector>());
- cField.set(entityVillager.goalSelector, new UnsafeList<PathfinderGoalSelector>());
- cField.set(entityVillager.targetSelector, new UnsafeList<PathfinderGoalSelector>());
- } catch (Exception exc) {
- exc.printStackTrace();
- }
Advertisement
Add Comment
Please, Sign In to add comment