Java Code Examples for net.minecraft.block.state.BlockFaceShape#SOLID

The following examples show how to use net.minecraft.block.state.BlockFaceShape#SOLID . 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: SurfaceRockPopulator.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
@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 2
Source File: BlockWall.java    From customstuff4 with GNU General Public License v3.0 5 votes vote down vote up
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 3
Source File: BlockStorage.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face)
{
    if (state.getValue(TYPE).isFullCube())
    {
        return BlockFaceShape.SOLID;
    }
    else
    {
        return BlockFaceShape.UNDEFINED;
    }
}
 
Example 4
Source File: BlockFrame.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) {
    return face == EnumFacing.UP || face == EnumFacing.DOWN ? BlockFaceShape.SOLID : BlockFaceShape.UNDEFINED;
}
 
Example 5
Source File: MetaTileEntity.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Retrieves face shape on the current side of this meta tile entity
 */
public BlockFaceShape getFaceShape(EnumFacing side) {
    return isOpaqueCube() ? BlockFaceShape.SOLID : BlockFaceShape.UNDEFINED;
}
 
Example 6
Source File: Ladder.java    From EmergingTechnology with MIT License 4 votes vote down vote up
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 7
Source File: BlockCampfire.java    From Sakura_mod with MIT License 4 votes vote down vote up
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 8
Source File: BlockCampfire.java    From Sakura_mod with MIT License 4 votes vote down vote up
@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 9
Source File: BlockCampfirePot.java    From Sakura_mod with MIT License 4 votes vote down vote up
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: BlockCarpet.java    From customstuff4 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess blockAccess, IBlockState state, BlockPos pos, EnumFacing side)
{
    return side == EnumFacing.DOWN ? BlockFaceShape.SOLID : BlockFaceShape.UNDEFINED;
}
 
Example 11
Source File: BlockBarrel.java    From Sakura_mod with MIT License 4 votes vote down vote up
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 12
Source File: BlockKawara.java    From Sakura_mod with MIT License 4 votes vote down vote up
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face)
{
  return face == EnumFacing.DOWN ? BlockFaceShape.SOLID : BlockFaceShape.UNDEFINED;
}
 
Example 13
Source File: BlockNoodle.java    From Sakura_mod with MIT License 4 votes vote down vote up
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 14
Source File: BlockFrame.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
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 15
Source File: BlockBarrelDistillation.java    From Sakura_mod with MIT License 4 votes vote down vote up
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 16
Source File: BlockBambooLantern.java    From Sakura_mod with MIT License 4 votes vote down vote up
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 17
Source File: BlockBambooLantern.java    From Sakura_mod with MIT License 4 votes vote down vote up
@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 18
Source File: BlockMapleSyrupCauldron.java    From Sakura_mod with MIT License 4 votes vote down vote up
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: OpenBlock.java    From OpenModsLib with MIT License 4 votes vote down vote up
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 20
Source File: BlockTofuFarmLand.java    From TofuCraftReload with MIT License 2 votes vote down vote up
/**
 * Get the geometry of the queried face at the given position and state. This is used to decide whether things like
 * buttons are allowed to be placed on the face, or how glass panes connect to the face, among other things.
 * <p>
 * Common values are {@code SOLID}, which is the default, and {@code UNDEFINED}, which represents something that
 * does not fit the other descriptions and will generally cause other things not to connect to the face.
 *
 * @return an approximation of the form of the given face
 */
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face)
{
    return face == EnumFacing.DOWN ? BlockFaceShape.SOLID : BlockFaceShape.UNDEFINED;
}