SHOW:
|
|
- or go back to the newest paste.
1 | - | public static Boolean isInside(Location loc, Location corner1, Location corner2) { |
1 | + | public static Boolean contains(Material m, Location corner1, Location corner2){ |
2 | - | double xMin = 0; |
2 | + | int xMin = 0; |
3 | - | double xMax = 0; |
3 | + | int xMax = 0; |
4 | - | double yMin = 0; |
4 | + | int yMin = 0; |
5 | - | double yMax = 0; |
5 | + | int yMax = 0; |
6 | - | double zMin = 0; |
6 | + | int zMin = 0; |
7 | - | double zMax = 0; |
7 | + | int zMax = 0; |
8 | - | double x = loc.getX(); |
8 | + | |
9 | - | double y = loc.getY(); |
9 | + | xMin = Math.min(corner1.getBlockX(), corner2.getBlockX()); |
10 | - | double z = loc.getZ(); |
10 | + | xMax = Math.max(corner1.getBlockX(), corner2.getBlockX()); |
11 | ||
12 | - | xMin = Math.min(corner1.getX(), corner2.getX()); |
12 | + | yMin = Math.min(corner1.getBlockY(), corner2.getBlockY()); |
13 | - | xMax = Math.max(corner1.getX(), corner2.getX()); |
13 | + | yMax = Math.max(corner1.getBlockY(), corner2.getBlockY()); |
14 | ||
15 | - | yMin = Math.min(corner1.getY(), corner2.getY()); |
15 | + | zMin = Math.min(corner1.getBlockZ(), corner2.getBlockZ()); |
16 | - | yMax = Math.max(corner1.getY(), corner2.getY()); |
16 | + | zMax = Math.max(corner1.getBlockZ(), corner2.getBlockZ()); |
17 | ||
18 | - | zMin = Math.min(corner1.getZ(), corner2.getZ()); |
18 | + | for (int px = xMin; px <= xMax; px++) { |
19 | - | zMax = Math.max(corner1.getZ(), corner2.getZ()); |
19 | + | for (int py = yMin; py <= yMax; py++) { |
20 | for (int pz = zMin; pz <= zMax; pz++) { | |
21 | - | return (x >= xMin && x <= xMax && y >= yMin && y <= yMax && z >= zMin && z <= zMax); |
21 | + | if(Equinox.getInstance().getServer().getWorld(Rotation.getRot().getCurrentMap().getWorldName()).getBlockAt(px, py, pz).getType() == m){ |
22 | return false; | |
23 | }else{ | |
24 | return true; | |
25 | } | |
26 | } | |
27 | } | |
28 | } | |
29 | return false; | |
30 | } |