Advertisement
TechMage66

OreGenerator

Nov 29th, 2014
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.91 KB | None | 0 0
  1. package com.techmage.magetech.world;
  2.  
  3. import com.techmage.magetech.init.ModBlocks;
  4. import com.techmage.magetech.reference.Names;
  5. import com.techmage.magetech.utility.LogHelper;
  6. import cpw.mods.fml.common.IWorldGenerator;
  7. import net.minecraft.init.Blocks;
  8. import net.minecraft.world.World;
  9. import net.minecraft.world.chunk.IChunkProvider;
  10. import net.minecraft.world.gen.feature.WorldGenMinable;
  11.  
  12. import java.util.Random;
  13.  
  14. public class OreGenerator implements IWorldGenerator
  15. {
  16.     public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
  17.     {
  18.         switch (world.provider.dimensionId)
  19.         {
  20.             case -1:
  21.                 generateNether(world, random, chunkX * 16, chunkZ * 16);
  22.             case 0:
  23.                 generateSurface(world, random, chunkX * 16, chunkZ * 16);
  24.             case 1:
  25.                 generateEnd(world, random, chunkX * 16, chunkZ * 16);
  26.         }
  27.     }
  28.  
  29.     private void generateEnd(World world, Random random, int x, int z) { }
  30.  
  31.     private void generateSurface(World world, Random random, int x, int z)
  32.     {
  33.         for (int i = 0; i < 15; i++)
  34.         {
  35.             int randPosX = x + random.nextInt(16);
  36.             int randPosY = random.nextInt(48) + 48;
  37.             int randPosZ = z + random.nextInt(16);
  38.  
  39.             (new WorldGenMinable(ModBlocks.ore, 0, 4, Blocks.stone)).generate(world, random, randPosX, randPosY, randPosZ);
  40.         }
  41.  
  42.         for (int i = 0; i < 4; i++)
  43.         {
  44.             int randPosX = x + random.nextInt(16);
  45.             int randPosY = random.nextInt(32) + 32;
  46.             int randPosZ = z + random.nextInt(16);
  47.  
  48.             (new WorldGenMinable(ModBlocks.ore, 1, 6, Blocks.stone)).generate(world, random, randPosX, randPosY, randPosZ);
  49.         }
  50.  
  51.         for (int i = 0; i < 20; i++)
  52.         {
  53.             int randPosX = x + random.nextInt(16);
  54.             int randPosY = random.nextInt(64) + 64;
  55.             int randPosZ = z + random.nextInt(16);
  56.  
  57.             (new WorldGenMinable(ModBlocks.ore, 2, 8, Blocks.stone)).generate(world, random, randPosX, randPosY, randPosZ);
  58.         }
  59.  
  60.         for (int i = 0; i < 10; i++)
  61.         {
  62.             int randPosX = x + random.nextInt(16);
  63.             int randPosY = random.nextInt(64) + 64;
  64.             int randPosZ = z + random.nextInt(16);
  65.  
  66.             (new WorldGenMinable(ModBlocks.oreCrystal, 4, Blocks.stone)).generate(world, random, randPosX, randPosY, randPosZ);
  67.         }
  68.  
  69.         for (int i = 0; i < 25; i++)
  70.         {
  71.             int randPosX = x + random.nextInt(16);
  72.             int randPosY = random.nextInt(64) + 64;
  73.             int randPosZ = z + random.nextInt(16);
  74.  
  75.             (new WorldGenMinable(ModBlocks.oreSilicon, 6, Blocks.stone)).generate(world, random, randPosX, randPosY, randPosZ);
  76.         }
  77.     }
  78.  
  79.     private void generateNether(World world, Random random, int x, int z) { }
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement