Advertisement
MrGG4ming

Untitled

Feb 11th, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. private static Region getRegionHere(Location loc) {
  2.  
  3. List<Region> regionList = Region.getRegions();
  4. for (Region rg : regionList) {
  5.  
  6. int p1x = rg.getP1x();
  7. int p1y = rg.getP1y();
  8. int p1z = rg.getP1z();
  9. int p2x = rg.getP2x();
  10. int p2y = rg.getP2y();
  11. int p2z = rg.getP2z();
  12.  
  13. int minX = p1x < p2x ? p1x : p2x;
  14. int minY = p1y < p2y ? p1y : p2y;
  15. int minZ = p1z < p2z ? p1z : p2z;
  16.  
  17. int maxX = p1x > p2x ? p1x : p2x;
  18. int maxY = p1y > p2y ? p1y : p2y;
  19. int maxZ = p1z > p2z ? p1z : p2z;
  20.  
  21. if (loc.getBlockX() >= minX && loc.getBlockX() <= maxX) {
  22. if (loc.getBlockY() >= minY && loc.getBlockY() <= maxY) {
  23. if (loc.getBlockZ() >= minZ && loc.getBlockZ() <= maxZ) {
  24.  
  25. return rg;
  26.  
  27. }
  28. }
  29. }
  30. }
  31. return null;
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement