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

The following examples show how to use net.minecraft.world.World#isDaytime() . 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: BlockHalfTatami.java    From Sakura_mod with MIT License 5 votes vote down vote up
@Override
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
	if(worldIn.canBlockSeeSky(pos)&&worldIn.isDaytime()){
			worldIn.setBlockState(pos, (isNS?BlockLoader.TATAMI_TAN_NS_HALF:BlockLoader.TATAMI_TAN_HALF).getDefaultState().withProperty(FACING, state.getValue(FACING)));
	}
	super.updateTick(worldIn, pos, state, rand);
}
 
Example 2
Source File: BlockCarpetTatami.java    From Sakura_mod with MIT License 5 votes vote down vote up
@Override
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
	if(worldIn.canBlockSeeSky(pos)&&worldIn.isDaytime()){
			worldIn.setBlockState(pos, (isNS?BlockLoader.TATAMI_TAN_NS_CARPET:BlockLoader.TATAMI_TAN_CARPET).getDefaultState().withProperty(FACING, state.getValue(FACING)));
	}
	super.updateTick(worldIn, pos, state, rand);
}
 
Example 3
Source File: BlockBambooBlock.java    From Sakura_mod with MIT License 5 votes vote down vote up
@Override
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
	if(!isSunburnt&&(worldIn.canBlockSeeSky(pos)||worldIn.getBlockState(pos.up()).getBlock() instanceof BlockBambooBlock)&&worldIn.isDaytime()){
			worldIn.setBlockState(pos, (BlockLoader.BAMBOO_BLOCK_SUNBURNT).getDefaultState().withProperty(LOG_AXIS, state.getValue(LOG_AXIS)));
	}
	super.updateTick(worldIn, pos, state, rand);
}
 
Example 4
Source File: BlockTatami.java    From Sakura_mod with MIT License 5 votes vote down vote up
@Override
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
	if(worldIn.canBlockSeeSky(pos)&&worldIn.isDaytime()){
			worldIn.setBlockState(pos, (isNS?BlockLoader.TATAMI_TAN_NS:BlockLoader.TATAMI_TAN).getDefaultState().withProperty(FACING, state.getValue(FACING)));
	}
	super.updateTick(worldIn, pos, state, rand);
}
 
Example 5
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 6
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));
    }
}