Java Code Examples for net.minecraft.block.state.IBlockState#getLightOpacity()
The following examples show how to use
net.minecraft.block.state.IBlockState#getLightOpacity() .
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: BlockTorikkiGrass.java From Wizardry with GNU Lesser General Public License v3.0 | 7 votes |
@Override public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { if (!worldIn.isRemote) { if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getLightOpacity(worldIn, pos.up()) > 2) { worldIn.setBlockState(pos, Blocks.DIRT.getDefaultState().withProperty(BlockDirt.VARIANT, DirtType.DIRT)); } else { if (worldIn.getLightFromNeighbors(pos.up()) >= 9) { for (int i = 0; i < 4; ++i) { BlockPos posAt = pos.add(rand.nextInt(3) - 1, rand.nextInt(5) - 3, rand.nextInt(3) - 1); IBlockState stateAt = worldIn.getBlockState(posAt); IBlockState stateAbove = worldIn.getBlockState(posAt.up()); if (Blocks.DIRT.equals(stateAt.getBlock()) && DirtType.DIRT.equals(stateAt.getValue(BlockDirt.VARIANT)) && worldIn.getLightFromNeighbors(posAt.up()) >= 4 && stateAbove.getLightOpacity(worldIn, posAt.up()) <= 2) { worldIn.setBlockState(posAt, this.getDefaultState()); } } } } } }
Example 2
Source File: TileEntityEnergyBridge.java From enderutilities with GNU Lesser General Public License v3.0 | 6 votes |
private boolean isVerticalBeamObstructed(World world, int x, int z, int yStart, int yEnd) { BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(x, yStart, z); int increment = yStart < yEnd ? 1 : -1; yEnd += increment; // Nudge the end by one because we use != for checking it // Check that there are no light obstructing blocks before hitting the first bedrock block for ( ; pos.getY() != yEnd; ) { if (world.isAirBlock(pos) == false) { IBlockState state = world.getBlockState(pos); if (state.getLightOpacity(world, pos) > 3) { return BlackLists.isBlockValidBedrockForEnergyBridge(state) == false; } } pos.setY(pos.getY() + increment); } return false; }
Example 3
Source File: BlockTofuTerrain.java From TofuCraftReload with MIT License | 5 votes |
@Override public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { if (!worldIn.isRemote && worldIn.getBlockState(pos) == BlockLoader.zundatofuTerrain.getDefaultState()) { if (!worldIn.isAreaLoaded(pos, 3)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light and spreading if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getLightOpacity(worldIn, pos.up()) > 2) { worldIn.setBlockState(pos, BlockLoader.tofuTerrain.getDefaultState()); } else { if (worldIn.getLightFromNeighbors(pos.up()) >= 9) { for (int i = 0; i < 4; ++i) { BlockPos blockpos = pos.add(rand.nextInt(3) - 1, rand.nextInt(5) - 3, rand.nextInt(3) - 1); if (blockpos.getY() >= 0 && blockpos.getY() < 256 && !worldIn.isBlockLoaded(blockpos)) { return; } IBlockState iblockstate = worldIn.getBlockState(blockpos.up()); IBlockState iblockstate1 = worldIn.getBlockState(blockpos); if ((iblockstate1.getBlock() == BlockLoader.tofuTerrain || iblockstate1.getBlock() == BlockLoader.KINUTOFU) && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && iblockstate.getLightOpacity(worldIn, pos.up()) <= 2) { worldIn.setBlockState(blockpos, BlockLoader.zundatofuTerrain.getDefaultState()); } } } } } }
Example 4
Source File: ForgeQueue_All.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
@Override public int getOpacity(ExtendedBlockStorage section, int x, int y, int z) { BlockStateContainer dataPalette = section.getData(); IBlockState ibd = dataPalette.get(x & 15, y & 15, z & 15); return ibd.getLightOpacity(); }
Example 5
Source File: SpongeQueue_1_11.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
@Override public int getOpacity(ExtendedBlockStorage section, int x, int y, int z) { BlockStateContainer dataPalette = section.getData(); IBlockState ibd = dataPalette.get(x & 15, y & 15, z & 15); return ibd.getLightOpacity(); }
Example 6
Source File: SpongeQueue_1_12.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
@Override public int getOpacity(ExtendedBlockStorage section, int x, int y, int z) { BlockStateContainer dataPalette = section.getData(); IBlockState ibd = dataPalette.get(x & 15, y & 15, z & 15); return ibd.getLightOpacity(); }
Example 7
Source File: ForgeQueue_All.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
@Override public int getOpacity(ExtendedBlockStorage section, int x, int y, int z) { BlockStateContainer dataPalette = section.getData(); IBlockState ibd = dataPalette.get(x & 15, y & 15, z & 15); return ibd.getLightOpacity(); }
Example 8
Source File: ForgeQueue_All.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
@Override public int getOpacity(ExtendedBlockStorage section, int x, int y, int z) { BlockStateContainer dataPalette = section.getData(); IBlockState ibd = dataPalette.get(x & 15, y & 15, z & 15); return ibd.getLightOpacity(); }
Example 9
Source File: ForgeQueue_All.java From FastAsyncWorldedit with GNU General Public License v3.0 | 4 votes |
@Override public int getOpacity(ExtendedBlockStorage section, int x, int y, int z) { BlockStateContainer dataPalette = section.getData(); IBlockState ibd = dataPalette.get(x & 15, y & 15, z & 15); return ibd.getLightOpacity(); }