35 lines
1.3 KiB
Java
35 lines
1.3 KiB
Java
package biomesoplenty.common.world.gen.feature;
|
|
|
|
import java.util.Random;
|
|
|
|
import biomesoplenty.api.block.BOPBlocks;
|
|
import net.minecraft.block.BlockLeaves;
|
|
import net.minecraft.init.Blocks;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.world.IWorld;
|
|
import net.minecraft.world.gen.IChunkGenSettings;
|
|
import net.minecraft.world.gen.IChunkGenerator;
|
|
import net.minecraft.world.gen.feature.Feature;
|
|
import net.minecraft.world.gen.feature.NoFeatureConfig;
|
|
|
|
public class HeathFeature extends Feature<NoFeatureConfig>
|
|
{
|
|
@Override
|
|
public boolean place(IWorld p_212245_1_, IChunkGenerator<? extends IChunkGenSettings> p_212245_2_, Random p_212245_3_, BlockPos p_212245_4_, NoFeatureConfig p_212245_5_)
|
|
{
|
|
int i = 0;
|
|
|
|
for(int j = 0; j < 64; ++j)
|
|
{
|
|
BlockPos blockpos = p_212245_4_.add(p_212245_3_.nextInt(8) - p_212245_3_.nextInt(8), p_212245_3_.nextInt(4) - p_212245_3_.nextInt(4), p_212245_3_.nextInt(8) - p_212245_3_.nextInt(8));
|
|
if (p_212245_1_.getBlockState(blockpos).canBeReplacedByLeaves(p_212245_1_, blockpos) && p_212245_1_.getBlockState(blockpos.down()).getBlock() == Blocks.GRASS_BLOCK)
|
|
{
|
|
p_212245_1_.setBlockState(blockpos, BOPBlocks.jacaranda_leaves.getDefaultState().with(BlockLeaves.PERSISTENT, true), 2);
|
|
|
|
++i;
|
|
}
|
|
}
|
|
|
|
return i > 0;
|
|
}
|
|
} |