Skip to content

Instantly share code, notes, and snippets.

Created August 17, 2015 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/d91cd976fe264a8d49a6 to your computer and use it in GitHub Desktop.
Save anonymous/d91cd976fe264a8d49a6 to your computer and use it in GitHub Desktop.
public WorldGenTallGrass(BlockTallGrass.EnumType p_i45629_1_)
{
this.field_175907_a = Blocks.tallgrass.getDefaultState().withProperty(BlockTallGrass.TYPE, p_i45629_1_);
}
or
public boolean generate(World worldIn, Random p_180709_2_, BlockPos p_180709_3_)
{
Block block;
do
{
block = worldIn.getBlockState(p_180709_3_).getBlock();
if (!block.isAir(worldIn, p_180709_3_) && !block.isLeaves(worldIn, p_180709_3_)) break;
p_180709_3_ = p_180709_3_.down();
} while (p_180709_3_.getY() > 0);
for (int i = 0; i < 128; ++i)
{
BlockPos blockpos1 = p_180709_3_.add(p_180709_2_.nextInt(8) - p_180709_2_.nextInt(8), p_180709_2_.nextInt(4) - p_180709_2_.nextInt(4), p_180709_2_.nextInt(8) - p_180709_2_.nextInt(8));
if (worldIn.isAirBlock(blockpos1) && Blocks.tallgrass.canBlockStay(worldIn, blockpos1, this.field_175907_a))
{
worldIn.setBlockState(blockpos1, this.field_175907_a, 2);
}
}
return true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment