Advertisement
Guest User

BushGeneration

a guest
Jan 15th, 2015
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.69 KB | None | 0 0
  1. package com.chef.mod.gen;
  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.biome.BiomeGenBase;
  9. import net.minecraft.world.biome.BiomeGenBeach;
  10. import net.minecraft.world.biome.BiomeGenForest;
  11. import net.minecraft.world.biome.BiomeGenHills;
  12. import net.minecraft.world.biome.BiomeGenOcean;
  13. import net.minecraft.world.biome.BiomeGenRiver;
  14. import net.minecraft.world.biome.BiomeGenTaiga;
  15. import net.minecraft.world.chunk.IChunkProvider;
  16.  
  17. import com.chef.mod.Chef;
  18. import com.chef.mod.gen.features.WorldGenBelBush;
  19. import com.chef.mod.gen.features.WorldGenStrawBush;
  20.  
  21. import cpw.mods.fml.common.IWorldGenerator;
  22.  
  23. public class BushGeneration implements IWorldGenerator {
  24. public int bugger;
  25. private static final String __OBFID = "CL_00000428";
  26.  
  27. @Override
  28. public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
  29. switch(world.provider.dimensionId)
  30. {
  31. case 1:
  32. generateEnd(world, random, chunkX, chunkZ);
  33. break;
  34. case 0:
  35. generateOverworld(world, random, chunkX, chunkZ);
  36. break;
  37. case -1:
  38. generateNether(world, random, chunkX, chunkZ);
  39. break;
  40. }
  41. }
  42.  
  43. public void generateEnd(World world, Random rand, int x, int z) {
  44.  
  45. }
  46.  
  47. public void generateOverworld(World world, Random random, int x, int z) {
  48. //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
  49. generateStrawBush(Chef.bushStrawberryBush, world, random, x, z, 5, 10, 10, 50, 100, Blocks.grass);
  50. generateBellBush(Chef.bushBellPepperBush, world, random, x, z, 5, 10, 10, 50, 100, Blocks.grass);
  51. }
  52.  
  53. public void generateNether(World world, Random rand, int x, int z) {
  54.  
  55. }
  56.  
  57. public void generateStrawBush(Block block, World world, Random random, int chunkX, int chunkZ, int minVienSize, int maxVienSize, int chance, int minY, int maxY, Block generateAt) {
  58. int vienSize = minVienSize + random.nextInt(maxVienSize - minVienSize);
  59. int heightRange = maxY - minY;
  60. WorldGenStrawBush gen = new WorldGenStrawBush(block, vienSize, generateAt);
  61. BiomeGenBase biome = world.getBiomeGenForCoords(chunkX, chunkZ);
  62.  
  63.  
  64. for (int i = 0; i < chance; i++) {
  65. int xRand = chunkX * 16 + random.nextInt(16);
  66. int yRand = random.nextInt(heightRange) + minY;
  67. int zRand = chunkZ * 16 + random.nextInt(16);
  68. gen.generate(world, random, xRand, yRand, zRand);
  69. }
  70. }
  71.  
  72. public void generateBellBush(Block block, World world, Random random, int chunkX, int chunkZ, int minVienSize, int maxVienSize, int chance, int minY, int maxY, Block generateAt) {
  73. int vienSize = minVienSize + random.nextInt(maxVienSize - minVienSize);
  74. int heightRange = maxY - minY;
  75. WorldGenBelBush gen = new WorldGenBelBush(block, vienSize, generateAt);
  76. BiomeGenBase biome = world.getBiomeGenForCoords(chunkX, chunkZ);
  77.  
  78. for (int i = 0; i < chance; i++) {
  79. int xRand = chunkX * 16 + random.nextInt(16);
  80. int yRand = random.nextInt(heightRange) + minY;
  81. int zRand = chunkZ * 16 + random.nextInt(16);
  82. gen.generate(world, random, xRand, yRand, zRand);
  83. }
  84. }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement