OSDN Git Service

修正・変更
[chemicraft/chemicraft.git] / common / pcc / chemicraft / base / gen / WorldGenAtomOres.java
1 package pcc.chemicraft.base.gen;
2
3 import java.util.Random;
4
5 import net.minecraft.block.Block;
6 import net.minecraft.world.World;
7 import net.minecraft.world.chunk.IChunkProvider;
8 import net.minecraft.world.gen.feature.WorldGenMinable;
9 import cpw.mods.fml.common.IWorldGenerator;
10
11 /**
12  * 鉱石生成のインスタンスです
13  * @author mozipi,ponkotate,つやぴん
14  */
15 public class WorldGenAtomOres extends WorldGenMinable implements IWorldGenerator {
16
17         /**
18          * 生成率
19          */
20         private int frequency;
21
22         /**
23          * 鉱石生成の高度
24          */
25         private int posY;
26
27         public WorldGenAtomOres(int id, int meta, int size, int frequency, int posY) {
28                 super(id, meta, size, Block.stone.blockID);
29                 this.frequency = frequency;
30                 this.posY = posY;
31         }
32
33         public WorldGenAtomOres(int id, int meta, EnumOreSpawnFrequency frequency) {
34                 this(id, meta, frequency.getSize(), frequency.getFrequency(), frequency.getPosY());
35         }
36
37         @Override
38         public void generate(Random par1Random, int par2ChunkX, int par3ChunkZ, World par4World, IChunkProvider par5ChunkGenerator, IChunkProvider par6ChunkProvider) {
39                 for (int i = 0; i < this.frequency; i++) {
40                         this.generate(par4World, par1Random, par2ChunkX * 16 + par1Random.nextInt(16), par1Random.nextInt(this.posY), par3ChunkZ * 16 + par1Random.nextInt(16));
41                 }
42         }
43
44 }