Java 类net.minecraft.block.BlockSlab.EnumBlockHalf 实例源码

项目:MC-Prefab    文件:BlockGlassSlab.java   
public BlockGlassSlab()
{
    super(Material.GLASS);

    this.setSoundType(SoundType.GLASS);
    IBlockState iblockstate = this.blockState.getBaseState();
    this.setHardness(0.5F);

    if (!this.isDouble())
    {
        iblockstate = iblockstate.withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM);
        ModRegistry.setBlockName(this, "block_half_glass_slab");
        this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
    }
    else
    {
        ModRegistry.setBlockName(this, "block_glass_slab");
    }

    iblockstate = iblockstate.withProperty(VARIANT_PROPERTY, false);

    this.setDefaultState(iblockstate);
    this.useNeighborBrightness = !this.isDouble();
}
项目:MC-Prefab    文件:BlockGlassSlab.java   
/**
 * Convert the given metadata into a BlockState for this Block
 */
@Override
public IBlockState getStateFromMeta(int meta)
{
    IBlockState blockState = this.getDefaultState();
    blockState = blockState.withProperty(VARIANT_PROPERTY, false);

    if (!this.isDouble()) 
    {
        EnumBlockHalf value = EnumBlockHalf.BOTTOM;

        if ((meta & 8) != 0) 
        {
            value = EnumBlockHalf.TOP;
        }

        blockState = blockState.withProperty(HALF, value);
    }

    return blockState;
}
项目:MC-Prefab    文件:BlockGraniteSlab.java   
public BlockGraniteSlab()
{
    super(Material.ROCK);

    this.setSoundType(SoundType.STONE);
    IBlockState iblockstate = this.blockState.getBaseState();
    this.setHardness(0.5F);

    if (!this.isDouble())
    {
        iblockstate = iblockstate.withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM);
        ModRegistry.setBlockName(this, "block_half_granite_slab");
        this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
    }
    else
    {
        ModRegistry.setBlockName(this, "block_granite_slab");
    }

    iblockstate = iblockstate.withProperty(VARIANT_PROPERTY, false);

    this.setDefaultState(iblockstate);
    this.useNeighborBrightness = !this.isDouble();
}
项目:MC-Prefab    文件:BlockGraniteSlab.java   
/**
 * Convert the given metadata into a BlockState for this Block
 */
@Override
public IBlockState getStateFromMeta(int meta)
{
    IBlockState blockState = this.getDefaultState();
    blockState = blockState.withProperty(VARIANT_PROPERTY, false);

    if (!this.isDouble()) 
    {
        EnumBlockHalf value = EnumBlockHalf.BOTTOM;

        if ((meta & 8) != 0) 
        {
            value = EnumBlockHalf.TOP;
        }

        blockState = blockState.withProperty(HALF, value);
    }

    return blockState;
}
项目:MC-Prefab    文件:BlockDioriteSlab.java   
public BlockDioriteSlab()
{
    super(Material.ROCK);

    this.setSoundType(SoundType.STONE);
    IBlockState iblockstate = this.blockState.getBaseState();
    this.setHardness(0.5F);

    if (!this.isDouble())
    {
        iblockstate = iblockstate.withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM);
        ModRegistry.setBlockName(this, "block_half_diorite_slab");
        this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
    }
    else
    {
        ModRegistry.setBlockName(this, "block_diorite_slab");
    }

    iblockstate = iblockstate.withProperty(VARIANT_PROPERTY, false);

    this.setDefaultState(iblockstate);
    this.useNeighborBrightness = !this.isDouble();
}
项目:MC-Prefab    文件:BlockDioriteSlab.java   
/**
 * Convert the given metadata into a BlockState for this Block
 */
@Override
public IBlockState getStateFromMeta(int meta)
{
    IBlockState blockState = this.getDefaultState();
    blockState = blockState.withProperty(VARIANT_PROPERTY, false);

    if (!this.isDouble()) 
    {
        EnumBlockHalf value = EnumBlockHalf.BOTTOM;

        if ((meta & 8) != 0) 
        {
            value = EnumBlockHalf.TOP;
        }

        blockState = blockState.withProperty(HALF, value);
    }

    return blockState;
}
项目:MC-Prefab    文件:BlockAndesiteSlab.java   
public BlockAndesiteSlab()
{
    super(Material.ROCK);

    this.setSoundType(SoundType.STONE);
    IBlockState iblockstate = this.blockState.getBaseState();
    this.setHardness(0.5F);

    if (!this.isDouble())
    {
        iblockstate = iblockstate.withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM);
        ModRegistry.setBlockName(this, "block_half_andesite_slab");
        this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);
    }
    else
    {
        ModRegistry.setBlockName(this, "block_andesite_slab");
    }

    iblockstate = iblockstate.withProperty(VARIANT_PROPERTY, false);

    this.setDefaultState(iblockstate);
    this.useNeighborBrightness = !this.isDouble();
}
项目:MC-Prefab    文件:BlockAndesiteSlab.java   
/**
 * Convert the given metadata into a BlockState for this Block
 */
@Override
public IBlockState getStateFromMeta(int meta)
{
    IBlockState blockState = this.getDefaultState();
    blockState = blockState.withProperty(VARIANT_PROPERTY, false);

    if (!this.isDouble()) 
    {
        EnumBlockHalf value = EnumBlockHalf.BOTTOM;

        if ((meta & 8) != 0) 
        {
            value = EnumBlockHalf.TOP;
        }

        blockState = blockState.withProperty(HALF, value);
    }

    return blockState;
}
项目:enderutilities    文件:BlockElevatorSlab.java   
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess blockAccess, BlockPos pos)
{
    if (this == EnderUtilitiesBlocks.ELEVATOR_SLAB)
    {
        state = state.getActualState(blockAccess, pos);
        return state.getValue(HALF) == EnumBlockHalf.TOP ? BOUNDS_SLAB_TOP : BOUNDS_SLAB_BOTTOM;
    }
    else if (this == EnderUtilitiesBlocks.ELEVATOR_LAYER)
    {
        state = state.getActualState(blockAccess, pos);
        return state.getValue(HALF) == EnumBlockHalf.TOP ? BOUNDS_LAYER_TOP : BOUNDS_LAYER_BOTTOM;
    }

    return FULL_BLOCK_AABB;
}
项目:MC-Prefab    文件:BlockGlassSlab.java   
/**
 * Convert the BlockState into the correct metadata value
 */
@Override
public int getMetaFromState(IBlockState state)
{
    int i = 0;

    if (!this.isDouble() && state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP)
    {
        i |= 8;
    }

    return i;
}
项目:MC-Prefab    文件:BlockGraniteSlab.java   
/**
 * Convert the BlockState into the correct metadata value
 */
@Override
public int getMetaFromState(IBlockState state)
{
    int i = 0;

    if (!this.isDouble() && state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP)
    {
        i |= 8;
    }

    return i;
}
项目:MC-Prefab    文件:BlockDioriteSlab.java   
/**
 * Convert the BlockState into the correct metadata value
 */
@Override
public int getMetaFromState(IBlockState state)
{
    int i = 0;

    if (!this.isDouble() && state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP)
    {
        i |= 8;
    }

    return i;
}
项目:MC-Prefab    文件:BlockAndesiteSlab.java   
/**
 * Convert the BlockState into the correct metadata value
 */
@Override
public int getMetaFromState(IBlockState state)
{
    int i = 0;

    if (!this.isDouble() && state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP)
    {
        i |= 8;
    }

    return i;
}
项目:Toms-Mod    文件:TMResource.java   
public IBlockState getSlab(SlabState state) {
    switch (state) {
    case BOTTOM:
        return slabBlock.half.getStateForType(this).withProperty(BlockSlab.HALF, EnumBlockHalf.BOTTOM);
    case FULL:
        return slabBlock.full.getStateForType(this);
    case TOP:
        return slabBlock.half.getStateForType(this).withProperty(BlockSlab.HALF, EnumBlockHalf.TOP);
    default:
        break;
    }
    return null;
}
项目:enderutilities    文件:BlockElevatorSlab.java   
public BlockElevatorSlab(String name, float hardness, float resistance, int harvestLevel, Material material)
{
    super(name, hardness, resistance, harvestLevel, material);

    this.setDefaultState(this.getBlockState().getBaseState()
            .withProperty(COLOR, EnumDyeColor.WHITE)
            .withProperty(HALF, EnumBlockHalf.BOTTOM));
}
项目:enderutilities    文件:BlockElevatorSlab.java   
@Override
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY,
        float hitZ, int meta, EntityLivingBase placer, EnumHand hand)
{
    IBlockState state = super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer, hand);

    boolean top = facing == EnumFacing.DOWN || (facing.getAxis().isHorizontal() && hitY >= 0.5f);
    state = state.withProperty(HALF, top ? EnumBlockHalf.TOP : EnumBlockHalf.BOTTOM);

    return state;
}
项目:enderutilities    文件:BlockElevatorSlab.java   
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos)
{
    // Don't try to set the facing as the elevator doesn't have one, which is what the super would do
    TileEntityElevator te = getTileEntitySafely(world, pos, TileEntityElevator.class);

    if (te != null)
    {
        state = state.withProperty(HALF, te.isTopHalf() ? EnumBlockHalf.TOP : EnumBlockHalf.BOTTOM);
    }

    return state;
}
项目:AbyssalCraft    文件:ACscion1.java   
@Override
public boolean generate(World world, Random random, BlockPos pos) {

    IBlockState grass = Blocks.GRASS.getDefaultState();
    IBlockState glowing_brick = ACBlocks.glowing_darkstone_bricks.getDefaultState();
    IBlockState chiseled_brick = ACBlocks.darkstone_brick.getStateFromMeta(1);
    IBlockState brick_slab = ACBlocks.darkstone_brick_slab.getDefaultState();

    boolean shouldGrass = world.getBlockState(pos).getMaterial() == Material.GRASS;

    for(int i = -3; i < 4; i++)
        for(int j = -4; j < 5; j++){

            boolean flag = i > -3 && i < 3;
            boolean flag1 = i == -3 || i == 3;
            boolean flag2 = i > -2 && i < 2;

            if(j == -3 || j == 3 && flag)
                for(int k = 0; k < 4; k++){
                    world.setBlockToAir(pos.add(j, k+2, i));
                    world.setBlockToAir(pos.add(i, k+2, j));
                }
            if(j == -2 || j == 2 && !flag2)
                for(int k = 0; k < 4; k++){
                    world.setBlockToAir(pos.add(j, k+2, i));
                    world.setBlockToAir(pos.add(i, k+2, j));
                }

            if(j == -4 || j == 4)
                if(flag && shouldGrass){
                    setBlockAndNotifyAdequately(world, pos.add(j, 1, i), grass);
                    setBlockAndNotifyAdequately(world, pos.add(i, 1, j), grass);
                }
            if(j == -3 || j == 3)
                if(shouldGrass){
                    setBlockAndNotifyAdequately(world, pos.add(j, 1, i), flag1 ? grass : getBrick(random));
                    setBlockAndNotifyAdequately(world, pos.add(i, 1, j), flag1 ? grass : getBrick(random));
                } else if(!flag1){
                    setBlockAndNotifyAdequately(world, pos.add(j, 1, i), getBrick(random));
                    setBlockAndNotifyAdequately(world, pos.add(i, 1, j), getBrick(random));
                }
            if(j > -3 && j < 3){
                setBlockAndNotifyAdequately(world, pos.add(j, 1, i), getBrick(random));
                if((j == -2 || j == 2) && flag2)
                    for(int k = 0; k < 4; k++){
                        if(k == 0){
                            setBlockAndNotifyAdequately(world, pos.add(j, k+2, i), i == 0 ? ACBlocks.darkstone_brick_stairs.getStateFromMeta(j > 0 ? 1 : 0) : glowing_brick);
                            setBlockAndNotifyAdequately(world, pos.add(i, k+2, j), i == 0 ? ACBlocks.darkstone_brick_stairs.getStateFromMeta(j > 0 ? 3 : 2) : glowing_brick);
                        }
                        if(k == 1){
                            setBlockAndNotifyAdequately(world, pos.add(j, k+2, i), i == 0 ? Blocks.AIR.getDefaultState() : brick_slab);
                            setBlockAndNotifyAdequately(world, pos.add(i, k+2, j), i == 0 ? Blocks.AIR.getDefaultState() : brick_slab);
                        }
                        if(k == 2){
                            setBlockAndNotifyAdequately(world, pos.add(j, k+2, i), i == 0 ? brick_slab.withProperty(BlockSlab.HALF, EnumBlockHalf.TOP) : ACBlocks.darkstone_brick_stairs.getStateFromMeta(j > 0 ? 5 : 4));
                            setBlockAndNotifyAdequately(world, pos.add(i, k+2, j), i == 0 ? brick_slab.withProperty(BlockSlab.HALF, EnumBlockHalf.TOP) : ACBlocks.darkstone_brick_stairs.getStateFromMeta(j > 0 ? 7 : 6));
                        }
                        if(k == 3){
                            setBlockAndNotifyAdequately(world, pos.add(j, k+2, i), brick_slab);
                            setBlockAndNotifyAdequately(world, pos.add(i, k+2, j), brick_slab);
                        }
                    }
                if(j > -2 && j < 2 && flag2)
                    for(int k = 0; k < 4; k++)
                        setBlockAndNotifyAdequately(world, pos.add(j, k+2, i), (j == 0 && i != 0 || j != 0 && i == 0) && k == 1 ? chiseled_brick : k == 3 ? brick_slab : getBrick(random));
            }
        }

    if(random.nextFloat() < 0.1){
        setBlockAndNotifyAdequately(world, pos.up(4), Blocks.DIRT.getDefaultState());
        new WorldGenDLT(true).generate(world, random, pos.up(5));
    }

    return true;
}