Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package thegoldcrayon.thegoldcrayonsgemstonesmod;
- import java.util.Random;
- import net.minecraft.block.Block;
- import net.minecraft.init.Blocks;
- import net.minecraft.world.World;
- import net.minecraft.world.chunk.IChunkProvider;
- import net.minecraft.world.gen.feature.WorldGenMinable;
- import cpw.mods.fml.common.IWorldGenerator;
- public class OnyxOreGeneration implements IWorldGenerator {
- @Override
- public void generate(Random random, int chunkX, int chunkZ, World world,
- IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
- switch(world.provider.dimensionId)
- {
- case 0:
- generateOverWorld(world, random, chunkX, chunkZ);
- break;
- }
- }
- public void generateOverWorld(World world, Random rand, int x, int z){
- generateOre(TheGoldCrayonsGemstonesMod.blockOnyxOre, world, rand, x, z, 2, 8, 15, 20, 50, Blocks.stone);
- generateOre2(TheGoldCrayonsGemstonesMod.OTHERORE, world, rand, x, z, 2, 8, 15, 20, 50, Blocks.stone);
- }
- public void generateOre(Block block, World world, Random random, int chunkX, int chunkZ, int minVeinSize, int maxVeinSize, int chance, int minY, int maxY, Block generateIn){
- int veinSize = minVeinSize + random.nextInt(maxVeinSize - minVeinSize);
- int heightRange = maxY - minY;
- WorldGenMinable gen = new WorldGenMinable(block, veinSize, generateIn);
- for(int i = 0; i < chance; i++){
- int xRand = chunkX * 16 + random.nextInt(16);
- int yRand = random.nextInt(heightRange) + minY;
- int zRand = chunkZ * 16 + random.nextInt(16);
- gen.generate(world, random, xRand, yRand, zRand);
- }
- }
- public void generateOre2(Block block, World world, Random random, int chunkX, int chunkZ, int minVeinSize, int maxVeinSize, int chance, int minY, int maxY, Block generateIn){
- int veinSize = minVeinSize + random.nextInt(maxVeinSize - minVeinSize);
- int heightRange = maxY - minY;
- WorldGenMinable gen = new WorldGenMinable(block, veinSize, generateIn);
- for(int i = 0; i < chance; i++){
- int xRand = chunkX * 16 + random.nextInt(16);
- int yRand = random.nextInt(heightRange) + minY;
- int zRand = chunkZ * 16 + random.nextInt(16);
- gen.generate(world, random, xRand, yRand, zRand);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement