Guest User

populate

a guest
Feb 26th, 2023
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. @Override
  2. public void populate(WorldInfo worldInfo, Random random, int chunkX, int chunkZ, LimitedRegion limitedRegion) {
  3. int X, Y , Z;
  4. World world = Bukkit.getWorld(worldInfo.getName());
  5. for (X = 0; X < 16; X++)
  6. for (Z = 0; Z < 16; Z++) {
  7.  
  8. int Xcord = (chunkX * 16) + X;
  9. int Zcord = (chunkZ * 16) + Z;
  10.  
  11. if(!limitedRegion.isInRegion(Xcord, 0, Zcord))
  12. continue;
  13. for (Y = world.getMaxHeight() - 1; limitedRegion.getBlockData(Xcord, Y, Zcord).getMaterial() == Material.AIR; Y--);
  14. //logger.info("Surface at x:" + Xcord + " y:" + Y + " z:" + Zcord);
  15. for (; Y > -65; Y--){
  16. if (oreMaterial.contains(limitedRegion.getBlockData(Xcord, Y, Zcord).getMaterial())){
  17. logger.info("Cave block found at x:" + Xcord + " y:" + Y + " z:" + Zcord + " and Type is " + limitedRegion.getBlockData(Xcord, Y, Zcord).getMaterial());
  18. limitedRegion.setBlockData(Xcord, Y, Zcord, Bukkit.createBlockData(Material.SPONGE));
  19. }
  20. if (deepOreMaterial.contains(limitedRegion.getBlockData(Xcord, Y, Zcord).getMaterial())){
  21. logger.info("Cave block found at x:" + Xcord + " y:" + Y + " z:" + Zcord + " and Type is " + limitedRegion.getBlockData(Xcord, Y, Zcord).getMaterial());
  22. limitedRegion.setBlockData(Xcord, Y, Zcord, Bukkit.createBlockData(Material.SPONGE));
  23. }
  24.  
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment