Guest User

populate

a guest
Feb 26th, 2023
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 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. if(!limitedRegion.isInRegion(chunkX * 16, 0, chunkZ * 16))
  8. return;
  9. for (Y = world.getMaxHeight() - 1; limitedRegion.getBlockData(X, Y, Z).getMaterial() == Material.AIR; Y--);
  10. logger.info("Surface at x:" + X + " y:" + Y + " z:" + Z);
  11. for (; Y > 0; Y--)
  12. if (isOreType(limitedRegion.getBlockData(X, Y, Z).getMaterial())) {
  13. logger.info("Cave block found at x:" + X + " y:" + Y + " z:" + Z + " and Type is " + limitedRegion.getBlockData(X, Y, Z).getMaterial());
  14. limitedRegion.setBlockData(X, Y, Z, Bukkit.createBlockData(Material.STONE));;
  15. }
  16.  
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment