Advertisement
Guest User

BushGeneration

a guest
Jan 13th, 2015
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. package com.chef.mod.generate;
  2.  
  3. import java.util.Random;
  4.  
  5. import net.minecraft.block.Block;
  6. import net.minecraft.init.Blocks;
  7. import net.minecraft.world.World;
  8. import net.minecraft.world.chunk.IChunkProvider;
  9.  
  10. import com.chef.mod.Chef;
  11.  
  12. import cpw.mods.fml.common.IWorldGenerator;
  13.  
  14. public class BushGeneration implements IWorldGenerator {
  15. public int bugger;
  16. private static final String __OBFID = "CL_00000428";
  17.  
  18. @Override
  19. public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
  20. switch(world.provider.dimensionId)
  21. {
  22. case 1:
  23. generateEnd(world, random, chunkX, chunkZ);
  24. break;
  25. case 0:
  26. generateOverworld(world, random, chunkX, chunkZ);
  27. break;
  28. case -1:
  29. generateNether(world, random, chunkX, chunkZ);
  30. break;
  31. }
  32. }
  33.  
  34. public void generateEnd(World world, Random rand, int x, int z) {
  35.  
  36. }
  37.  
  38. public void generateOverworld(World world, Random random, int x, int z) {
  39. //world, rand, x, z, Minimal blocks to spawn, Maximal blocks to spawn, Chance to spawn, Minimal height to spawn, Maximal height to spawn, Block to spawn in
  40. generateBush(world, random, x, z, 1, 3, 1, 50, 100, Blocks.grass);
  41. }
  42.  
  43. public void generateNether(World world, Random rand, int x, int z) {
  44.  
  45. }
  46.  
  47. public void generateBush(World world, Random random, int chunkX, int chunkZ, int minVienSize, int maxVienSize, int chance, int minY, int maxY, Block generateAt) {
  48. int vienSize = minVienSize + random.nextInt(maxVienSize - minVienSize);
  49. int heightRange = maxY - minY;
  50. WorldGenBush gen = new WorldGenBush(vienSize, generateAt);
  51. for (int i = 0; i < chance; i++) {
  52. int xRand = chunkX * 16 + random.nextInt(16);
  53. int yRand = random.nextInt(heightRange) + minY;
  54. int zRand = chunkZ * 16 + random.nextInt(16);
  55. gen.generate(world, random, xRand, yRand, zRand);
  56. }
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement