Java Code Examples for net.minecraft.world.World.isBlockNormalCube()

The following are Jave code examples for showing how to use isBlockNormalCube() of the net.minecraft.world.World class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: DecompiledMinecraft   File: BlockTorch.java   Source Code and License Vote up 6 votes
/**
 * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
 * IBlockstate
 */
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
{
    if (this.canPlaceAt(worldIn, pos, facing))
    {
        return this.getDefaultState().withProperty(FACING, facing);
    }
    else
    {
        for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
        {
            if (worldIn.isBlockNormalCube(pos.offset(enumfacing.getOpposite()), true))
            {
                return this.getDefaultState().withProperty(FACING, enumfacing);
            }
        }

        return this.getDefaultState();
    }
}
 
Example 2
Project: DecompiledMinecraft   File: BlockTorch.java   Source Code and License Vote up 6 votes
/**
 * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
 * IBlockstate
 */
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
{
    if (this.canPlaceAt(worldIn, pos, facing))
    {
        return this.getDefaultState().withProperty(FACING, facing);
    }
    else
    {
        for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
        {
            if (worldIn.isBlockNormalCube(pos.offset(enumfacing.getOpposite()), true))
            {
                return this.getDefaultState().withProperty(FACING, enumfacing);
            }
        }

        return this.getDefaultState();
    }
}
 
Example 3
Project: BaseClient   File: BlockTorch.java   Source Code and License Vote up 6 votes
/**
 * Called by ItemBlocks just before a block is actually set in the world, to
 * allow for adjustments to the IBlockstate
 */
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ,
		int meta, EntityLivingBase placer) {
	if (this.canPlaceAt(worldIn, pos, facing)) {
		return this.getDefaultState().withProperty(FACING, facing);
	} else {
		for (Object enumfacing0 : EnumFacing.Plane.HORIZONTAL) {
			EnumFacing enumfacing = (EnumFacing) enumfacing0;
			if (worldIn.isBlockNormalCube(pos.offset(enumfacing.getOpposite()), true)) {
				return this.getDefaultState().withProperty(FACING, enumfacing);
			}
		}

		return this.getDefaultState();
	}
}
 
Example 4
Project: BaseClient   File: BlockTorch.java   Source Code and License Vote up 6 votes
protected boolean onNeighborChangeInternal(World worldIn, BlockPos pos, IBlockState state) {
	if (!this.checkForDrop(worldIn, pos, state)) {
		return true;
	} else {
		EnumFacing enumfacing = (EnumFacing) state.getValue(FACING);
		EnumFacing.Axis enumfacing$axis = enumfacing.getAxis();
		EnumFacing enumfacing1 = enumfacing.getOpposite();
		boolean flag = false;

		if (enumfacing$axis.isHorizontal() && !worldIn.isBlockNormalCube(pos.offset(enumfacing1), true)) {
			flag = true;
		} else if (enumfacing$axis.isVertical() && !this.canPlaceOn(worldIn, pos.offset(enumfacing1))) {
			flag = true;
		}

		if (flag) {
			this.dropBlockAsItem(worldIn, pos, state, 0);
			worldIn.setBlockToAir(pos);
			return true;
		} else {
			return false;
		}
	}
}
 
Example 5
Project: BaseClient   File: BlockTorch.java   Source Code and License Vote up 6 votes
/**
 * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
 * IBlockstate
 */
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
{
    if (this.canPlaceAt(worldIn, pos, facing))
    {
        return this.getDefaultState().withProperty(FACING, facing);
    }
    else
    {
        for (Object enumfacing0 : EnumFacing.Plane.HORIZONTAL)
        {
            EnumFacing enumfacing = (EnumFacing) enumfacing0;

            if (worldIn.isBlockNormalCube(pos.offset(enumfacing.getOpposite()), true))
            {
                return this.getDefaultState().withProperty(FACING, enumfacing);
            }
        }

        return this.getDefaultState();
    }
}
 
Example 6
Project: Backmemed   File: BlockTorch.java   Source Code and License Vote up 6 votes
/**
 * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
 * IBlockstate
 */
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
{
    if (this.canPlaceAt(worldIn, pos, facing))
    {
        return this.getDefaultState().withProperty(FACING, facing);
    }
    else
    {
        for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
        {
            if (worldIn.isBlockNormalCube(pos.offset(enumfacing.getOpposite()), true))
            {
                return this.getDefaultState().withProperty(FACING, enumfacing);
            }
        }

        return this.getDefaultState();
    }
}
 
Example 7
Project: DecompiledMinecraft   File: BlockTorch.java   Source Code and License Vote up 5 votes
protected boolean onNeighborChangeInternal(World worldIn, BlockPos pos, IBlockState state)
{
    if (!this.checkForDrop(worldIn, pos, state))
    {
        return true;
    }
    else
    {
        EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
        EnumFacing.Axis enumfacing$axis = enumfacing.getAxis();
        EnumFacing enumfacing1 = enumfacing.getOpposite();
        boolean flag = false;

        if (enumfacing$axis.isHorizontal() && !worldIn.isBlockNormalCube(pos.offset(enumfacing1), true))
        {
            flag = true;
        }
        else if (enumfacing$axis.isVertical() && !this.canPlaceOn(worldIn, pos.offset(enumfacing1)))
        {
            flag = true;
        }

        if (flag)
        {
            this.dropBlockAsItem(worldIn, pos, state, 0);
            worldIn.setBlockToAir(pos);
            return true;
        }
        else
        {
            return false;
        }
    }
}
 
Example 8
Project: DecompiledMinecraft   File: BlockTorch.java   Source Code and License Vote up 5 votes
protected boolean onNeighborChangeInternal(World worldIn, BlockPos pos, IBlockState state)
{
    if (!this.checkForDrop(worldIn, pos, state))
    {
        return true;
    }
    else
    {
        EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
        EnumFacing.Axis enumfacing$axis = enumfacing.getAxis();
        EnumFacing enumfacing1 = enumfacing.getOpposite();
        boolean flag = false;

        if (enumfacing$axis.isHorizontal() && !worldIn.isBlockNormalCube(pos.offset(enumfacing1), true))
        {
            flag = true;
        }
        else if (enumfacing$axis.isVertical() && !this.canPlaceOn(worldIn, pos.offset(enumfacing1)))
        {
            flag = true;
        }

        if (flag)
        {
            this.dropBlockAsItem(worldIn, pos, state, 0);
            worldIn.setBlockToAir(pos);
            return true;
        }
        else
        {
            return false;
        }
    }
}
 
Example 9
Project: BaseClient   File: BlockTorch.java   Source Code and License Vote up 5 votes
protected boolean onNeighborChangeInternal(World worldIn, BlockPos pos, IBlockState state)
{
    if (!this.checkForDrop(worldIn, pos, state))
    {
        return true;
    }
    else
    {
        EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
        EnumFacing.Axis enumfacing$axis = enumfacing.getAxis();
        EnumFacing enumfacing1 = enumfacing.getOpposite();
        boolean flag = false;

        if (enumfacing$axis.isHorizontal() && !worldIn.isBlockNormalCube(pos.offset(enumfacing1), true))
        {
            flag = true;
        }
        else if (enumfacing$axis.isVertical() && !this.canPlaceOn(worldIn, pos.offset(enumfacing1)))
        {
            flag = true;
        }

        if (flag)
        {
            this.dropBlockAsItem(worldIn, pos, state, 0);
            worldIn.setBlockToAir(pos);
            return true;
        }
        else
        {
            return false;
        }
    }
}
 
Example 10
Project: Backmemed   File: BlockTorch.java   Source Code and License Vote up 5 votes
protected boolean onNeighborChangeInternal(World worldIn, BlockPos pos, IBlockState state)
{
    if (!this.checkForDrop(worldIn, pos, state))
    {
        return true;
    }
    else
    {
        EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
        EnumFacing.Axis enumfacing$axis = enumfacing.getAxis();
        EnumFacing enumfacing1 = enumfacing.getOpposite();
        boolean flag = false;

        if (enumfacing$axis.isHorizontal() && !worldIn.isBlockNormalCube(pos.offset(enumfacing1), true))
        {
            flag = true;
        }
        else if (enumfacing$axis.isVertical() && !this.canPlaceOn(worldIn, pos.offset(enumfacing1)))
        {
            flag = true;
        }

        if (flag)
        {
            this.dropBlockAsItem(worldIn, pos, state, 0);
            worldIn.setBlockToAir(pos);
            return true;
        }
        else
        {
            return false;
        }
    }
}
 
Example 11
Project: DecompiledMinecraft   File: BlockTorch.java   Source Code and License Vote up 4 votes
private boolean canPlaceAt(World worldIn, BlockPos pos, EnumFacing facing)
{
    BlockPos blockpos = pos.offset(facing.getOpposite());
    boolean flag = facing.getAxis().isHorizontal();
    return flag && worldIn.isBlockNormalCube(blockpos, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos);
}
 
Example 12
Project: DecompiledMinecraft   File: BlockTorch.java   Source Code and License Vote up 4 votes
private boolean canPlaceAt(World worldIn, BlockPos pos, EnumFacing facing)
{
    BlockPos blockpos = pos.offset(facing.getOpposite());
    boolean flag = facing.getAxis().isHorizontal();
    return flag && worldIn.isBlockNormalCube(blockpos, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos);
}
 
Example 13
Project: BaseClient   File: BlockTorch.java   Source Code and License Vote up 4 votes
private boolean canPlaceAt(World worldIn, BlockPos pos, EnumFacing facing) {
	BlockPos blockpos = pos.offset(facing.getOpposite());
	boolean flag = facing.getAxis().isHorizontal();
	return flag && worldIn.isBlockNormalCube(blockpos, true)
			|| facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos);
}
 
Example 14
Project: BaseClient   File: BlockTorch.java   Source Code and License Vote up 4 votes
private boolean canPlaceAt(World worldIn, BlockPos pos, EnumFacing facing)
{
    BlockPos blockpos = pos.offset(facing.getOpposite());
    boolean flag = facing.getAxis().isHorizontal();
    return flag && worldIn.isBlockNormalCube(blockpos, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos);
}
 
Example 15
Project: Backmemed   File: BlockTorch.java   Source Code and License Vote up 4 votes
private boolean canPlaceAt(World worldIn, BlockPos pos, EnumFacing facing)
{
    BlockPos blockpos = pos.offset(facing.getOpposite());
    boolean flag = facing.getAxis().isHorizontal();
    return flag && worldIn.isBlockNormalCube(blockpos, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos);
}