Advertisement
Guest User

Untitled

a guest
Jan 20th, 2019
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. for(Entity e : world.getNearbyEntities(world.getBlockAt(x, y, z).getLocation(), 1, 1, 1))
  2. {
  3. if(e instanceof LivingEntity)
  4. {
  5. int time = 1;
  6. while(e.getLocation().getBlock().getType().isSolid() || e.getLocation().add(0, 1, 0).getBlock().getType().isSolid())
  7. {
  8.  
  9. if(time >= 50)
  10. {
  11. e.teleport(e.getLocation().add(0, 1, 0));
  12. }
  13. time++;
  14. Block n = e.getLocation().getBlock().getRelative(BlockFace.NORTH);
  15. Block s = e.getLocation().getBlock().getRelative(BlockFace.SOUTH);
  16. Block east = e.getLocation().getBlock().getRelative(BlockFace.EAST);
  17. Block w = e.getLocation().getBlock().getRelative(BlockFace.WEST);
  18. e.teleport(e.getLocation().add(0, 1, 0));
  19. if(!n.getType().isSolid())
  20. {
  21. e.teleport(n.getLocation());
  22. }
  23.  
  24. if(!s.getType().isSolid())
  25. {
  26. e.teleport(s.getLocation());
  27. }
  28.  
  29. if(!east.getType().isSolid())
  30. {
  31. e.teleport(east.getLocation());
  32. }
  33.  
  34. if(!w.getType().isSolid())
  35. {
  36. e.teleport(w.getLocation());
  37. }
  38.  
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement