Advertisement
Guest User

Untitled

a guest
Aug 21st, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. package com.mightydanp.eot.common.world.gen;
  2.  
  3. import com.mightydanp.eot.api.common.world.gen.WorldGenCore;
  4. import com.mightydanp.eot.common.block.ModBlocks;
  5. import com.mightydanp.eot.common.world.gen.feature.WorldGenTwigsAndRocks;
  6. import net.minecraft.block.Block;
  7. import net.minecraft.util.math.BlockPos;
  8. import net.minecraft.world.World;
  9.  
  10. import java.util.Random;
  11.  
  12. /**
  13. * Created by MightyDanp on 8/21/2017.
  14. */
  15. public class WorldGen extends WorldGenCore {
  16. @Override
  17. public void generateNether(World world, Random random, int chunkX, int chunkZ) {
  18.  
  19. }
  20.  
  21. @Override
  22. public void generateSurface(World world, Random random, int chunkX, int chunkZ) {
  23. // int rand = new Random().nextInt(100);
  24. this.spawnTwigsAndRocks(ModBlocks.twigs, world, random, chunkX, chunkZ, 2);
  25. this.spawnTwigsAndRocks(ModBlocks.rocks, world, random, chunkX, chunkZ, 3);
  26. }
  27.  
  28. @Override
  29. public void generateEnd(World world, Random random, int chunkX, int chunkZ) {
  30.  
  31. }
  32.  
  33. private void spawnTwigsAndRocks(Block block, World world, Random random, int chunkX, int chunkZ, int spawnChance) {
  34. for (int i = 0; i < spawnChance; i++) {
  35. int posX = chunkX + random.nextInt(16);
  36. int posZ = chunkZ + random.nextInt(16);
  37. int posY = (world.getHeightmapHeight(chunkX, chunkZ)-8)+ 4;
  38. BlockPos blockPos = new BlockPos(posX, posY, posZ);
  39. (new WorldGenTwigsAndRocks(block)).generate(world, random, blockPos);
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement