Java Code Examples for net.minecraft.block.state.IBlockState#isTopSolid()

The following examples show how to use net.minecraft.block.state.IBlockState#isTopSolid() . 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: BlockButton.java    From customstuff4 with GNU General Public License v3.0 5 votes vote down vote up
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 2
Source File: BlockMapleSyrupCauldron.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 3
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 4
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 5
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 6
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 7
Source File: BlockStoneMortar.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 8
Source File: BlockNoodle.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: 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 10
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 11
Source File: BlockCampfirePot.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 12
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 13
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 14
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 15
Source File: MetaTileEntityPump.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void updateQueueState(int blocksToCheckAmount) {
    BlockPos selfPos = getPos().down(pumpHeadY);

    for(int i = 0; i < blocksToCheckAmount; i++) {
        BlockPos checkPos = null;
        int amountIterated = 0;
        do {
            if (checkPos != null) {
                blocksToCheck.push(checkPos);
                amountIterated++;
            }
            checkPos = blocksToCheck.poll();

        } while (checkPos != null &&
            !getWorld().isBlockLoaded(checkPos) &&
            amountIterated < blocksToCheck.size());
        if (checkPos != null) {
            checkFluidBlockAt(selfPos, checkPos);
        } else break;
    }

    if (fluidSourceBlocks.isEmpty()) {
        if (getTimer() % 20 == 0) {
            BlockPos downPos = selfPos.down(1);
            if (downPos != null && downPos.getY() >= 0) {
                IBlockState downBlock = getWorld().getBlockState(downPos);
                if (downBlock.getBlock() instanceof BlockLiquid ||
                    downBlock.getBlock() instanceof IFluidBlock ||
                    !downBlock.isTopSolid()) {
                    this.pumpHeadY++;
                }
            }

            // Always recheck next time
            writeCustomData(200, b -> b.writeVarInt(pumpHeadY));
            markDirty();
            //schedule queue rebuild because we changed our position and no fluid is available
            this.initializedQueue = false;
        }

        if (!initializedQueue || getTimer() % 6000 == 0) {
            this.initializedQueue = true;
            //just add ourselves to check list and see how this will go
            this.blocksToCheck.add(selfPos);
        }
    }
}