Java Code Examples for net.minecraft.block.state.IBlockState#getBlockFaceShape()
The following examples show how to use
net.minecraft.block.state.IBlockState#getBlockFaceShape() .
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: SurfaceBlockPopulator.java From GregTech with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void populateChunk(World world, int chunkX, int chunkZ, Random random, OreDepositDefinition definition, GridEntryInfo gridEntryInfo) { if (world.getWorldType() != WorldType.FLAT) { int stonesCount = minIndicatorAmount + (minIndicatorAmount >= maxIndicatorAmount ? 0 : random.nextInt(maxIndicatorAmount - minIndicatorAmount)); for (int i = 0; i < stonesCount; i++) { int randomX = chunkX * 16 + random.nextInt(16); int randomZ = chunkZ * 16 + random.nextInt(16); BlockPos topBlockPos = new BlockPos(randomX, 0, randomZ); topBlockPos = world.getTopSolidOrLiquidBlock(topBlockPos).down(); IBlockState blockState = world.getBlockState(topBlockPos); if (blockState.getBlockFaceShape(world, topBlockPos, EnumFacing.UP) != BlockFaceShape.SOLID || !blockState.isOpaqueCube() || !blockState.isFullBlock()) continue; BlockPos surfaceRockPos = topBlockPos.up(); world.setBlockState(surfaceRockPos, this.blockState, 16); } } }
Example 2
Source File: SurfaceRockPopulator.java From GregTech with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void populateChunk(World world, int chunkX, int chunkZ, Random random, OreDepositDefinition definition, GridEntryInfo gridEntryInfo) { int stonesCount = random.nextInt(2); if (world.getWorldType() != WorldType.FLAT && stonesCount > 0) { Set<Material> undergroundMaterials = findUndergroundMaterials(gridEntryInfo.getGeneratedBlocks(definition, chunkX, chunkZ)); if (undergroundMaterials.isEmpty()) return; for (int i = 0; i < stonesCount; i++) { int randomX = chunkX * 16 + random.nextInt(16); int randomZ = chunkZ * 16 + random.nextInt(16); BlockPos topBlockPos = new BlockPos(randomX, 0, randomZ); topBlockPos = world.getTopSolidOrLiquidBlock(topBlockPos).down(); IBlockState blockState = world.getBlockState(topBlockPos); if (blockState.getBlockFaceShape(world, topBlockPos, EnumFacing.UP) != BlockFaceShape.SOLID || !blockState.isOpaqueCube() || !blockState.isFullBlock()) continue; BlockPos surfaceRockPos = topBlockPos.up(); setStoneBlock(world, surfaceRockPos, undergroundMaterials); } } }
Example 3
Source File: BlockButton.java From customstuff4 with GNU General Public License v3.0 | 5 votes |
static boolean canPlaceBlock(World worldIn, BlockPos pos, EnumFacing direction) { BlockPos blockpos = pos.offset(direction.getOpposite()); IBlockState iblockstate = worldIn.getBlockState(blockpos); boolean flag = iblockstate.getBlockFaceShape(worldIn, blockpos, direction) == BlockFaceShape.SOLID; Block block = iblockstate.getBlock(); if (direction == EnumFacing.UP) { return iblockstate.isTopSolid() || !isExceptionBlockForAttaching(block) && flag; } else { return !isExceptBlockForAttachWithPiston(block) && flag; } }
Example 4
Source File: BlockWall.java From customstuff4 with GNU General Public License v3.0 | 5 votes |
private boolean canConnectTo(IBlockAccess worldIn, BlockPos pos, EnumFacing p_176253_3_) { IBlockState iblockstate = worldIn.getBlockState(pos); Block block = iblockstate.getBlock(); BlockFaceShape blockfaceshape = iblockstate.getBlockFaceShape(worldIn, pos, p_176253_3_); boolean flag = blockfaceshape == BlockFaceShape.MIDDLE_POLE_THICK || blockfaceshape == BlockFaceShape.MIDDLE_POLE && block instanceof net.minecraft.block.BlockFenceGate; return !isExcepBlockForAttachWithPiston(block) && blockfaceshape == BlockFaceShape.SOLID || flag; }
Example 5
Source File: BlockFrame.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
private boolean canFrameSupportVertical(World worldIn, BlockPos framePos) { MutableBlockPos blockPos = new MutableBlockPos(framePos); do { blockPos.move(EnumFacing.DOWN); IBlockState blockState = worldIn.getBlockState(blockPos); if (!(blockState.getBlock() instanceof BlockFrame)) { return blockState.getBlockFaceShape(worldIn, blockPos, EnumFacing.UP) == BlockFaceShape.SOLID; } } while (true); }
Example 6
Source File: BlockCampfirePot.java From Sakura_mod with MIT License | 4 votes |
public boolean canBlockStay(World worldIn, BlockPos pos) { IBlockState downState = worldIn.getBlockState(pos.down()); return downState.isTopSolid() || downState.getBlockFaceShape(worldIn, pos.down(), EnumFacing.UP) == BlockFaceShape.SOLID; }
Example 7
Source File: BlockFrame.java From GregTech with GNU Lesser General Public License v3.0 | 4 votes |
protected boolean canBlockStay(World worldIn, BlockPos pos) { MutableBlockPos currentPos = new MutableBlockPos(pos); currentPos.move(EnumFacing.DOWN); IBlockState downState = worldIn.getBlockState(currentPos); if (downState.getBlock() instanceof BlockFrame) { if (canFrameSupportVertical(worldIn, currentPos)) { return true; } } else if (downState.getBlockFaceShape(worldIn, currentPos, EnumFacing.UP) == BlockFaceShape.SOLID) { return true; } currentPos.move(EnumFacing.UP); HashSet<BlockPos> observedSet = new HashSet<>(); Stack<EnumFacing> moveStack = new Stack<>(); main: while (true) { for (EnumFacing facing : EnumFacing.HORIZONTALS) { currentPos.move(facing); IBlockState blockStateHere = worldIn.getBlockState(currentPos); //if there is node, and it can connect with previous node, add it to list, and set previous node as current if (blockStateHere.getBlock() instanceof BlockFrame && currentPos.distanceSq(pos) <= SCAFFOLD_PILLAR_RADIUS_SQ && !observedSet.contains(currentPos)) { observedSet.add(currentPos.toImmutable()); currentPos.move(EnumFacing.DOWN); downState = worldIn.getBlockState(currentPos); if (downState.getBlock() instanceof BlockFrame) { if (canFrameSupportVertical(worldIn, currentPos)) { return true; } } else if (downState.getBlockFaceShape(worldIn, currentPos, EnumFacing.UP) == BlockFaceShape.SOLID) { return true; } currentPos.move(EnumFacing.UP); moveStack.push(facing.getOpposite()); continue main; } else currentPos.move(facing.getOpposite()); } if (!moveStack.isEmpty()) { currentPos.move(moveStack.pop()); } else break; } return false; }
Example 8
Source File: Ladder.java From EmergingTechnology with MIT License | 4 votes |
private boolean canAttachTo(World world, BlockPos pos, EnumFacing facing) { IBlockState iblockstate = world.getBlockState(pos); boolean flag = isExceptBlockForAttachWithPiston(iblockstate.getBlock()); return !flag && iblockstate.getBlockFaceShape(world, pos, facing) == BlockFaceShape.SOLID && !iblockstate.canProvidePower(); }
Example 9
Source File: BlockCampfire.java From Sakura_mod with MIT License | 4 votes |
public boolean canBlockStay(World worldIn, BlockPos pos) { IBlockState downState = worldIn.getBlockState(pos.down()); return downState.isTopSolid() || downState.getBlockFaceShape(worldIn, pos.down(), EnumFacing.UP) == BlockFaceShape.SOLID; }
Example 10
Source File: BlockCampfire.java From Sakura_mod with MIT License | 4 votes |
@Override public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { IBlockState downState = worldIn.getBlockState(pos.down()); return (downState.isTopSolid() || downState.getBlockFaceShape(worldIn, pos.down(), EnumFacing.UP) == BlockFaceShape.SOLID) && super.canPlaceBlockAt(worldIn, pos); }
Example 11
Source File: BlockMapleSyrupCauldron.java From Sakura_mod with MIT License | 4 votes |
@Override public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { IBlockState downState = worldIn.getBlockState(pos.down()); return (downState.isTopSolid() || downState.getBlockFaceShape(worldIn, pos.down(), EnumFacing.UP) == BlockFaceShape.SOLID) && super.canPlaceBlockAt(worldIn, pos); }
Example 12
Source File: BlockCampfirePot.java From Sakura_mod with MIT License | 4 votes |
@Override public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { IBlockState downState = worldIn.getBlockState(pos.down()); return (downState.isTopSolid() || downState.getBlockFaceShape(worldIn, pos.down(), EnumFacing.UP) == BlockFaceShape.SOLID) && super.canPlaceBlockAt(worldIn, pos); }
Example 13
Source File: OpenBlock.java From OpenModsLib with MIT License | 4 votes |
public final static boolean isNeighborBlockSolid(IBlockAccess world, BlockPos blockPos, EnumFacing side) { final BlockPos pos = blockPos.offset(side); final IBlockState state = world.getBlockState(pos); return isExceptionBlockForAttaching(state.getBlock()) || state.getBlockFaceShape(world, pos, side.getOpposite()) == BlockFaceShape.SOLID; }
Example 14
Source File: BlockNoodle.java From Sakura_mod with MIT License | 4 votes |
public boolean canBlockStay(World worldIn, BlockPos pos) { IBlockState downState = worldIn.getBlockState(pos.down()); return downState.isTopSolid() || downState.getBlockFaceShape(worldIn, pos.down(), EnumFacing.UP) == BlockFaceShape.SOLID; }
Example 15
Source File: BlockNoodle.java From Sakura_mod with MIT License | 4 votes |
@Override public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { IBlockState downState = worldIn.getBlockState(pos.down()); return (downState.isTopSolid() || downState.getBlockFaceShape(worldIn, pos.down(), EnumFacing.UP) == BlockFaceShape.SOLID) && super.canPlaceBlockAt(worldIn, pos); }
Example 16
Source File: BlockStoneMortar.java From Sakura_mod with MIT License | 4 votes |
private boolean canPlaceFullBlock(World worldIn, BlockPos pos) { IBlockState downState = worldIn.getBlockState(pos.down()); return downState.isTopSolid() && downState.getBlockFaceShape(worldIn, pos.down(), EnumFacing.UP) == BlockFaceShape.SOLID; }
Example 17
Source File: BlockBarrelDistillation.java From Sakura_mod with MIT License | 4 votes |
private boolean canPlaceFullBlock(World worldIn, BlockPos pos) { IBlockState downState = worldIn.getBlockState(pos.down()); return downState.isTopSolid() && downState.getBlockFaceShape(worldIn, pos.down(), EnumFacing.UP) == BlockFaceShape.SOLID; }
Example 18
Source File: BlockBambooLantern.java From Sakura_mod with MIT License | 4 votes |
public boolean canBlockStay(World worldIn, BlockPos pos) { IBlockState downState = worldIn.getBlockState(pos.down()); return downState.isTopSolid() || downState.getBlockFaceShape(worldIn, pos.down(), EnumFacing.UP) == BlockFaceShape.SOLID; }
Example 19
Source File: BlockBambooLantern.java From Sakura_mod with MIT License | 4 votes |
@Override public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { IBlockState downState = worldIn.getBlockState(pos.down()); return (downState.isTopSolid() || downState.getBlockFaceShape(worldIn, pos.down(), EnumFacing.UP) == BlockFaceShape.SOLID) && super.canPlaceBlockAt(worldIn, pos); }
Example 20
Source File: BlockMapleSyrupCauldron.java From Sakura_mod with MIT License | 4 votes |
public boolean canBlockStay(World worldIn, BlockPos pos) { IBlockState downState = worldIn.getBlockState(pos.down()); return downState.isTopSolid() || downState.getBlockFaceShape(worldIn, pos.down(), EnumFacing.UP) == BlockFaceShape.SOLID; }