Java Code Examples for net.minecraft.world.World#canSeeSky()

The following examples show how to use net.minecraft.world.World#canSeeSky() . 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 check out the related API usage on the sidebar.
Example 1
Source File: CoverSolarPanel.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
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
Source File: BlockFoam.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
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 File: BlockCrop.java    From TFC2 with 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);
}