Advertisement
circuitdh

WorldGen

Sep 29th, 2016
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.21 KB | None | 0 0
  1. package bleachcraft.worldGen;
  2.  
  3.  
  4. import java.util.Random;
  5.  
  6. import net.minecraft.block.state.IBlockState;
  7. import net.minecraft.util.math.BlockPos;
  8. import net.minecraft.world.World;
  9. import net.minecraft.world.chunk.IChunkGenerator;
  10. import net.minecraft.world.chunk.IChunkProvider;
  11. import net.minecraft.world.gen.feature.WorldGenMinable;
  12. import net.minecraftforge.fml.common.IWorldGenerator;
  13.  
  14. public class WorldGenChlorineBlock implements IWorldGenerator
  15. {
  16.     @Override
  17.     public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,IChunkProvider chunkProvider) {
  18.         switch(world.provider.getDimension()){
  19.             case 0:
  20.                 generateSurface(world, random, chunkX*16, chunkZ*16);
  21.             break; 
  22.         }
  23.     }
  24.  
  25.     private void generateSurface(World world, Random rand, int chunkX, int chunkZ) {
  26.         for (int i = 0; i < 16; i++){
  27.             int randPosXX = chunkX + rand.nextInt(16);
  28.             int randPosYY = rand.nextInt(48);
  29.             int randPosZZ = chunkZ + rand.nextInt(16);
  30.            
  31.             BlockPos pos = new BlockPos(randPosXX,randPosYY,randPosZZ);
  32.             IBlockState state = bleachcraft.fluids.ChlorineBlock.instance.getDefaultState();
  33.            
  34.             new WorldGenMinable(state, 10)).generate(world, rand, pos);
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement