Java Code Examples for

The following examples show how to use . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
private boolean canSeeSunClearly(World world, BlockPos blockPos) {
    if (!world.canSeeSky(blockPos)) {
        return false;
    if (world.isRaining()) {
        Biome biome = world.getBiome(blockPos);
        if (biome.canRain() || biome.getEnableSnow()) {
            return false;
    return world.isDaytime();
Example 2
public void randomTick(World worldIn, BlockPos pos, IBlockState state, Random random) {
    int lightLevel = (worldIn.canSeeSky(pos) && worldIn.isDaytime()) ? 16 : worldIn.getLight(pos);
    if (random.nextInt(20 - lightLevel) == 0) {
        worldIn.setBlockState(pos, getPetrifiedBlock(state));
Example 3
Source Project: TFC2   File:    License: GNU General Public License v3.0 4 votes vote down vote up
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
	IBlockState soil = worldIn.getBlockState(pos.down());
	return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && (Core.isSoil(soil) || soil.getBlock() == TFCBlocks.Farmland);