Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ModWorldGeneratorFlowers extends WorldGenerator {
- private BlockBush flower;
- private IBlockState state;
- public ModWorldGeneratorFlowers(BlockBush flower) {
- this.setGeneratedBlock(flower);
- }
- public void setGeneratedBlock(BlockBush flower) {
- this.flower = flower;
- this.state = flower.getDefaultState();
- }
- public boolean generate(World worldIn, Random rand, BlockPos position) {
- for (int i = 0; i < 20; ++i) {
- BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4),
- rand.nextInt(8) - rand.nextInt(8));
- if (blockpos.getX() > 0 && blockpos.getY() > 0 && blockpos.getZ() > 0 && blockpos.getY() < 255) {
- if (worldIn.isAirBlock(blockpos) && (!worldIn.provider.getHasNoSky())
- && this.flower.canBlockStay(worldIn, blockpos, this.state)) {
- worldIn.setBlockState(blockpos, this.state, 2);
- }
- }
- }
- return true;
- }
- }
Add Comment
Please, Sign In to add comment