Java 类net.minecraft.block.BlockDirectional 实例源码

项目:Metalworks    文件:BlockBattery.java   
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
    EnumFacing side = state.getValue(BlockDirectional.FACING);
    switch (side){
        case DOWN:
        case UP: {
            return new AxisAlignedBB(2/16F, 0, 2/16F, 14/16F, 1, 14/16F);
        }
        case EAST:
        case WEST: {
            return new AxisAlignedBB(0, 2/16F, 2/16F, 1, 14/16F, 14/16F);
        }
        case NORTH:
        case SOUTH: {
            return new AxisAlignedBB(2/16F, 2/16F, 0, 14/16F, 14/16F, 1);
        }
    }
    return FULL_BLOCK_AABB;
}
项目:DecompiledMinecraft    文件:EntityPlayer.java   
/**
 * Returns the orientation of the bed in degrees.
 */
public float getBedOrientationInDegrees()
{
    if (this.playerLocation != null)
    {
        EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(this.playerLocation).getValue(BlockDirectional.FACING);

        switch (enumfacing)
        {
            case SOUTH:
                return 90.0F;

            case NORTH:
                return 270.0F;

            case WEST:
                return 0.0F;

            case EAST:
                return 180.0F;
        }
    }

    return 0.0F;
}
项目:BaseClient    文件:EntityPlayer.java   
/**
 * Returns the orientation of the bed in degrees.
 */
public float getBedOrientationInDegrees()
{
    if (this.playerLocation != null)
    {
        EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(this.playerLocation).getValue(BlockDirectional.FACING);

        switch (enumfacing)
        {
            case SOUTH:
                return 90.0F;

            case NORTH:
                return 270.0F;

            case WEST:
                return 0.0F;

            case EAST:
                return 180.0F;
        }
    }

    return 0.0F;
}
项目:BaseClient    文件:EntityPlayer.java   
/**
 * Returns the orientation of the bed in degrees.
 */
public float getBedOrientationInDegrees()
{
    if (this.playerLocation != null)
    {
        EnumFacing enumfacing = (EnumFacing)this.worldObj.getBlockState(this.playerLocation).getValue(BlockDirectional.FACING);

        switch (enumfacing)
        {
            case SOUTH:
                return 90.0F;

            case NORTH:
                return 270.0F;

            case WEST:
                return 0.0F;

            case EAST:
                return 180.0F;
        }
    }

    return 0.0F;
}
项目:Solar    文件:BakedGravityHopper.java   
@Override
protected List<BakedQuad> getQuads(IBlockState state) {
    EnumFacing face = state.getValue(BlockDirectional.FACING);
    List<BakedQuad> quads = new ArrayList<>();
    switch(MinecraftForgeClient.getRenderLayer()) {
        case SOLID:
            //Base
            addCube(quads, face, base, base, base, false);
            break;
        case CUTOUT_MIPPED:
            //Overlay
            addCube(quads, face, overlay[0], overlay[1], overlay[2], true);
            break;
    }
    return quads;
}
项目:4Space-5    文件:BlockMulti.java   
@Override
public int getBedDirection(IBlockAccess world, int x, int y, int z)
{
    TileEntity tileEntity = world.getTileEntity(x, y, z);
    if (tileEntity instanceof TileEntityMulti)
    {
        BlockVec3 mainBlockPosition = ((TileEntityMulti) tileEntity).mainBlockPosition;

     if (mainBlockPosition != null)
     {
         return mainBlockPosition.getBlock(world).getBedDirection(world, mainBlockPosition.x, mainBlockPosition.y, mainBlockPosition.z);
     }
    }

    return BlockDirectional.getDirection(world.getBlockMetadata(x, y, z));
}
项目:RuneCraftery    文件:BlockBed.java   
public static ChunkCoordinates func_72226_b(World p_72226_0_, int p_72226_1_, int p_72226_2_, int p_72226_3_, int p_72226_4_) {
   int var5 = p_72226_0_.func_72805_g(p_72226_1_, p_72226_2_, p_72226_3_);
   int var6 = BlockDirectional.func_72217_d(var5);

   for(int var7 = 0; var7 <= 1; ++var7) {
      int var8 = p_72226_1_ - field_72230_a[var6][0] * var7 - 1;
      int var9 = p_72226_3_ - field_72230_a[var6][1] * var7 - 1;
      int var10 = var8 + 2;
      int var11 = var9 + 2;

      for(int var12 = var8; var12 <= var10; ++var12) {
         for(int var13 = var9; var13 <= var11; ++var13) {
            if(p_72226_0_.func_72797_t(var12, p_72226_2_ - 1, var13) && !p_72226_0_.func_72803_f(var12, p_72226_2_, var13).func_76218_k() && !p_72226_0_.func_72803_f(var12, p_72226_2_ + 1, var13).func_76218_k()) {
               if(p_72226_4_ <= 0) {
                  return new ChunkCoordinates(var12, p_72226_2_, var13);
               }

               --p_72226_4_;
            }
         }
      }
   }

   return null;
}
项目:carpentersblocks    文件:TEBase.java   
/**
 * Will restore cover to default state before returning {@link ItemStack}.
 * <p>
 * Corrects log rotation, among other things.
 *
 * @param  rand a {@link Random} reference
 * @param  itemStack the {@link ItemStack}
 * @return the cover {@link ItemStack} in it's default state
 */
private ItemStack setDefaultMetadata(ItemStack itemStack)
{
    Block block = BlockProperties.toBlock(itemStack);

    // Correct rotation metadata before dropping block
    if (BlockProperties.blockRotates(itemStack) || block instanceof BlockDirectional)
    {
        int dmgDrop = block.damageDropped(itemStack.getItemDamage());
        Item itemDrop = block.getItemDropped(itemStack.getItemDamage(), getWorldObj().rand, /* Fortune */ 0);

        /* Check if block drops itself, and, if so, correct the damage value to the block's default. */

        if (itemDrop != null && itemDrop.equals(itemStack.getItem()) && dmgDrop != itemStack.getItemDamage()) {
            itemStack.setItemDamage(dmgDrop);
        }
    }

    return itemStack;
}
项目:Metalworks    文件:BlockBattery.java   
public BlockBattery(Type batteryType) {
    super(Material.IRON, "battery_" + batteryType.name);
    this.batteryType = batteryType;
    this.setEnergeticItem(batteryType.maxEnergy, batteryType.maxTransfer, batteryType.maxTransfer);
    this.setHarvestLevel("pickaxe", 2);
    this.setHardness(4.5F);
    this.setDefaultState(this.blockState.getBaseState().withProperty(BlockDirectional.FACING, EnumFacing.NORTH).withProperty(STATE, 0));
}
项目:Solar    文件:BakedQimranut.java   
@Override
protected List<BakedQuad> getQuads(IBlockState state) {
    List<BakedQuad> quads = new ArrayList<>();
    EnumFacing facing = state.getValue(BlockDirectional.FACING);
    switch(MinecraftForgeClient.getRenderLayer()) {
        case SOLID:
            //Base
            QuadBuilder base_quads = QuadBuilder.withFormat(format)
                    .setFrom(3, 3, 3)
                    .setTo(13, 4, 13)
                    .addAll(0F, 9F, 7F, 7F, base)
                    .addFace(UP, 0F, 9F, 7F, 16F, base_)
                    .addFace(DOWN, 0F, 9F, 7F, 16F, base)
                    .rotate(facing, DOWN);
            quads.addAll(base_quads.bake());
            break;
        case CUTOUT_MIPPED:
            //Overlay
            QuadBuilder overlay_quads = QuadBuilder.withFormat(format)
                    .setFrom(3, 3, 3)
                    .setTo(13, 4, 13)
                    .addAll(0F, 9F, 15F, 16F, overlay_front)
                    .addFace(DOWN, 0F, 9F, 7F, 16F, overlay_front)
                    .addFace(UP, 0F, 9F, 7F, 16F, overlay_back)
                    .setHasBrightness(true)
                    .rotate(facing, DOWN);
            quads.addAll(overlay_quads.bake());
            break;
    }
    return quads;
}
项目:Solar    文件:BakedBlinker.java   
@Override
protected List<BakedQuad> getQuads(IBlockState state) {
    List<BakedQuad> quads = new ArrayList<>();
    EnumFacing facing = state.getValue(BlockDirectional.FACING);
    switch(MinecraftForgeClient.getRenderLayer()) {
        case SOLID:
            QuadBuilder base_quads = QuadBuilder.withFormat(format)
                    .setFrom(2, 0, 2)
                    .setTo(14, 1, 14)
                    .addAll(2F, 14F, 2F, 2F, base)
                    .addFace(UP, 2F, 14F, 3F, 14F, base)
                    .addFace(DOWN, 2F, 14F, 2F, 14F, base)
                    .rotate(facing, DOWN);
            quads.addAll(base_quads.bake());
            break;
        case CUTOUT_MIPPED:
            boolean on = state.getValue(State.ACTIVE);
            //Overlay
            QuadBuilder overlay_quads = QuadBuilder.withFormat(format)
                    .setFrom(2, 0, 2)
                    .setTo(14, 1, 14)
                    .addAll(2F, 14F, 2F, 2F, on ? top_on : top_off)
                    .addFace(UP, 2F, 14F, 2F, 14F, on ? top_on : top_off)
                    .addFace(DOWN, 2F, 14F, 2F, 14F, on ? bottom_on : bottom_off)
                    .setHasBrightness(true)
                    .rotate(facing, DOWN);
            quads.addAll(overlay_quads.bake());
            break;
    }
    return quads;
}
项目:Solar    文件:BlockMechanicalTranslocator.java   
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    boolean success = state.getValue(BlockDirectional.FACING).getOpposite() == facing && player.getHeldItem(hand).isEmpty();
    if(!world.isRemote && success) {
        getTile(TileMechanicalTranslocator.class, world, pos).ifPresent(tile -> tile.setTransferable(!tile.isTransferable()));
    }
    return success;
}
项目:Solar    文件:BlockMechanicalTranslocator.java   
@Override
public int getMetaFromState(IBlockState state) {
    int i = state.getValue(BlockDirectional.FACING).ordinal();
    if(state.getValue(State.ACTIVE)) {
        i |= 8;
    }
    return i;
}
项目:Solar    文件:BlockBlinker.java   
public BlockBlinker()  {
    super(LibNames.BLINKER, FixedMaterial.BREAK);
    setDefaultState(getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.UP).withProperty(State.ACTIVE, false));
    setHarvestLevel(Tool.PICK, ToolLevel.STONE);
    setHardness(2F);
    setLightLevel(0.2F);
}
项目:Solar    文件:BlockBlinker.java   
@Override
public int getMetaFromState(IBlockState state) {
    int i = state.getValue(BlockDirectional.FACING).ordinal();
    if(state.getValue(State.ACTIVE)) {
        i |= 8;
    }
    return i;
}
项目:Solar    文件:BlockQimranut.java   
public BlockQimranut() {
    super(LibNames.QIMRANUT, FixedMaterial.BREAK);
    setDefaultState(getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.UP));
    setHarvestLevel(Tool.PICK, ToolLevel.STONE);
    setHardness(2F);
    setLightLevel(0.2F);
}
项目:Thermionics    文件:BlockStateBehavior.java   
@Override
public IBlockState getPlacementState(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
    EnumFacing facing = EnumFacing.getDirectionFromEntityLiving(pos, placer);
    /*EnumFacing facing = EnumFacing.UP;
    Vec2f rot = placer.getPitchYaw();

    if (rot.x > 45) {
        facing = EnumFacing.DOWN;
    } else if (rot.x > -45) {
        facing = placer.getAdjustedHorizontalFacing();
    }*/

    return state.withProperty(BlockDirectional.FACING, facing);
}
项目:Thermionics    文件:TileEntityMachine.java   
public EnumFacing getFacing() {
    try {
        return this.world.getBlockState(this.pos).getValue(BlockDirectional.FACING);
    } catch (Throwable t) {
        return EnumFacing.NORTH;
    }
}
项目:4Space-5    文件:BlockTelepadFake.java   
@Override
public int getBedDirection(IBlockAccess world, int x, int y, int z)
{
    TileEntity tileEntity = world.getTileEntity(x, y, z);
    BlockVec3 mainBlockPosition = ((TileEntityTelepadFake) tileEntity).mainBlockPosition;

    if (mainBlockPosition != null)
    {
        return mainBlockPosition.getBlock(world).getBedDirection(world, mainBlockPosition.x, mainBlockPosition.y, mainBlockPosition.z);
    }

    return BlockDirectional.getDirection(world.getBlockMetadata(x, y, z));
}
项目:CrystalMod    文件:BlockCase.java   
@SuppressWarnings("deprecation")
@Override
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn, boolean p_185477_7_)
   {
    //super.addCollisionBoxToList(state, worldIn, pos, entityBox, collidingBoxes, entityIn, p_185477_7_);
       TileEntity tile = worldIn.getTileEntity(pos);

       if (tile != null && tile instanceof TileEntityCasePiston)
       {
        TileEntityCasePiston piston = (TileEntityCasePiston)tile;

        for(EnumFacing enumfacing : piston.validFaces){
            BlockPos pos2 = pos.offset(enumfacing);
            float progress = piston.progress[enumfacing.getIndex()];
            if (progress >= 1.0D)
            {
                IBlockState iblockstate;
                iblockstate = Blocks.PISTON_HEAD.getDefaultState().withProperty(BlockDirectional.FACING, enumfacing).withProperty(BlockPistonExtension.SHORT, Boolean.valueOf(piston.isExtending[enumfacing.getIndex()] != 1.0F - progress < 0.25F));
                float f = piston.getExtendedProgress(progress, enumfacing);
                double d0 = enumfacing.getFrontOffsetX() * f;
                double d1 = enumfacing.getFrontOffsetY() * f;
                double d2 = enumfacing.getFrontOffsetZ() * f;
                iblockstate.addCollisionBoxToList(worldIn, pos2, entityBox.offset(-d0, -d1, -d2), collidingBoxes, entityIn, true);
            }
        }
       } 
       super.addCollisionBoxToList(state, worldIn, pos, entityBox, collidingBoxes, entityIn, p_185477_7_);
   }
项目:TMT-Refraction    文件:TileLaser.java   
@Override
public void update() {
    World world = getWorld();
    if (world.isBlockPowered(pos) || world.isBlockIndirectlyGettingPowered(pos) > 0) return;
    if (!inventory.getStackInSlot(0).isEmpty()) {
        Vec3d center = new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
        EnumFacing face = world.getBlockState(pos).getValue(BlockDirectional.FACING);
        Vec3d vec = PosUtils.getVecFromFacing(face);
        Vec3d facingVec = PosUtils.getVecFromFacing(face).scale(1.0 / 3.0);

        ParticleBuilder glitter = new ParticleBuilder(ThreadLocalRandom.current().nextInt(20, 30));
        glitter.setScale((float) ThreadLocalRandom.current().nextDouble(0.5, 1));
        glitter.setAlpha((float) ThreadLocalRandom.current().nextDouble(0.3, 0.7));
        glitter.setRender(new ResourceLocation(Constants.MOD_ID, "particles/glow"));
        glitter.setAlphaFunction(new InterpFadeInOut(0.1f, 1.0f));
        glitter.setMotion(facingVec.scale(1.0 / 50.0));
        ParticleSpawner.spawn(glitter, world, new StaticInterp<>(center), 2);

        Color color = new Color(255, 255, 255, ConfigValues.GLOWSTONE_ALPHA);
        new Beam(world, center, vec, color).spawn();

        if (tick < ConfigValues.GLOWSTONE_FUEL_EXPIRE_DELAY) tick++;
        else {
            tick = 0;
            inventory.extractItem(0, 1, false);
            markDirty();
        }
    }
}
项目:TMT-Refraction    文件:TileCreativeLaser.java   
@Override
public void update() {
    World world = getWorld();
    if (world.isBlockPowered(pos) || world.isBlockIndirectlyGettingPowered(pos) > 0) return;
    Vec3d center = new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
    EnumFacing face = world.getBlockState(pos).getValue(BlockDirectional.FACING);
    Vec3d vec = PosUtils.getVecFromFacing(face);
    new Beam(world, center, vec, Color.WHITE).spawn();
}
项目:ClockworkPhase2    文件:BlockArmillaryRingFrame.java   
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    BlockPos originalPos = pos;
    IBlockState originalState = state;

    if(checkAndBreakRing(worldIn, pos, state))
        return;

    pos = pos.offset(state.getValue(BlockDirectional.FACING));
    state = worldIn.getBlockState(pos);

    int iterations = 0;
    while(iterations < 30)
    {
        if(state == null || !state.getBlock().equals(ModBlocks.armillaryRingFrame))
        {
            return;
        }

        pos = pos.offset(state.getValue(BlockDirectional.FACING));
        state = worldIn.getBlockState(pos);

        if(checkAndBreakRing(worldIn, pos, state))
            break;

        ++iterations;
    }

    super.breakBlock(worldIn, originalPos, originalState);
}
项目:ClockworkPhase2    文件:BlockArmillaryRingFrame.java   
private boolean checkAndBreakRing(World world, BlockPos pos, IBlockState state)
{
    if(state != null && state.getBlock().equals(this) && state.getValue(BlockDirectional.FACING).equals(EnumFacing.DOWN))
    {
        BlockPos mainRing = pos.north(6);
        TileEntity te = world.getTileEntity(mainRing);
        if(te != null && te instanceof TileArmillaryRing && !((TileArmillaryRing) te).isBeingDestroyed)
        {
            TileArmillaryRing.destroyMultiblock((TileArmillaryRing) te, world, mainRing);
            return true;
        }
    }
    return false;
}
项目:ClockworkPhase2    文件:BlockArmillaryRingFrame.java   
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
    super.onBlockPlacedBy(world, pos, state, placer, stack);
    if(placer.rotationPitch < -65)
        world.setBlockState(pos, state.withProperty(BlockDirectional.FACING, EnumFacing.UP), 2);
    else
        world.setBlockState(pos, state.withProperty(BlockDirectional.FACING, placer.getHorizontalFacing()), 2);
}
项目:ClockworkPhase2    文件:BlockArmillaryRingFrameBottom.java   
private boolean checkAndBreakRing(World world, BlockPos pos, IBlockState state)
{
    if(state != null && state.getBlock().equals(ModBlocks.armillaryRingFrameBottom) && state.getValue(BlockDirectional.FACING).equals(EnumFacing.DOWN))
    {
        BlockPos mainRing = pos.up(6);
        TileEntity te = world.getTileEntity(mainRing);
        if(te != null && te instanceof TileArmillaryRing && !((TileArmillaryRing) te).isBeingDestroyed)
        {
            TileArmillaryRing.destroyMultiblock((TileArmillaryRing) te, world, mainRing);
            return true;
        }
    }
    return false;
}
项目:ClockworkPhase2    文件:BlockArmillaryRingFrameBottom.java   
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
    super.onBlockPlacedBy(world, pos, state, placer, stack);
    if(placer.rotationPitch < -60)
        world.setBlockState(pos, state.withProperty(BlockDirectional.FACING, EnumFacing.UP), 2);
    else if(placer.rotationPitch > 60)
        world.setBlockState(pos, state.withProperty(BlockDirectional.FACING, EnumFacing.DOWN), 2);
    else
        world.setBlockState(pos, state.withProperty(BlockDirectional.FACING, placer.getHorizontalFacing()), 2);
}
项目:ClockworkPhase2    文件:BlockArmillaryRingFrameBottomCorner.java   
private boolean checkAndBreakRing(World world, BlockPos pos, IBlockState state)
{
    if(state != null && state.getBlock().equals(ModBlocks.armillaryRingFrameBottom) && state.getValue(BlockDirectional.FACING).equals(EnumFacing.DOWN))
    {
        BlockPos mainRing = pos.up(6);
        TileEntity te = world.getTileEntity(mainRing);
        if(te != null && te instanceof TileArmillaryRing && !((TileArmillaryRing) te).isBeingDestroyed)
        {
            TileArmillaryRing.destroyMultiblock((TileArmillaryRing) te, world, mainRing);
            return true;
        }
    }
    return false;
}
项目:qcraft-mod    文件:QCraftProxyClient.java   
@Override
public boolean renderWorldBlock( IBlockAccess world, int i, int j, int k, Block block, int modelID, RenderBlocks renderblocks )
{
    if( modelID == QCraft.Blocks.quantumLogic.blockRenderID )
    {
        int metadata = world.getBlockMetadata( i, j, k );
        int direction = BlockDirectional.getDirection( metadata );
        int subType = ( (BlockQuantumLogic) block ).getSubType( metadata );

        // Draw Base
        switch( direction )
        {
            case 0:
                renderblocks.uvRotateTop = 0;
                break;
            case 1:
                renderblocks.uvRotateTop = 1;
                break;
            case 2:
                renderblocks.uvRotateTop = 3;
                break;
            case 3:
                renderblocks.uvRotateTop = 2;
                break;
        }
        renderblocks.setRenderBoundsFromBlock( block );
        renderblocks.renderStandardBlock( block, i, j, k );
        renderblocks.uvRotateTop = 0;

        return true;
    }
    return false;
}
项目:AdventureBackpack2    文件:BlockSleepingBag.java   
public static ChunkCoordinates func_149977_a(World world, int x, int y, int z, int whatever)
{
    int meta = world.getBlockMetadata(x, y, z);
    int dir = BlockDirectional.getDirection(meta);

    for (int k1 = 0; k1 <= 1; ++k1)
    {
        int l1 = x - footBlockToHeadBlockMap[dir][0] * k1 - 1;
        int i2 = z - footBlockToHeadBlockMap[dir][1] * k1 - 1;
        int j2 = l1 + 2;
        int k2 = i2 + 2;

        for (int l2 = l1; l2 <= j2; ++l2)
        {
            for (int i3 = i2; i3 <= k2; ++i3)
            {
                if (World.doesBlockHaveSolidTopSurface(world, l2, y - 1, i3) && !world.getBlock(l2, y, i3).getMaterial().isOpaque() && !world.getBlock(l2, y + 1, i3).getMaterial().isOpaque())
                {
                    if (whatever <= 0)
                    {
                        return new ChunkCoordinates(l2, y, i3);
                    }

                    --whatever;
                }
            }
        }
    }

    return null;
}
项目:Rediscovered-Mod-1.6.4    文件:BlockDreamBed.java   
/**
 * Gets the nearest empty chunk coordinates for the player to wake up from a bed into.
 */
public static ChunkCoordinates getNearestEmptyChunkCoordinates(World par0World, int par1, int par2, int par3, int par4)
{
    int i1 = par0World.getBlockMetadata(par1, par2, par3);
    int j1 = BlockDirectional.getDirection(i1);

    for (int k1 = 0; k1 <= 1; ++k1)
    {
        int l1 = par1 - footBlockToHeadBlockMap[j1][0] * k1 - 1;
        int i2 = par3 - footBlockToHeadBlockMap[j1][1] * k1 - 1;
        int j2 = l1 + 2;
        int k2 = i2 + 2;

        for (int l2 = l1; l2 <= j2; ++l2)
        {
            for (int i3 = i2; i3 <= k2; ++i3)
            {
                if (par0World.doesBlockHaveSolidTopSurface(l2, par2 - 1, i3) && par0World.isAirBlock(l2, par2, i3) && par0World.isAirBlock(l2, par2 + 1, i3))
                {
                    if (par4 <= 0)
                    {
                        return new ChunkCoordinates(l2, par2, i3);
                    }

                    --par4;
                }
            }
        }
    }

    return null;
}
项目:IceAndShadow2    文件:NyxBlockSilkBerryPod.java   
/**
 * Can this block stay at this position. Similar to canPlaceBlockAt except
 * gets checked often with plants.
 */
@Override
public boolean canBlockStay(World par1World, int par2, int par3, int par4) {
    final int l = BlockDirectional.getDirection(par1World.getBlockMetadata(par2, par3, par4));
    par2 += Direction.offsetX[l];
    par4 += Direction.offsetZ[l];
    final Block i1 = par1World.getBlock(par2, par3, par4);
    return i1 == NyxBlocks.infestLog;
}
项目:Metalworks    文件:TileBattery.java   
public EnumFacing getInputSide(){
    return this.world != null ? this.world.getBlockState(this.pos).getValue(BlockDirectional.FACING) : EnumFacing.NORTH;
}
项目:Metalworks    文件:BlockBattery.java   
@Nonnull
@Override
public IBlockState getStateFromMeta(int meta) {
    return this.getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.values()[meta]);
}
项目:Metalworks    文件:BlockBattery.java   
@Override
public int getMetaFromState(IBlockState state) {
    return state.getValue(BlockDirectional.FACING).getIndex();
}
项目:Metalworks    文件:BlockBattery.java   
@Nonnull
@Override
protected BlockStateContainer createBlockState() {
    return new BlockStateContainer(this, BlockDirectional.FACING, STATE);
}
项目:Metalworks    文件:BlockBattery.java   
@Override
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) {
    return super.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, meta, placer, hand).withProperty(BlockDirectional.FACING, EnumFacing.getDirectionFromEntityLiving(pos, placer));
}
项目:Solar    文件:BlockMechanicalTranslocator.java   
public BlockMechanicalTranslocator() {
    super(LibNames.MECHANICAL_TRANSLOCATOR, FixedMaterial.BREAK);
    setDefaultState(getDefaultState().withProperty(BlockDirectional.FACING, EnumFacing.UP).withProperty(State.ACTIVE, false));
    setHarvestLevel(Tool.PICK, ToolLevel.STONE);
    setHardness(2F);
}
项目:Solar    文件:BlockMechanicalTranslocator.java   
@Override
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) {
    return defaultState().withProperty(BlockDirectional.FACING, facing.getOpposite()).withProperty(State.ACTIVE, true);
}
项目:Solar    文件:BlockMechanicalTranslocator.java   
@Override
public IBlockState getStateFromMeta(int meta) {
    EnumFacing enumfacing = EnumFacing.values()[meta & 7];
    return this.getDefaultState().withProperty(BlockDirectional.FACING, enumfacing).withProperty(State.ACTIVE, (meta & 8) > 0);
}