Java Code Examples for net.minecraft.block.BlockStairs.EnumHalf#TOP

The following examples show how to use net.minecraft.block.BlockStairs.EnumHalf#TOP . 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: BlockStairsTFC.java    From TFC2 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean isSideSolid(IBlockState state,IBlockAccess world, BlockPos pos, EnumFacing side)
{
	boolean flipped = state.getValue(BlockStairs.HALF) == EnumHalf.TOP;
	EnumShape shape = (EnumShape)state.getValue(BlockStairs.SHAPE);
	EnumFacing facing = (EnumFacing)state.getValue(BlockStairs.FACING);
	if (side == EnumFacing.UP) return flipped;
	if (side == EnumFacing.DOWN) return !flipped;
	if (facing == side) return true;
	if (flipped)
	{
		if (shape == EnumShape.INNER_LEFT) return side == facing.rotateYCCW();
		if (shape == EnumShape.INNER_RIGHT) return side == facing.rotateY();
	}
	else
	{
		if (shape == EnumShape.INNER_LEFT) return side == facing.rotateY();
		if (shape == EnumShape.INNER_RIGHT) return side == facing.rotateYCCW();
	}
	return false;
}
 
Example 2
Source File: BlockStairsTFC.java    From TFC2 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face)
{
	if (net.minecraftforge.common.ForgeModContainer.disableStairSlabCulling)
		return super.doesSideBlockRendering(state, world, pos, face);

	if ( state.isOpaqueCube() )
		return true;

	state = this.getActualState(state, world, pos);

	EnumHalf half = state.getValue(BlockStairs.HALF);
	EnumFacing side = state.getValue(BlockStairs.FACING);
	EnumShape shape = state.getValue(BlockStairs.SHAPE);
	if (face == EnumFacing.UP) return half == EnumHalf.TOP;
	if (face == EnumFacing.DOWN) return half == EnumHalf.BOTTOM;
	if (shape == EnumShape.OUTER_LEFT || shape == EnumShape.OUTER_RIGHT) return false;
	if (face == side) return true;
	if (shape == EnumShape.INNER_LEFT && face.rotateY() == side) return true;
	if (shape == EnumShape.INNER_RIGHT && face.rotateYCCW() == side) return true;
	return false;
}
 
Example 3
Source File: BlockStairsTFC.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
public void setBaseCollisionBounds(IBlockAccess worldIn, BlockPos pos)
{
	if (worldIn.getBlockState(pos).getValue(BlockStairs.HALF) == EnumHalf.TOP)
	{
		setBlockBounds(0.0F, 0.5F, 0.0F, 1.0F, 1.0F, 1.0F);
	}
	else
	{
		setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
	}
}
 
Example 4
Source File: BlockStairsTFC.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public int getMetaFromState(IBlockState state)
{
	int i = 0;

	if (state.getValue(BlockStairs.HALF) == EnumHalf.TOP)
	{
		i |= 0x4;
	}

	i |= 5 - ((EnumFacing)state.getValue(BlockStairs.FACING)).getIndex();
	return i;
}