DeathNeroLP

Region.java

Jun 23rd, 2015
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. public class Region{
  2.  
  3. public int minX;
  4. public int minY;
  5. public int minZ;
  6. public int maxX;
  7. public int maxY;
  8. public int maxZ;
  9. public World world;
  10.  
  11. public Region(Location loc1,Location loc2){
  12. this.minX = Math.min(loc1.getBlockX(), loc2.getBlockX());
  13. this.minY = Math.min(loc1.getBlockY(), loc2.getBlockY());
  14. this.minZ = Math.min(loc1.getBlockZ(), loc2.getBlockZ());
  15. this.maxX = Math.max(loc1.getBlockX(), loc2.getBlockX());
  16. this.maxY = Math.max(loc1.getBlockY(), loc2.getBlockY());
  17. this.maxZ = Math.max(loc1.getBlockZ(), loc2.getBlockZ());
  18. this.world = loc1.getWorld();
  19. }
  20.  
  21. public void setMap() {
  22. Map<String,Object> o = new HashMap<String,Object>();
  23. o.put("minX", this.minX);
  24. o.put("minY", this.minY);
  25. o.put("minZ", this.minZ);
  26. o.put("maxX", this.maxX);
  27. o.put("maxY", this.maxY);
  28. o.put("maxZ", this.maxZ);
  29. o.put("welt", this.world);
  30. }
  31.  
  32. public boolean isInside(Location loc){
  33. if(loc.getWorld() != this.world){
  34. return false;
  35. }
  36. if ((loc.getBlockX() <= this.minX) || (loc.getBlockX() >= this.maxX) || (loc.getBlockY() <= this.minY) || (loc.getBlockY() >= this.maxY) || (loc.getBlockZ() <= this.minZ) || (loc.getBlockZ() >= this.maxZ)){
  37. return true;
  38. }
  39. return false;
  40. }
  41.  
  42. public void setBlocks(Location loc){
  43. for(int x = this.minX; x < loc.getBlockX(); x++){
  44. for(int y = 1; y <= 256; y++){
  45. for(int z = this.minZ; z < loc.getBlockZ(); z++){
  46. this.world.getBlockAt(x,y,z).setType(Material.GLASS);
  47. }
  48. }
  49. }
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment