Java Code Examples for net.minecraft.init.Blocks.CHORUS_PLANT

The following are Jave code examples for showing how to use CHORUS_PLANT of the net.minecraft.init.Blocks class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Backmemed   File: BlockChorusFlower.java   View Source Code Vote up 5 votes
public boolean canSurvive(World worldIn, BlockPos pos)
{
    IBlockState iblockstate = worldIn.getBlockState(pos.down());
    Block block = iblockstate.getBlock();

    if (block != Blocks.CHORUS_PLANT && block != Blocks.END_STONE)
    {
        if (iblockstate.getMaterial() == Material.AIR)
        {
            int i = 0;

            for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
            {
                IBlockState iblockstate1 = worldIn.getBlockState(pos.offset(enumfacing));
                Block block1 = iblockstate1.getBlock();

                if (block1 == Blocks.CHORUS_PLANT)
                {
                    ++i;
                }
                else if (iblockstate1.getMaterial() != Material.AIR)
                {
                    return false;
                }
            }

            return i == 1;
        }
        else
        {
            return false;
        }
    }
    else
    {
        return true;
    }
}
 
Example 2
Project: CustomWorldGen   File: BlockChorusFlower.java   View Source Code Vote up 5 votes
public boolean canSurvive(World worldIn, BlockPos pos)
{
    IBlockState iblockstate = worldIn.getBlockState(pos.down());
    Block block = iblockstate.getBlock();

    if (block != Blocks.CHORUS_PLANT && block != Blocks.END_STONE)
    {
        if (iblockstate.getMaterial() == Material.AIR)
        {
            int i = 0;

            for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
            {
                IBlockState iblockstate1 = worldIn.getBlockState(pos.offset(enumfacing));
                Block block1 = iblockstate1.getBlock();

                if (block1 == Blocks.CHORUS_PLANT)
                {
                    ++i;
                }
                else if (iblockstate1.getMaterial() != Material.AIR)
                {
                    return false;
                }
            }

            return i == 1;
        }
        else
        {
            return false;
        }
    }
    else
    {
        return true;
    }
}