Advertisement
NathanHam89

World Generator

Apr 20th, 2015
47
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.penumbral.steelworks.world;
  2.  
  3. import java.util.Random;
  4.  
  5. import net.minecraft.block.Block;
  6. import net.minecraft.block.state.pattern.BlockHelper;
  7. import net.minecraft.init.Blocks;
  8. import net.minecraft.util.BlockPos;
  9. import net.minecraft.world.World;
  10. import net.minecraft.world.chunk.IChunkProvider;
  11. import net.minecraft.world.gen.feature.WorldGenMinable;
  12. import net.minecraftforge.fml.common.IWorldGenerator;
  13.  
  14. import com.penumbral.steelworks.init.SteelworksBlocks;
  15.  
  16. public class OreGeneration implements IWorldGenerator{
  17.  
  18.     @Override
  19.     public void generate(Random random, int chunkX, int chunkZ, World world,
  20.             IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
  21.         switch(world.provider.getDimensionId()) {
  22.             case 1:
  23.                 generateEnd(world, random, chunkX * 16, chunkZ * 16);
  24.                 break;
  25.             case 0:
  26.                 generateOverworld(world, random, chunkX * 16, chunkZ * 16);
  27.                 break;
  28.             case -1:
  29.                 generateNether(world, random, chunkX * 16, chunkZ * 16);
  30.                 break;
  31.         }
  32.     }
  33.    
  34.     private void generateEnd(World world, Random random, int x, int z) {
  35.        
  36.     }
  37.    
  38.     public void generateOverworld(World world, Random random, int x, int z) {
  39.        
  40.         int x1 = x + random.nextInt(16);
  41.         int y = 0 + random.nextInt(64-0);  
  42.         int z1 = z + random.nextInt(16);
  43.  
  44.         (new FireClayGen(SteelworksBlocks.fire_clayblock, 100)).generate(world, random, new BlockPos(x1, y, z1));
  45.     }
  46.  
  47.     private void generateNether(World world, Random random, int x, int z) {
  48.        
  49.     }
  50.  
  51.     public void generateOre(Block block, World world, Random random, int posX, int posZ, int minVein, int maxVein, int spawnChance, int minY, int maxY)
  52.     {
  53.         WorldGenMinable gen = new WorldGenMinable(block.getDefaultState(), (minVein + random.nextInt(maxVein - minVein)), BlockHelper.forBlock(Blocks.clay));
  54.         for (int i = 0; i < spawnChance; i++) {
  55.             int xPos = posX + random.nextInt(16);
  56.             int yPos = minY + random.nextInt(maxY - minY);
  57.             int zPos = posZ + random.nextInt(16);
  58.             gen.generate(world, random, new BlockPos(xPos, yPos, zPos));
  59.         }
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement