@Override public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) { return super.canBlockStay(worldIn, pos, state); }
@Override public boolean generate(World worldIn, Random rand, BlockPos position) { BlockBush flower = ModBlocks.cloud_flower; for (int i = 0; i < 64; ++i) { BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8)); if (worldIn.isAirBlock(blockpos) && (!worldIn.provider.isNether() || blockpos.getY() < 255) && flower.canBlockStay(worldIn, blockpos, flower.getDefaultState())) { worldIn.setBlockState(blockpos, flower.getDefaultState(), 2); } } return true; } }
@Override public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) { return type == 3 ? this.canSustainBush(worldIn.getBlockState(pos.down())) : super.canBlockStay(worldIn, pos, state); }
@Override public boolean canBlockStay(World world, BlockPos pos, IBlockState state) { if (state.getBlock() != this) return super.canBlockStay(world, pos, state); if (hasTop(state)) return world.getBlockState(pos.up()).getBlock() == this; if (isTop(state)) return world.getBlockState(pos.down()).getBlock() == this; return super.canBlockStay(world, pos, state); }
@Override public boolean generate(World worldIn, Random rand, BlockPos position) { for (IBlockState iblockstate = worldIn.getBlockState(position); (iblockstate.getBlock().isAir(iblockstate, worldIn, position) || iblockstate.getBlock().isLeaves(iblockstate, worldIn, position)) && position.getY() > 0; iblockstate = worldIn.getBlockState(position)) { position = position.down(); } for (int i = 0; i < 128; ++i) { BlockPos blockPos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8)); if (worldIn.isAirBlock(blockPos) && grassBlock.canBlockStay(worldIn, blockPos, grassBlock.getDefaultState())) { worldIn.setBlockState(blockPos, grassBlock.getDefaultState(), 2); } } return true; } }
@Override public boolean canBlockStay(World world, BlockPos pos, IBlockState state) { IBlockState iblockstateDown = world.getBlockState(pos.down()); if (state.getBlock() != this) return iblockstateDown.getBlock() == Blocks.SAND ? true : iblockstateDown.getBlock() == ModBlocks.MUD ? true : super.canBlockStay(world, pos, state); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check. if (state.getValue(HALF) == BlockDoubleHeightPlant.EnumBlockHalf.UPPER) return world.getBlockState(pos.down()).getBlock() == this; else { IBlockState iblockstate = world.getBlockState(pos.up()); return iblockstate.getBlock() == this && iblockstateDown.getBlock() == Blocks.SAND ? true : iblockstate.getBlock() == this && iblockstateDown.getBlock() == ModBlocks.MUD ? true : iblockstate.getBlock() == this && super.canBlockStay(world, pos, iblockstate); } }
if (blockPlant != null && blockPlant.canBlockStay(world, blockPosSurface, statePlant)) { world.setBlockState(blockPosSurface, statePlant);