Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.JohnnyMccrum.JohnnyBaseMod.worldgen;
- import com.JohnnyMccrum.JohnnyBaseMod.Structure.StructureJohnnyFaceCave;
- import cpw.mods.fml.common.IWorldGenerator;
- 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 java.util.Random;
- /**
- * Created by Johnny on 23/02/2015.
- */
- public class WorldGen implements IWorldGenerator {
- private void generateSurface(World world, Random random, int x, int z)
- {
- //this.addSpawn(ModBlocks.johnnyFaceBlockRubble, world, random, x, z,16,16,4 + random.nextInt(6), 25, 38, 100);
- BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(x, z);
- if ((biome == BiomeGenBase.plains))
- {
- for(int a = 0; a < 1; a++)
- {
- int i = x + random.nextInt(256);
- int j = z + random.nextInt(256);
- int k = world.getHeightValue(i, j);
- new StructureJohnnyFaceCave().generate(world, random, i, k, j);
- }
- }
- }
- public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
- switch(world.provider.dimensionId){
- case 0 : generateSurface(world, random, chunkX * 16, chunkZ * 16);
- }
- }
- private void addSpawn(Block block, World world, Random random, int blockXPos , int blockZPos, int maxX, int maxZ, int maxVeinSize, int chanceToSpawn, int minY, int maxY)
- {
- for(int i = 0; i <chanceToSpawn; i++)
- {
- int posX = blockXPos + random.nextInt(maxX);
- int posY = minY + random.nextInt(maxY - minY);
- int posZ = blockZPos + random.nextInt(maxZ);
- (new WorldGenMinable(block, maxVeinSize)).generate(world, random, posX, posY, posZ);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement