Advertisement
Guest User

Untitled

a guest
Feb 25th, 2015
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.01 KB | None | 0 0
  1. package com.JohnnyMccrum.JohnnyBaseMod.worldgen;
  2.  
  3. import com.JohnnyMccrum.JohnnyBaseMod.Structure.StructureJohnnyFaceCave;
  4. import cpw.mods.fml.common.IWorldGenerator;
  5. import net.minecraft.block.Block;
  6. import net.minecraft.world.World;
  7. import net.minecraft.world.biome.BiomeGenBase;
  8. import net.minecraft.world.chunk.IChunkProvider;
  9. import net.minecraft.world.gen.feature.WorldGenMinable;
  10.  
  11. import java.util.Random;
  12.  
  13. /**
  14.  * Created by Johnny on 23/02/2015.
  15.  */
  16. public class WorldGen implements IWorldGenerator {
  17.  
  18.  
  19.  
  20.  
  21.  
  22.     private void generateSurface(World world, Random random, int x, int z)
  23.     {
  24.     //this.addSpawn(ModBlocks.johnnyFaceBlockRubble, world, random, x, z,16,16,4 + random.nextInt(6), 25, 38, 100);
  25.  
  26.         BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(x, z);
  27.  
  28.  
  29.  
  30.         if ((biome == BiomeGenBase.plains))
  31.  
  32.         {
  33.  
  34.             for(int a = 0; a < 1; a++)
  35.  
  36.             {
  37.  
  38.                 int i = x + random.nextInt(256);
  39.  
  40.                 int j = z + random.nextInt(256);
  41.  
  42.                 int k   = world.getHeightValue(i, j);
  43.  
  44.                 new StructureJohnnyFaceCave().generate(world, random, i, k, j);
  45.  
  46.             }
  47.  
  48.         }
  49.  
  50.  
  51.     }
  52.  
  53.     public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
  54.  
  55.         switch(world.provider.dimensionId){
  56.             case 0 : generateSurface(world, random, chunkX * 16, chunkZ * 16);
  57.  
  58.         }
  59.     }
  60.  
  61.  
  62.     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)
  63.     {
  64.         for(int i = 0; i <chanceToSpawn; i++)
  65.         {
  66.             int posX = blockXPos + random.nextInt(maxX);
  67.             int posY = minY + random.nextInt(maxY - minY);
  68.             int posZ = blockZPos + random.nextInt(maxZ);
  69.             (new WorldGenMinable(block,  maxVeinSize)).generate(world, random, posX, posY, posZ);
  70.         }
  71.     }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement