Advertisement
Guest User

WorldGen

a guest
Feb 19th, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.04 KB | None | 0 0
  1. public class ModWorldGen implements IWorldGenerator {
  2.     @Override
  3.     public void generate(Random random, int chunkx, int chunkz, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
  4.         if(world.provider.getDimension() == 0) {
  5.             generateOverworld(random, chunkx, chunkz, world, chunkGenerator, chunkProvider);
  6.         }
  7.     }
  8.    
  9.     private void generateOverworld(Random random, int chunkx, int chunkz, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider){
  10.         generateOre(ModBlocks.RUBY_ORE.getDefaultState(), world, random, chunkx * 16, chunkz * 16, 16, 64, random.nextInt(7) + 4, 30);
  11.     }
  12.    
  13.     private void generateOre(IBlockState ore, World world, Random random, int x, int z, int miny, int maxy, int size, int chances) {
  14.         int deltay = maxy - miny;
  15.        
  16.         for(int i = 0; i < chances; i++){
  17.             BlockPos pos = new BlockPos(x + random.nextInt(16), miny + random.nextInt(deltay), z + random.nextInt(16));
  18.            
  19.             WorldGenMinable generator = new WorldGenMinable(ore, size);
  20.             generator.generate(world, random, pos);
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement