OwenODG

MOre.java

Apr 29th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. package com.Owen.world;
  2.  
  3. import java.util.Random;
  4.  
  5. import com.Owen.blocks.MBlocks;
  6.  
  7. import cpw.mods.fml.common.IWorldGenerator;
  8. import net.minecraft.block.Block;
  9. import net.minecraft.init.Blocks;
  10. import net.minecraft.world.World;
  11. import net.minecraft.world.chunk.IChunkProvider;
  12. import net.minecraft.world.gen.feature.WorldGenMinable;
  13.  
  14. public class MOre implements IWorldGenerator {
  15.  
  16. @Override
  17. public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator,
  18. IChunkProvider chunkProvider) {
  19. switch(world.provider.dimensionId){
  20. case -1:
  21. generateNether(random, chunkX * 16, chunkZ * 16, world);
  22. break;
  23. case 0:
  24. generateOverworld(random, chunkX * 16, chunkZ * 16, world);
  25. break;
  26. case 1:
  27. generateEnd(random, chunkX * 16, chunkZ * 16, world);
  28. break;
  29. }
  30.  
  31. }
  32.  
  33. private void addOre(Block block, Block blockspawn, Random random, World world, int posX, int posZ, int minY, int maxY, int minVein, int maxVein, int spawnChance){
  34. for(int chunkX = 0; chunkX < spawnChance; chunkX++){
  35. int defaultChunkSize = 16;
  36.  
  37. int xPos = posX + random.nextInt(defaultChunkSize);
  38. int yPos = minY + random.nextInt(maxY - minY);
  39. int zPos = posZ + random.nextInt(defaultChunkSize);
  40.  
  41. new WorldGenMinable(block, (minVein + random.nextInt(maxVein - minVein)), blockspawn).generate(world, random, xPos, yPos, zPos);
  42. }
  43. }
  44.  
  45. private void generateEnd(Random random, int chunkX, int chunkZ, World world) {
  46. // TODO Auto-generated method stub
  47.  
  48. }
  49.  
  50. private void generateOverworld(Random random, int chunkX, int chunkZ, World world) {
  51. addOre(MBlocks.Plundarr, Blocks.stone, random, world, chunkX, chunkZ, 5, 100, 20, 20, 20);
  52.  
  53. }
  54.  
  55. private void generateNether(Random random, int chunkX, int chunkZ, World world) {
  56. // TODO Auto-generated method stub
  57.  
  58. }
  59.  
  60. }
Add Comment
Please, Sign In to add comment