Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static Region getRegionHere(Location loc) {
- List<Region> regionList = Region.getRegions();
- for (Region rg : regionList) {
- int p1x = rg.getP1x();
- int p1y = rg.getP1y();
- int p1z = rg.getP1z();
- int p2x = rg.getP2x();
- int p2y = rg.getP2y();
- int p2z = rg.getP2z();
- int minX = p1x < p2x ? p1x : p2x;
- int minY = p1y < p2y ? p1y : p2y;
- int minZ = p1z < p2z ? p1z : p2z;
- int maxX = p1x > p2x ? p1x : p2x;
- int maxY = p1y > p2y ? p1y : p2y;
- int maxZ = p1z > p2z ? p1z : p2z;
- if (loc.getBlockX() >= minX && loc.getBlockX() <= maxX) {
- if (loc.getBlockY() >= minY && loc.getBlockY() <= maxY) {
- if (loc.getBlockZ() >= minZ && loc.getBlockZ() <= maxZ) {
- return rg;
- }
- }
- }
- }
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement