Advertisement
X39

org.X39.mods.minecraft.tecmod.startPack.ModWorldGen

X39
Mar 9th, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.20 KB | None | 0 0
  1. package org.X39.mods.minecraft.tecmod.startPack;
  2.  
  3. import java.util.Random;
  4.  
  5. import net.minecraft.world.World;
  6. import net.minecraft.world.chunk.IChunkProvider;
  7. import net.minecraft.world.gen.feature.WorldGenMinable;
  8.  
  9. import cpw.mods.fml.common.IWorldGenerator;
  10.  
  11. public class ModWorldGen implements IWorldGenerator {
  12.  
  13.         @Override
  14.         public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
  15.                 switch(world.provider.dimensionId) {
  16.                 case -1:
  17.                         generateNether();
  18.                         break;
  19.                 case 0:
  20.                         generateSurface(world, random, chunkX*16, chunkZ*16);
  21.                         break;
  22.                 case 1:
  23.                         generateEnd();
  24.                         break;
  25.                 }
  26.         }
  27.        
  28.         public void generateNether() {
  29.            
  30.         }
  31.        
  32.     public void generateSurface(World world, Random rand, int chunkX, int chunkZ) {
  33.         if (rand.nextInt(10) == 5)
  34.             for (int i = 0; i < 5; i++) {
  35.                 int randPosX = chunkX + rand.nextInt(16);
  36.                 int randPosY = rand.nextInt(32);
  37.                 int randPosZ = chunkZ + rand.nextInt(16);
  38.                 // System.out.println(randPosX + " - " + randPosY + " - " + randPosZ);
  39.                 (new WorldGenMinable(ModBlocks.UraniumOre.blockID, 10)).generate(world, rand, randPosX, randPosY, randPosZ);
  40.             }
  41.         for (int i = 0; i < 6; i++) {
  42.             int randPosX = chunkX + rand.nextInt(16);
  43.             int randPosY = rand.nextInt(40);
  44.             int randPosZ = chunkZ + rand.nextInt(16);
  45.             // System.out.println(randPosX + " - " + randPosY + " - " + randPosZ);
  46.             (new WorldGenMinable(ModBlocks.CopperOre.blockID, 6)).generate(world, rand, randPosX, randPosY, randPosZ);
  47.         }
  48.         for (int i = 0; i < 4; i++) {
  49.             int randPosX = chunkX + rand.nextInt(16);
  50.             int randPosY = rand.nextInt(20);
  51.             int randPosZ = chunkZ + rand.nextInt(16);
  52.             // System.out.println(randPosX + " - " + randPosY + " - " + randPosZ);
  53.             (new WorldGenMinable(ModBlocks.TeridiumOre.blockID, 6)).generate(world, rand, randPosX, randPosY, randPosZ);
  54.         }
  55.     }
  56.        
  57.         public void generateEnd() {
  58.            
  59.         }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement