Java 类net.minecraft.block.BlockStairs.EnumShape 实例源码

项目:TFC2    文件:BlockStairsTFC.java   
@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;
}
项目:TFC2    文件:BlockStairsTFC.java   
@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;
}
项目:TFC2    文件:BlockStairsTFC.java   
private static List<AxisAlignedBB> getCollisionBoxList(IBlockState bstate)
{
    List<AxisAlignedBB> list = Lists.<AxisAlignedBB>newArrayList();
    boolean flag = bstate.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP;
    list.add(flag ? AABB_SLAB_TOP : AABB_SLAB_BOTTOM);
    BlockStairs.EnumShape blockstairs$enumshape = (BlockStairs.EnumShape)bstate.getValue(BlockStairs.SHAPE);

    if (blockstairs$enumshape == BlockStairs.EnumShape.STRAIGHT || blockstairs$enumshape == BlockStairs.EnumShape.INNER_LEFT || blockstairs$enumshape == BlockStairs.EnumShape.INNER_RIGHT)
    {
        list.add(getCollQuarterBlock(bstate));
    }

    if (blockstairs$enumshape != BlockStairs.EnumShape.STRAIGHT)
    {
        list.add(getCollEighthBlock(bstate));
    }

    return list;
}
项目:TFC2    文件:BlockStairsTFC.java   
@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;
}
项目:TFC2    文件:BlockStairsTFC.java   
@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;
}
项目:TFC2    文件:BlockStairsTFC.java   
private static List<AxisAlignedBB> getCollisionBoxList(IBlockState bstate)
{
    List<AxisAlignedBB> list = Lists.<AxisAlignedBB>newArrayList();
    boolean flag = bstate.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP;
    list.add(flag ? AABB_SLAB_TOP : AABB_SLAB_BOTTOM);
    BlockStairs.EnumShape blockstairs$enumshape = (BlockStairs.EnumShape)bstate.getValue(BlockStairs.SHAPE);

    if (blockstairs$enumshape == BlockStairs.EnumShape.STRAIGHT || blockstairs$enumshape == BlockStairs.EnumShape.INNER_LEFT || blockstairs$enumshape == BlockStairs.EnumShape.INNER_RIGHT)
    {
        list.add(getCollQuarterBlock(bstate));
    }

    if (blockstairs$enumshape != BlockStairs.EnumShape.STRAIGHT)
    {
        list.add(getCollEighthBlock(bstate));
    }

    return list;
}
项目:Structure    文件:StairsMinecraftRotation.java   
@Override
public IBlockState alterBlockState(IBlockState state, EnumFacing orientation, boolean mirror)
{
    final EnumFacing facing = state.getValue(BlockHorizontal.FACING);
    final EnumShape shape = state.getValue(SHAPE);
    final EnumHalf half = state.getValue(HALF);

    return state
            .withProperty(BlockHorizontal.FACING, localToGlobal(facing, orientation, mirror))
            .withProperty(SHAPE, mirror & half == EnumHalf.BOTTOM ? opp[shape.ordinal()] : shape);
}
项目:Structure    文件:StairMatcher.java   
@Override
public boolean matchBlockState(IBlockState b1, IBlockState b2)
{
    final EnumFacing b1Facing = b1.getValue(BlockHorizontal.FACING);
    final EnumFacing b2Facing = b2.getValue(BlockHorizontal.FACING);

    final EnumHalf b1Half = b1.getValue(HALF);
    final EnumHalf b2Half = b2.getValue(HALF);

    final EnumShape b1Shape = b1.getValue(SHAPE);
    final EnumShape b2Shape = b2.getValue(SHAPE);

    if (b1Half != b2Half)
    {
        return false;
    }

    if (b1Facing == b2Facing)
    {
        return b1Shape == b2Shape;
    }

    if (b1Facing.getOpposite() == b2Facing)
    {
        return false;
    }

    if ((b1Shape == EnumShape.OUTER_RIGHT && b2Shape == EnumShape.OUTER_LEFT) ||
            (b1Shape == EnumShape.INNER_RIGHT && b2Shape == EnumShape.INNER_LEFT) ||
            (b1Shape == EnumShape.OUTER_LEFT && b2Shape == EnumShape.OUTER_RIGHT) ||
            (b1Shape == EnumShape.INNER_LEFT && b2Shape == EnumShape.INNER_RIGHT))
    {
        return true;
    }

    return false;
}
项目:TFC2    文件:BlockStairsTFC.java   
public BlockStairsTFC(IBlockState modelState)
{
    super(modelState.getBlock().getMaterial(modelState), null);
    setDefaultState(this.blockState.getBaseState().withProperty(BlockStairs.FACING, EnumFacing.NORTH).withProperty(BlockStairs.HALF, EnumHalf.BOTTOM).withProperty(BlockStairs.SHAPE, EnumShape.STRAIGHT));
    this.modelBlock = modelState.getBlock();
    this.modelState = modelState;
    //setHardness(this.modelBlock.blockHardness);
    //setResistance(this.modelBlock.blockResistance / 3.0F);
    this.setSoundType(SoundType.WOOD);
    setLightOpacity(255);
    this.setCreativeTab(TFCTabs.TFCBuilding);
}
项目:TFC2    文件:BlockStairsTFC.java   
/**
 * Returns a bounding box representing an eighth of a block (a block whose three dimensions are halved).
 * Used in all stair shapes except STRAIGHT (gets added alone in the case of OUTER; alone with a quarter block in
 * case of INSIDE).
 */
private static AxisAlignedBB getCollEighthBlock(IBlockState bstate)
{
    EnumFacing enumfacing = (EnumFacing)bstate.getValue(BlockStairs.FACING);
    EnumFacing enumfacing1;

    switch ((BlockStairs.EnumShape)bstate.getValue(BlockStairs.SHAPE))
    {
    case OUTER_LEFT:
    default:
        enumfacing1 = enumfacing;
        break;
    case OUTER_RIGHT:
        enumfacing1 = enumfacing.rotateY();
        break;
    case INNER_RIGHT:
        enumfacing1 = enumfacing.getOpposite();
        break;
    case INNER_LEFT:
        enumfacing1 = enumfacing.rotateYCCW();
    }

    boolean flag = bstate.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP;

    switch (enumfacing1)
    {
    case NORTH:
    default:
        return flag ? AABB_OCT_BOT_NW : AABB_OCT_TOP_NW;
    case SOUTH:
        return flag ? AABB_OCT_BOT_SE : AABB_OCT_TOP_SE;
    case WEST:
        return flag ? AABB_OCT_BOT_SW : AABB_OCT_TOP_SW;
    case EAST:
        return flag ? AABB_OCT_BOT_NE : AABB_OCT_TOP_NE;
    }
}
项目:TFC2    文件:BlockStairsTFC.java   
@Override
public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand)
{
    IBlockState iblockstate = super.getStateForPlacement(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer, hand);
    iblockstate = iblockstate.withProperty(BlockStairs.FACING, placer.getHorizontalFacing()).withProperty(BlockStairs.SHAPE, EnumShape.STRAIGHT);
    return (facing != EnumFacing.DOWN) && ((facing == EnumFacing.UP) || (hitY <= 0.5D)) ? iblockstate.withProperty(BlockStairs.HALF, EnumHalf.BOTTOM) : iblockstate.withProperty(BlockStairs.HALF, EnumHalf.TOP);
}
项目:TFC2    文件:BlockStairsTFC.java   
private static BlockStairs.EnumShape func_185706_d(IBlockState p_185706_0_, IBlockAccess p_185706_1_, BlockPos p_185706_2_)
{
    EnumFacing enumfacing = (EnumFacing)p_185706_0_.getValue(BlockStairs.FACING);
    IBlockState iblockstate = p_185706_1_.getBlockState(p_185706_2_.offset(enumfacing));

    if (isBlockStairs(iblockstate) && p_185706_0_.getValue(BlockStairs.HALF) == iblockstate.getValue(BlockStairs.HALF))
    {
        EnumFacing enumfacing1 = (EnumFacing)iblockstate.getValue(BlockStairs.FACING);

        if (enumfacing1.getAxis() != ((EnumFacing)p_185706_0_.getValue(BlockStairs.FACING)).getAxis() && isDifferentStairs(p_185706_0_, p_185706_1_, p_185706_2_, enumfacing1.getOpposite()))
        {
            if (enumfacing1 == enumfacing.rotateYCCW())
            {
                return BlockStairs.EnumShape.OUTER_LEFT;
            }

            return BlockStairs.EnumShape.OUTER_RIGHT;
        }
    }

    IBlockState iblockstate1 = p_185706_1_.getBlockState(p_185706_2_.offset(enumfacing.getOpposite()));

    if (isBlockStairs(iblockstate1) && p_185706_0_.getValue(BlockStairs.HALF) == iblockstate1.getValue(BlockStairs.HALF))
    {
        EnumFacing enumfacing2 = (EnumFacing)iblockstate1.getValue(BlockStairs.FACING);

        if (enumfacing2.getAxis() != ((EnumFacing)p_185706_0_.getValue(BlockStairs.FACING)).getAxis() && isDifferentStairs(p_185706_0_, p_185706_1_, p_185706_2_, enumfacing2))
        {
            if (enumfacing2 == enumfacing.rotateYCCW())
            {
                return BlockStairs.EnumShape.INNER_LEFT;
            }

            return BlockStairs.EnumShape.INNER_RIGHT;
        }
    }

    return BlockStairs.EnumShape.STRAIGHT;
}
项目:TFC2    文件:BlockStairsTFC.java   
public BlockStairsTFC(IBlockState modelState)
{
    super(modelState.getBlock().getMaterial(modelState), null);
    setDefaultState(this.blockState.getBaseState().withProperty(BlockStairs.FACING, EnumFacing.NORTH).withProperty(BlockStairs.HALF, EnumHalf.BOTTOM).withProperty(BlockStairs.SHAPE, EnumShape.STRAIGHT));
    this.modelBlock = modelState.getBlock();
    this.modelState = modelState;
    //setHardness(this.modelBlock.blockHardness);
    //setResistance(this.modelBlock.blockResistance / 3.0F);
    this.setSoundType(SoundType.WOOD);
    setLightOpacity(255);
    this.setCreativeTab(TFCTabs.TFCBuilding);
}
项目:TFC2    文件:BlockStairsTFC.java   
/**
 * Returns a bounding box representing an eighth of a block (a block whose three dimensions are halved).
 * Used in all stair shapes except STRAIGHT (gets added alone in the case of OUTER; alone with a quarter block in
 * case of INSIDE).
 */
private static AxisAlignedBB getCollEighthBlock(IBlockState bstate)
{
    EnumFacing enumfacing = (EnumFacing)bstate.getValue(BlockStairs.FACING);
    EnumFacing enumfacing1;

    switch ((BlockStairs.EnumShape)bstate.getValue(BlockStairs.SHAPE))
    {
    case OUTER_LEFT:
    default:
        enumfacing1 = enumfacing;
        break;
    case OUTER_RIGHT:
        enumfacing1 = enumfacing.rotateY();
        break;
    case INNER_RIGHT:
        enumfacing1 = enumfacing.getOpposite();
        break;
    case INNER_LEFT:
        enumfacing1 = enumfacing.rotateYCCW();
    }

    boolean flag = bstate.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP;

    switch (enumfacing1)
    {
    case NORTH:
    default:
        return flag ? AABB_OCT_BOT_NW : AABB_OCT_TOP_NW;
    case SOUTH:
        return flag ? AABB_OCT_BOT_SE : AABB_OCT_TOP_SE;
    case WEST:
        return flag ? AABB_OCT_BOT_SW : AABB_OCT_TOP_SW;
    case EAST:
        return flag ? AABB_OCT_BOT_NE : AABB_OCT_TOP_NE;
    }
}
项目:TFC2    文件:BlockStairsTFC.java   
@Override
public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand)
{
    IBlockState iblockstate = super.getStateForPlacement(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer, hand);
    iblockstate = iblockstate.withProperty(BlockStairs.FACING, placer.getHorizontalFacing()).withProperty(BlockStairs.SHAPE, EnumShape.STRAIGHT);
    return (facing != EnumFacing.DOWN) && ((facing == EnumFacing.UP) || (hitY <= 0.5D)) ? iblockstate.withProperty(BlockStairs.HALF, EnumHalf.BOTTOM) : iblockstate.withProperty(BlockStairs.HALF, EnumHalf.TOP);
}
项目:TFC2    文件:BlockStairsTFC.java   
private static BlockStairs.EnumShape func_185706_d(IBlockState p_185706_0_, IBlockAccess p_185706_1_, BlockPos p_185706_2_)
{
    EnumFacing enumfacing = (EnumFacing)p_185706_0_.getValue(BlockStairs.FACING);
    IBlockState iblockstate = p_185706_1_.getBlockState(p_185706_2_.offset(enumfacing));

    if (isBlockStairs(iblockstate) && p_185706_0_.getValue(BlockStairs.HALF) == iblockstate.getValue(BlockStairs.HALF))
    {
        EnumFacing enumfacing1 = (EnumFacing)iblockstate.getValue(BlockStairs.FACING);

        if (enumfacing1.getAxis() != ((EnumFacing)p_185706_0_.getValue(BlockStairs.FACING)).getAxis() && isDifferentStairs(p_185706_0_, p_185706_1_, p_185706_2_, enumfacing1.getOpposite()))
        {
            if (enumfacing1 == enumfacing.rotateYCCW())
            {
                return BlockStairs.EnumShape.OUTER_LEFT;
            }

            return BlockStairs.EnumShape.OUTER_RIGHT;
        }
    }

    IBlockState iblockstate1 = p_185706_1_.getBlockState(p_185706_2_.offset(enumfacing.getOpposite()));

    if (isBlockStairs(iblockstate1) && p_185706_0_.getValue(BlockStairs.HALF) == iblockstate1.getValue(BlockStairs.HALF))
    {
        EnumFacing enumfacing2 = (EnumFacing)iblockstate1.getValue(BlockStairs.FACING);

        if (enumfacing2.getAxis() != ((EnumFacing)p_185706_0_.getValue(BlockStairs.FACING)).getAxis() && isDifferentStairs(p_185706_0_, p_185706_1_, p_185706_2_, enumfacing2))
        {
            if (enumfacing2 == enumfacing.rotateYCCW())
            {
                return BlockStairs.EnumShape.INNER_LEFT;
            }

            return BlockStairs.EnumShape.INNER_RIGHT;
        }
    }

    return BlockStairs.EnumShape.STRAIGHT;
}