Guest User

Untitled

a guest
Aug 23rd, 2015
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.82 KB | None | 0 0
  1. package com.piratecody.nethercraft.generation;
  2.  
  3. import java.util.Random;
  4.  
  5. import net.minecraft.block.Block;
  6. import net.minecraft.world.World;
  7. import net.minecraft.world.chunk.IChunkProvider;
  8. import net.minecraft.world.gen.feature.WorldGenMinable;
  9. import cpw.mods.fml.common.IWorldGenerator;
  10.  
  11. import com.piratecody.nethercraft.blocks.*;
  12. import com.piratecody.nethercraft.init.NCBlocks;
  13.  
  14. public class NCWorldGeneration implements IWorldGenerator{
  15.    
  16.     public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
  17.     {
  18.         switch (world.provider.dimensionId)
  19.         {
  20.             case 0:
  21.                 generateSurface(world, random, chunkX * 16, chunkZ * 16);
  22.             case -1:
  23.                 generateNether(world, random, chunkX * 16, chunkZ * 16);
  24.             case 1:
  25.                 generateEnd(world, random, chunkX * 16, chunkZ * 16);
  26.         }
  27.  
  28.     }
  29.  
  30.         private void generateSurface(World world, Random random, int x, int z)
  31.         {
  32.             addOreSpawn(NCBlocks.corruptIronOre, world, random, x, z, 16, 16, 3 + random.nextInt(3), 100, 0, 80);
  33.         }
  34.  
  35.         private void generateNether(World world, Random random, int x, int z)
  36.         {
  37.             addOreSpawn(NCBlocks.corruptIronOre, world, random, x, z, 16, 16, 3 + random.nextInt(3), 100, 0, 80);
  38.         }
  39.  
  40.         private void generateEnd(World world, Random random, int x, int z)
  41.         {
  42.        
  43.         }
  44.        
  45.        
  46.        
  47.         private void addOreSpawn(Block block, World world, Random random, int blockXPos, int blockZPos, int maxX, int maxZ, int maxVeinSize, int chanceToSpawn, int minY, int maxY)
  48.         {
  49.             for (int i = 0; i < chanceToSpawn; i++)
  50.             {
  51.                 int posX = blockXPos + random.nextInt(maxX);
  52.                 int posY = minY + random.nextInt(maxY - minY);
  53.                 int posZ = blockZPos + random.nextInt(maxZ);
  54.                 new WorldGenMinable(block, maxVeinSize).generate(world, random, posX, posY, posZ);
  55.             }
  56.         }
  57.  
  58. }
Advertisement
Add Comment
Please, Sign In to add comment