Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.HarmonionTeam.DKICore.World;
- import java.util.Arrays;
- import java.util.Iterator;
- import java.util.List;
- import java.util.Random;
- import net.HarmonionTeam.DKICore.Blocks.ModBlocks;
- import net.minecraft.block.Block;
- import net.minecraft.world.World;
- import net.minecraft.world.biome.BiomeGenBase;
- import net.minecraft.world.chunk.IChunkProvider;
- import cpw.mods.fml.common.IWorldGenerator;
- public class DKICoreWorldGenHandler implements IWorldGenerator
- {
- public static boolean[] sGeneratedOres = { true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true };
- public void generate(Random aRandom, int aX, int aZ, World aWorld, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider)
- {
- String tBiome = aWorld.getBiomeGenForCoords(aX + 8, aZ + 8).biomeName;
- if (tBiome.equals(BiomeGenBase.hell.biomeName))
- generateNether(aWorld, aRandom, aX * 16, aZ * 16, aChunkGenerator, aChunkProvider);
- else if (tBiome.equals(BiomeGenBase.sky.biomeName))
- generateEnd(aWorld, aRandom, aX * 16, aZ * 16, aChunkGenerator, aChunkProvider);
- else
- generateSurface(aWorld, aRandom, aX * 16, aZ * 16, aChunkGenerator, aChunkProvider);
- }
- private void generateSurface(World aWorld, Random aRandom, int aX, int aZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider)
- {
- String tBiome = aWorld.getBiomeGenForCoords(aX + 8, aZ + 8).biomeName;
- if (sGeneratedOres[1] != false) {
- for (int i = 0; i < 5; i++)
- new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 0, 12, false, Block.stone.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(32), aZ + aRandom.nextInt(16));
- for (int i = 0; i < 3; i++)
- new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 4, 6, false, Block.stone.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(32), aZ + aRandom.nextInt(16));
- for (int i = 0; i < 2; i++)
- new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 8, 1, false, Block.stone.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(32), aZ + aRandom.nextInt(16));
- for (int i = 0; i < 5; i++)
- new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 12, 6, false, Block.stone.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(32), aZ + aRandom.nextInt(16));
- for (int i = 0; i < 2; i++)
- new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 3, 3, false, Block.gravel.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(32), aZ + aRandom.nextInt(16));
- for (int i = 0; i < 2; i++)
- new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 7, 3, false, Block.gravel.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(32), aZ + aRandom.nextInt(16));
- for (int i = 0; i < 2; i++)
- new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 11, 3, false, Block.gravel.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(32), aZ + aRandom.nextInt(16));
- for (int i = 0; i < 2; i++)
- new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 15, 3, false, Block.gravel.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(32), aZ + aRandom.nextInt(16));
- }
- }
- private void generateNether(World aWorld, Random aRandom, int aX, int aZ, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
- {
- int tQuantity = (1 + aRandom.nextInt(2)) * (1 + aRandom.nextInt(2)) * (1 + aRandom.nextInt(2)) * (1 + aRandom.nextInt(2));
- if (sGeneratedOres[1] != false) {
- for (int i = 0; i < tQuantity; i++)
- new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 1, tQuantity * 2, false, Block.netherrack.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(64), aZ + aRandom.nextInt(16));
- for (int i = 0; i < tQuantity; i++)
- new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 5, tQuantity * 2, false, Block.netherrack.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(64), aZ + aRandom.nextInt(16));
- for (int i = 0; i < tQuantity; i++)
- new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 9, tQuantity * 2, false, Block.netherrack.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(64), aZ + aRandom.nextInt(16));
- for (int i = 0; i < tQuantity; i++)
- new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 13, tQuantity * 2, false, Block.netherrack.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(64), aZ + aRandom.nextInt(16));
- }
- }
- private void generateEnd(World aWorld, Random aRandom, int aX, int aZ, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
- if (sGeneratedOres[1] != false) {
- for (int i = 0; i < 9; i++)
- new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 2, 12, false, Block.whiteStone.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(64), aZ + aRandom.nextInt(16));
- for (int i = 0; i < 6; i++)
- new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 6, 6, false, Block.whiteStone.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(64), aZ + aRandom.nextInt(16));
- for (int i = 0; i < 3; i++)
- new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 10, 3, false, Block.whiteStone.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(64), aZ + aRandom.nextInt(16));
- for (int i = 0; i < 9; i++)
- new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 14, 6, false, Block.whiteStone.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(64), aZ + aRandom.nextInt(16));
- }
- }
- private void placeSingleOreBlock(World aWorld, int aID, int aMeta, int aX, int aY, int aZ, int aBlockID) {
- Block block = Block.blocksList[aWorld.getBlockId(aX, aY, aZ)];
- if ((block != null) && (block.isGenMineableReplaceable(aWorld, aX, aY, aZ, aBlockID)))
- aWorld.setBlock(aX, aY, aZ, aID, aMeta, 0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement