OSDN Git Service

7acf7f107fb59e1550a9ef19263c2500162e72c9
[chemicraft/chemicraft.git] / common / pcc / chemicraft / base / gen / WorldGenAtomsOre.java
1 package pcc.chemicraft.base.gen;
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 import cpw.mods.fml.common.IWorldGenerator;
9
10 public class WorldGenAtomsOre extends WorldGenMinable implements IWorldGenerator {
11
12         private int frequency;
13         private int posY;
14
15         public WorldGenAtomsOre(int id, int meta, int size, int frequency, int posY) {
16                 super(id, meta, size);
17                 this.frequency = frequency;
18                 this.posY = posY;
19         }
20
21         public WorldGenAtomsOre(int id, int meta, int size, EnumOreSpawnFrequency frequency, int posY) {
22                 super(id, meta, size);
23                 this.frequency = frequency.getFrequency();
24                 this.posY = posY;
25         }
26         
27         @Override
28         public void generate(Random par1Random, int par2ChunkX, int par3ChunkZ, World par4World, IChunkProvider par5ChunkGenerator, IChunkProvider par6ChunkProvider) {
29                 for (int i = 0; i < this.frequency; i++) {
30                         this.generate(par4World, par1Random, par2ChunkX * 16 + par1Random.nextInt(16), par1Random.nextInt(this.posY), par3ChunkZ * 16 + par1Random.nextInt(16));
31                 }
32         }
33
34 }