Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void on(PlayerMoveEvent e){
- Player p = e.getPlayer();
- for(Entity entity : p.getNearbyEntities(0.3, 0.3, 0.3)){
- if(entity instanceof Player){
- for(NPCTypes type : NPCTypes.values()){
- if(entity.getName().equals(type.getName())){
- Vector entV = entity.getLocation().toVector();
- Vector plV = p.getLocation().toVector();
- Vector v = plV.clone().subtract(entV).multiply(0.5/plV.distance(entV));
- v.setY(0.3);
- p.setVelocity(v);
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement