Guest User

populate

a guest
Feb 26th, 2023
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 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.  
  6. Bukkit.getConsoleSender().sendMessage(String.valueOf(limitedRegion.getBuffer()));
  7.  
  8. for (X = 0; X < 16; X++)
  9. for (Z = 0; Z < 16; Z++) {
  10. if(!limitedRegion.isInRegion(X * chunkX, 0, Z * chunkZ))
  11. return;
  12. Chunk chunk = world.getChunkAt(X * chunkX, Z * chunkZ);
  13. for (Y = world.getMaxHeight() - 1; chunk.getBlock(X, Y, Z).getType() == Material.AIR; Y--);
  14. logger.info("Surface at x:" + X + " y:" + Y + " z:" + Z);
  15. for (; Y > 0; Y--)
  16. if (isOreType(chunk.getBlock(X, Y, Z).getType())) {
  17. logger.info("Cave block found at x:" + X + " y:" + Y + " z:" + Z + " and Type is " + chunk.getBlock(X, Y, Z).getType().toString());
  18. chunk.getBlock(X, Y, Z).setType(Material.STONE, false);
  19. }
  20.  
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment