Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.mightydanp.eot.api.common.world.gen.feature;
- import java.util.Random;
- import com.mightydanp.eot.common.block.BlockTwigs;
- import net.minecraft.block.state.IBlockState;
- import net.minecraft.util.math.BlockPos;
- import net.minecraft.world.World;
- public class IWorldGenTwigs {
- private BlockTwigs getBlock;
- private IBlockState state;
- public IWorldGenTwigs(BlockTwigs blockIn){
- this.getBlock = blockIn;
- }
- public void setGeneratedBlock(BlockTwigs blockIn)
- {
- this.getBlock = blockIn;
- this.state = blockIn.getDefaultState();
- }
- public boolean generate(World worldIn, Random rand, BlockPos position)
- {
- 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.getHasNoSky() || blockpos.getY() < 255) && this.getBlock.canBlockStay(worldIn, blockpos, this.state))
- {
- worldIn.setBlockState(blockpos, this.state, 2);
- }
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment