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

项目: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   
private static AxisAlignedBB getCollQuarterBlock(IBlockState bstate)
{
    boolean flag = bstate.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP;

    switch ((EnumFacing)bstate.getValue(BlockStairs.FACING))
    {
    case NORTH:
    default:
        return flag ? AABB_QTR_BOT_NORTH : AABB_QTR_TOP_NORTH;
    case SOUTH:
        return flag ? AABB_QTR_BOT_SOUTH : AABB_QTR_TOP_SOUTH;
    case WEST:
        return flag ? AABB_QTR_BOT_WEST : AABB_QTR_TOP_WEST;
    case EAST:
        return flag ? AABB_QTR_BOT_EAST : AABB_QTR_TOP_EAST;
    }
}
项目: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   
private static AxisAlignedBB getCollQuarterBlock(IBlockState bstate)
{
    boolean flag = bstate.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP;

    switch ((EnumFacing)bstate.getValue(BlockStairs.FACING))
    {
    case NORTH:
    default:
        return flag ? AABB_QTR_BOT_NORTH : AABB_QTR_TOP_NORTH;
    case SOUTH:
        return flag ? AABB_QTR_BOT_SOUTH : AABB_QTR_TOP_SOUTH;
    case WEST:
        return flag ? AABB_QTR_BOT_WEST : AABB_QTR_TOP_WEST;
    case EAST:
        return flag ? AABB_QTR_BOT_EAST : AABB_QTR_TOP_EAST;
    }
}
项目: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   
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);
    }
}
项目: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   
@Override
public IBlockState getStateFromMeta(int meta)
{
    IBlockState iblockstate = getDefaultState().withProperty(BlockStairs.HALF, (meta & 0x4) > 0 ? EnumHalf.TOP : EnumHalf.BOTTOM);
    iblockstate = iblockstate.withProperty(BlockStairs.FACING, EnumFacing.getFront(5 - (meta & 0x3)));
    return iblockstate;
}
项目:TFC2    文件:BlockStairsTFC.java   
@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;
}
项目: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   
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);
    }
}
项目: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   
@Override
public IBlockState getStateFromMeta(int meta)
{
    IBlockState iblockstate = getDefaultState().withProperty(BlockStairs.HALF, (meta & 0x4) > 0 ? EnumHalf.TOP : EnumHalf.BOTTOM);
    iblockstate = iblockstate.withProperty(BlockStairs.FACING, EnumFacing.getFront(5 - (meta & 0x3)));
    return iblockstate;
}
项目:TFC2    文件:BlockStairsTFC.java   
@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;
}
项目:minecraft-roguelike    文件:MetaStair.java   
public MetaStair setOrientation(Cardinal dir, Boolean upsideDown){
    IBlockState stair = this.getBlock().getDefaultState();
    stair = stair.withProperty(BlockStairs.FACING, Cardinal.facing(dir));
    stair = stair.withProperty(BlockStairs.HALF, upsideDown ? EnumHalf.TOP : EnumHalf.BOTTOM);
    this.setState(stair);
    return this;
}