Advertisement
circuitdh

WorldGenSodiumBlock

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