Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package tutoriel.common;
- import java.util.Random;
- import net.minecraft.block.Block;
- import net.minecraft.world.World;
- import net.minecraft.world.biome.BiomeGenBase;
- import net.minecraft.world.chunk.IChunkProvider;
- import net.minecraft.world.gen.feature.WorldGenMinable;
- import cpw.mods.fml.common.IWorldGenerator;
- public class WorldGeneratorTutoriel implements IWorldGenerator
- {
- @Override
- public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
- {
- switch(world.provider.dimensionId)
- {
- case -1:
- this.generateEnd(world, chunkX * 16, chunkZ * 16, random);
- case 0:
- this.generateSurface(world, chunkX * 16, chunkZ * 16, random);
- case 1:
- this.generateNether(world, chunkX * 16, chunkZ * 16, random);
- }
- }
- private void generateSurface(World world, int x, int z, Random rand)
- {
- for(int i = 0; i < 2; i++)
- {
- int targetX1 = x + rand.nextInt(16);
- int targetY1 = rand.nextInt(64);
- int targetZ1 = z + rand.nextInt(16);
- (new WorldGenMinable(ModTutoriel.TutorialMetadata.blockID, 0, 4, Block.stone.blockID)).generate(world, rand, targetX1, targetY1, targetZ1);
- }
- if(world.getBiomeGenForCoords(x, z).equals(BiomeGenBase.extremeHills))
- {
- for(int i = 0; i < 8; i++)
- {
- int targetX2 = x + rand.nextInt(16);
- int targetY2 = rand.nextInt(64);
- int targetZ2 = z + rand.nextInt(16);
- (new WorldGenMinable(ModTutoriel.TutorialMetadata.blockID, 5, 12, Block.stone.blockID)).generate(world, rand, targetX2, targetY2, targetZ2);
- }
- }
- }
- private void generateEnd(World world, int x, int z, Random rand)
- {
- for(int i = 0; i < 4; i++)
- {
- int targetX2 = x + rand.nextInt(16);
- int targetY2 = rand.nextInt(64);
- int targetZ2 = z + rand.nextInt(16);
- (new WorldGenMinable(ModTutoriel.BlockTutorial.blockID, 0, 12, Block.whiteStone.blockID)).generate(world, rand, targetX2, targetY2, targetZ2);
- }
- }
- private void generateNether(World world, int x, int z, Random rand)
- {
- for(int i = 0; i < 20; i++)
- {
- int targetX2 = x + rand.nextInt(16);
- int targetY2 = rand.nextInt(64);
- int targetZ2 = z + rand.nextInt(16);
- (new WorldGenMinable(ModTutoriel.TutorialMetadata.blockID, 2, 12, Block.slowSand.blockID)).generate(world, rand, targetX2, targetY2, targetZ2);
- }
- for(int i = 0; i < 10; i++)
- {
- int targetX2 = x + rand.nextInt(16);
- int targetY2 = rand.nextInt(64);
- int targetZ2 = z + rand.nextInt(16);
- (new WorldGenMinable(ModTutoriel.TutorialMetadata.blockID, 3, 12, Block.netherrack.blockID)).generate(world, rand, targetX2, targetY2, targetZ2);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement