Advertisement
Guest User

Untitled

a guest
Sep 1st, 2016
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
  2. if (!world.provider.isSurfaceWorld()) {
  3. return;
  4. }
  5.  
  6. if (random.nextInt(7) == 0) {
  7. int posX = (chunkX *16)+8;
  8. int posY = (world.getActualHeight());
  9. int posZ = (chunkZ *16)+8;
  10.  
  11. for (int i = 0; i < (random.nextInt(8)) + 8; i++) {
  12. BlockPos pos = new BlockPos(posX + offset(8, random), posY, posZ + offset(8, random));
  13.  
  14. if (world.isAirBlock(new BlockPos(posX, posY, posZ)) && (!world.provider.getHasNoSky() || pos.getY() < 255) && Blocks.WATERLILY.canPlaceBlockAt(world, new BlockPos(posX, posY, posZ))) {
  15. world.setBlockState(pos, ModBlocks.twigs.getDefaultState());
  16. }
  17. }
  18. }
  19. }
  20.  
  21. public int offset(int bound, Random rand) {
  22.  
  23. return rand.nextInt(bound * 2) - bound;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement