Advertisement
Guest User

WorldGenerator

a guest
Jul 6th, 2014
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. package net.endernoobs.rpgmod;
  2.  
  3. import java.util.Random;
  4.  
  5. import cpw.mods.fml.common.IWorldGenerator;
  6. import net.minecraft.init.Blocks;
  7. import net.minecraft.world.World;
  8. import net.minecraft.world.biome.BiomeGenBase;
  9. import net.minecraft.world.chunk.IChunkProvider;
  10.  
  11. public class WorldGenerator implements IWorldGenerator {
  12. public void generate(Random random, int chunkX, int chunkZ, World world,
  13. IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
  14. switch (world.provider.dimensionId) {
  15. case -1:
  16. generateNether(world, random, chunkX * 16, chunkZ * 16);
  17. case 0:
  18. generateSurface(world, random, chunkX * 16, chunkZ * 16);
  19. }
  20. }
  21.  
  22. public void generateHauntedHouse(World world, Random random, int i, int j,
  23. int k) {
  24.  
  25. }
  26.  
  27. Random r = new Random();
  28.  
  29. private void generateSurface(World world, Random random, int blockX,
  30. int blockZ) {
  31. float chance = r.nextFloat();
  32. BiomeGenBase b = world.getBiomeGenForCoords(blockX, blockZ);
  33. if (chance <= 0.01f) {
  34. if (b.biomeName.equals("Plains")) {
  35. int i = blockX + random.nextInt(16);
  36. int j = random.nextInt(80);
  37. int k = blockZ + random.nextInt(16);
  38.  
  39. (new WorldGenHauntedHouse()).generate(world, random, i, j, k);
  40. }
  41. }
  42. }
  43.  
  44. private void generateNether(World world, Random random, int blockX,
  45. int blockZ) {
  46.  
  47. }
  48.  
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement