當前位置: 首頁>>代碼示例>>Java>>正文


Java EnumFacing.Axis方法代碼示例

本文整理匯總了Java中net.minecraft.util.EnumFacing.Axis方法的典型用法代碼示例。如果您正苦於以下問題:Java EnumFacing.Axis方法的具體用法?Java EnumFacing.Axis怎麽用?Java EnumFacing.Axis使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.util.EnumFacing的用法示例。


在下文中一共展示了EnumFacing.Axis方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getStateFromMeta

import net.minecraft.util.EnumFacing; //導入方法依賴的package包/類
/**
 * Convert the given metadata into a BlockState for this Block
 */
public IBlockState getStateFromMeta(int meta)
{
    EnumFacing.Axis enumfacing$axis = EnumFacing.Axis.Y;
    int i = meta & 12;

    if (i == 4)
    {
        enumfacing$axis = EnumFacing.Axis.X;
    }
    else if (i == 8)
    {
        enumfacing$axis = EnumFacing.Axis.Z;
    }

    return this.getDefaultState().withProperty(AXIS, enumfacing$axis);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:20,代碼來源:BlockRotatedPillar.java

示例2: getMetaFromState

import net.minecraft.util.EnumFacing; //導入方法依賴的package包/類
/**
 * Convert the BlockState into the correct metadata value
 */
public int getMetaFromState(IBlockState state)
{
    int i = 0;
    EnumFacing.Axis enumfacing$axis = (EnumFacing.Axis)state.getValue(AXIS);

    if (enumfacing$axis == EnumFacing.Axis.X)
    {
        i |= 4;
    }
    else if (enumfacing$axis == EnumFacing.Axis.Z)
    {
        i |= 8;
    }

    return i;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:20,代碼來源:BlockHay.java

示例3: setBlockBoundsBasedOnState

import net.minecraft.util.EnumFacing; //導入方法依賴的package包/類
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
{
    EnumFacing.Axis enumfacing$axis = (EnumFacing.Axis)worldIn.getBlockState(pos).getValue(AXIS);
    float f = 0.125F;
    float f1 = 0.125F;

    if (enumfacing$axis == EnumFacing.Axis.X)
    {
        f = 0.5F;
    }

    if (enumfacing$axis == EnumFacing.Axis.Z)
    {
        f1 = 0.5F;
    }

    this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f1, 0.5F + f, 1.0F, 0.5F + f1);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:19,代碼來源:BlockPortal.java

示例4: parseRotation

import net.minecraft.util.EnumFacing; //導入方法依賴的package包/類
@Nullable
private BlockPartRotation parseRotation(JsonObject object)
{
    BlockPartRotation blockpartrotation = null;

    if (object.has("rotation"))
    {
        JsonObject jsonobject = JsonUtils.getJsonObject(object, "rotation");
        Vector3f vector3f = this.parsePosition(jsonobject, "origin");
        vector3f.scale(0.0625F);
        EnumFacing.Axis enumfacing$axis = this.parseAxis(jsonobject);
        float f = this.parseAngle(jsonobject);
        boolean flag = JsonUtils.getBoolean(jsonobject, "rescale", false);
        blockpartrotation = new BlockPartRotation(vector3f, enumfacing$axis, f, flag);
    }

    return blockpartrotation;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:19,代碼來源:BlockPart.java

示例5: onNeighborBlockChange

import net.minecraft.util.EnumFacing; //導入方法依賴的package包/類
/**
 * Called when a neighboring block changes.
 */
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
{
    EnumFacing.Axis enumfacing$axis = (EnumFacing.Axis)state.getValue(AXIS);

    if (enumfacing$axis == EnumFacing.Axis.X)
    {
        BlockPortal.Size blockportal$size = new BlockPortal.Size(worldIn, pos, EnumFacing.Axis.X);

        if (!blockportal$size.func_150860_b() || blockportal$size.field_150864_e < blockportal$size.field_150868_h * blockportal$size.field_150862_g)
        {
            worldIn.setBlockState(pos, Blocks.air.getDefaultState());
        }
    }
    else if (enumfacing$axis == EnumFacing.Axis.Z)
    {
        BlockPortal.Size blockportal$size1 = new BlockPortal.Size(worldIn, pos, EnumFacing.Axis.Z);

        if (!blockportal$size1.func_150860_b() || blockportal$size1.field_150864_e < blockportal$size1.field_150868_h * blockportal$size1.field_150862_g)
        {
            worldIn.setBlockState(pos, Blocks.air.getDefaultState());
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:27,代碼來源:BlockPortal.java

示例6: getAxisValue

import net.minecraft.util.EnumFacing; //導入方法依賴的package包/類
public static int getAxisValue(EnumFacing.Axis axis, Vector3i vector) {
    switch (axis) {
        case X:
            return vector.getX();
        case Y:
            return vector.getY();
        case Z:
            return vector.getZ();
        default:
            throw new AssertionError("the hell is the " + axis + " axis? I exist in the 3d plane alone!");
    }
}
 
開發者ID:kenzierocks,項目名稱:HardVox,代碼行數:13,代碼來源:VecBridge.java

示例7: onNeighborChangeInternal

import net.minecraft.util.EnumFacing; //導入方法依賴的package包/類
protected boolean onNeighborChangeInternal(World worldIn, BlockPos pos, IBlockState state)
{
    if (!this.checkForDrop(worldIn, pos, state))
    {
        return true;
    }
    else
    {
        EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
        EnumFacing.Axis enumfacing$axis = enumfacing.getAxis();
        EnumFacing enumfacing1 = enumfacing.getOpposite();
        boolean flag = false;

        if (enumfacing$axis.isHorizontal() && !worldIn.isBlockNormalCube(pos.offset(enumfacing1), true))
        {
            flag = true;
        }
        else if (enumfacing$axis.isVertical() && !this.canPlaceOn(worldIn, pos.offset(enumfacing1)))
        {
            flag = true;
        }

        if (flag)
        {
            this.dropBlockAsItem(worldIn, pos, state, 0);
            worldIn.setBlockToAir(pos);
            return true;
        }
        else
        {
            return false;
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:35,代碼來源:BlockTorch.java

示例8: getActualState

import net.minecraft.util.EnumFacing; //導入方法依賴的package包/類
/**
 * Get the actual Block state of this Block at the given position. This applies properties not visible in the
 * metadata, such as fence connections.
 */
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
{
    EnumFacing.Axis enumfacing$axis = ((EnumFacing)state.getValue(FACING)).getAxis();

    if (enumfacing$axis == EnumFacing.Axis.Z && (worldIn.getBlockState(pos.west()).getBlock() == Blocks.cobblestone_wall || worldIn.getBlockState(pos.east()).getBlock() == Blocks.cobblestone_wall) || enumfacing$axis == EnumFacing.Axis.X && (worldIn.getBlockState(pos.north()).getBlock() == Blocks.cobblestone_wall || worldIn.getBlockState(pos.south()).getBlock() == Blocks.cobblestone_wall))
    {
        state = state.withProperty(IN_WALL, Boolean.valueOf(true));
    }

    return state;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:16,代碼來源:BlockFenceGate.java

示例9: setBlockBoundsBasedOnState

import net.minecraft.util.EnumFacing; //導入方法依賴的package包/類
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
{
    EnumFacing.Axis enumfacing$axis = ((EnumFacing)worldIn.getBlockState(pos).getValue(FACING)).getAxis();

    if (enumfacing$axis == EnumFacing.Axis.Z)
    {
        this.setBlockBounds(0.0F, 0.0F, 0.375F, 1.0F, 1.0F, 0.625F);
    }
    else
    {
        this.setBlockBounds(0.375F, 0.0F, 0.0F, 0.625F, 1.0F, 1.0F);
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:14,代碼來源:BlockFenceGate.java

示例10: Size

import net.minecraft.util.EnumFacing; //導入方法依賴的package包/類
public Size(World worldIn, BlockPos p_i45694_2_, EnumFacing.Axis p_i45694_3_)
{
    this.world = worldIn;
    this.axis = p_i45694_3_;

    if (p_i45694_3_ == EnumFacing.Axis.X)
    {
        this.field_150863_d = EnumFacing.EAST;
        this.field_150866_c = EnumFacing.WEST;
    }
    else
    {
        this.field_150863_d = EnumFacing.NORTH;
        this.field_150866_c = EnumFacing.SOUTH;
    }

    for (BlockPos blockpos = p_i45694_2_; p_i45694_2_.getY() > blockpos.getY() - 21 && p_i45694_2_.getY() > 0 && this.func_150857_a(worldIn.getBlockState(p_i45694_2_.down()).getBlock()); p_i45694_2_ = p_i45694_2_.down())
    {
        ;
    }

    int i = this.func_180120_a(p_i45694_2_, this.field_150863_d) - 1;

    if (i >= 0)
    {
        this.field_150861_f = p_i45694_2_.offset(this.field_150863_d, i);
        this.field_150868_h = this.func_180120_a(this.field_150861_f, this.field_150866_c);

        if (this.field_150868_h < 2 || this.field_150868_h > 21)
        {
            this.field_150861_f = null;
            this.field_150868_h = 0;
        }
    }

    if (this.field_150861_f != null)
    {
        this.field_150862_g = this.func_150858_a();
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:41,代碼來源:BlockPortal.java

示例11: shouldSideBeRendered

import net.minecraft.util.EnumFacing; //導入方法依賴的package包/類
public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side)
{
    EnumFacing.Axis enumfacing$axis = null;
    IBlockState iblockstate = worldIn.getBlockState(pos);

    if (worldIn.getBlockState(pos).getBlock() == this)
    {
        enumfacing$axis = (EnumFacing.Axis)iblockstate.getValue(AXIS);

        if (enumfacing$axis == null)
        {
            return false;
        }

        if (enumfacing$axis == EnumFacing.Axis.Z && side != EnumFacing.EAST && side != EnumFacing.WEST)
        {
            return false;
        }

        if (enumfacing$axis == EnumFacing.Axis.X && side != EnumFacing.SOUTH && side != EnumFacing.NORTH)
        {
            return false;
        }
    }

    boolean flag = worldIn.getBlockState(pos.west()).getBlock() == this && worldIn.getBlockState(pos.west(2)).getBlock() != this;
    boolean flag1 = worldIn.getBlockState(pos.east()).getBlock() == this && worldIn.getBlockState(pos.east(2)).getBlock() != this;
    boolean flag2 = worldIn.getBlockState(pos.north()).getBlock() == this && worldIn.getBlockState(pos.north(2)).getBlock() != this;
    boolean flag3 = worldIn.getBlockState(pos.south()).getBlock() == this && worldIn.getBlockState(pos.south(2)).getBlock() != this;
    boolean flag4 = flag || flag1 || enumfacing$axis == EnumFacing.Axis.X;
    boolean flag5 = flag2 || flag3 || enumfacing$axis == EnumFacing.Axis.Z;
    return flag4 && side == EnumFacing.WEST ? true : (flag4 && side == EnumFacing.EAST ? true : (flag5 && side == EnumFacing.NORTH ? true : flag5 && side == EnumFacing.SOUTH));
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:34,代碼來源:BlockPortal.java

示例12: getMetaForAxis

import net.minecraft.util.EnumFacing; //導入方法依賴的package包/類
public static int getMetaForAxis(EnumFacing.Axis axis)
{
    return axis == EnumFacing.Axis.X ? 1 : (axis == EnumFacing.Axis.Z ? 2 : 0);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:5,代碼來源:BlockPortal.java

示例13: func_181089_f

import net.minecraft.util.EnumFacing; //導入方法依賴的package包/類
public BlockPattern.PatternHelper func_181089_f(World p_181089_1_, BlockPos p_181089_2_)
{
    EnumFacing.Axis enumfacing$axis = EnumFacing.Axis.Z;
    BlockPortal.Size blockportal$size = new BlockPortal.Size(p_181089_1_, p_181089_2_, EnumFacing.Axis.X);
    LoadingCache<BlockPos, BlockWorldState> loadingcache = BlockPattern.func_181627_a(p_181089_1_, true);

    if (!blockportal$size.func_150860_b())
    {
        enumfacing$axis = EnumFacing.Axis.X;
        blockportal$size = new BlockPortal.Size(p_181089_1_, p_181089_2_, EnumFacing.Axis.Z);
    }

    if (!blockportal$size.func_150860_b())
    {
        return new BlockPattern.PatternHelper(p_181089_2_, EnumFacing.NORTH, EnumFacing.UP, loadingcache, 1, 1, 1);
    }
    else
    {
        int[] aint = new int[EnumFacing.AxisDirection.values().length];
        EnumFacing enumfacing = blockportal$size.field_150866_c.rotateYCCW();
        BlockPos blockpos = blockportal$size.field_150861_f.up(blockportal$size.func_181100_a() - 1);

        for (EnumFacing.AxisDirection enumfacing$axisdirection : EnumFacing.AxisDirection.values())
        {
            BlockPattern.PatternHelper blockpattern$patternhelper = new BlockPattern.PatternHelper(enumfacing.getAxisDirection() == enumfacing$axisdirection ? blockpos : blockpos.offset(blockportal$size.field_150866_c, blockportal$size.func_181101_b() - 1), EnumFacing.func_181076_a(enumfacing$axisdirection, enumfacing$axis), EnumFacing.UP, loadingcache, blockportal$size.func_181101_b(), blockportal$size.func_181100_a(), 1);

            for (int i = 0; i < blockportal$size.func_181101_b(); ++i)
            {
                for (int j = 0; j < blockportal$size.func_181100_a(); ++j)
                {
                    BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(i, j, 1);

                    if (blockworldstate.getBlockState() != null && blockworldstate.getBlockState().getBlock().getMaterial() != Material.air)
                    {
                        ++aint[enumfacing$axisdirection.ordinal()];
                    }
                }
            }
        }

        EnumFacing.AxisDirection enumfacing$axisdirection1 = EnumFacing.AxisDirection.POSITIVE;

        for (EnumFacing.AxisDirection enumfacing$axisdirection2 : EnumFacing.AxisDirection.values())
        {
            if (aint[enumfacing$axisdirection2.ordinal()] < aint[enumfacing$axisdirection1.ordinal()])
            {
                enumfacing$axisdirection1 = enumfacing$axisdirection2;
            }
        }

        return new BlockPattern.PatternHelper(enumfacing.getAxisDirection() == enumfacing$axisdirection1 ? blockpos : blockpos.offset(blockportal$size.field_150866_c, blockportal$size.func_181101_b() - 1), EnumFacing.func_181076_a(enumfacing$axisdirection1, enumfacing$axis), EnumFacing.UP, loadingcache, blockportal$size.func_181101_b(), blockportal$size.func_181100_a(), 1);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:54,代碼來源:BlockPortal.java


注:本文中的net.minecraft.util.EnumFacing.Axis方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。