Posted October 31, 20195 yr I want to generate a special vine for my mod in world like how vines generate in vanilla swamps/jungles. Here's the code: private void generateMoss(World world, Random rand, int chunkX, int chunkZ, Predicate<Biome> predicate) { BlockPos position = new BlockPos(chunkX * 16 + 8, 64, chunkZ * 16 + 8); Biome biome = world.getBiome(position); if (!predicate.test(biome)) return; for (; position.getY() < 128; position = position.up()) { if (world.isAirBlock(position) && world.isAirBlock(position.down(1))) { for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL.facings()) { if (ModObjects.spanish_moss.canPlaceBlockOnSide(world, position, enumfacing)) { IBlockState iblockstate = ModObjects.spanish_moss.getDefaultState().withProperty(BlockVine.SOUTH, enumfacing == EnumFacing.NORTH).withProperty(BlockVine.WEST, enumfacing == EnumFacing.EAST).withProperty(BlockVine.NORTH, enumfacing == EnumFacing.SOUTH).withProperty(BlockVine.EAST, enumfacing == EnumFacing.WEST); world.setBlockState(position, iblockstate, 2); break; } } } else { position = position.add(rand.nextInt(4) - rand.nextInt(4), 0, rand.nextInt(4) - rand.nextInt(4)); } } } However, this just generates very parse patches of one block vines instead of long draping vines from trees in swamps. The code here is basically copied from the vanilla class though. Thanks!
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.