当前位置: 首页>>代码示例>>Java>>正文


Java EnumFacing.getFrontOffsetX方法代码示例

本文整理汇总了Java中net.minecraft.util.EnumFacing.getFrontOffsetX方法的典型用法代码示例。如果您正苦于以下问题:Java EnumFacing.getFrontOffsetX方法的具体用法?Java EnumFacing.getFrontOffsetX怎么用?Java EnumFacing.getFrontOffsetX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.util.EnumFacing的用法示例。


在下文中一共展示了EnumFacing.getFrontOffsetX方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getBoundingBox

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
    if (!source.getBlockState(pos).getPropertyKeys().contains(ROTATION)) {
        // getBoundingBox() can be called during placement (from World#mayPlace), before the
        // block is actually placed; handle this, or we'll crash with an IllegalArgumentException
        return FULL_BLOCK_AABB;
    }

    EnumFacing dir = getRotation(source, pos);
    return new AxisAlignedBB(
            dir.getFrontOffsetX() <= 0 ? 0 : 1F - BBConstants.HEAT_SINK_THICKNESS,
            dir.getFrontOffsetY() <= 0 ? 0 : 1F - BBConstants.HEAT_SINK_THICKNESS,
            dir.getFrontOffsetZ() <= 0 ? 0 : 1F - BBConstants.HEAT_SINK_THICKNESS,
            dir.getFrontOffsetX() >= 0 ? 1 : BBConstants.HEAT_SINK_THICKNESS,
            dir.getFrontOffsetY() >= 0 ? 1 : BBConstants.HEAT_SINK_THICKNESS,
            dir.getFrontOffsetZ() >= 0 ? 1 : BBConstants.HEAT_SINK_THICKNESS
    );
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:19,代码来源:BlockHeatSink.java

示例2: randomDisplayTick

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
{
    if (this.isOn)
    {
        double d0 = (double)pos.getX() + 0.5D + (rand.nextDouble() - 0.5D) * 0.2D;
        double d1 = (double)pos.getY() + 0.7D + (rand.nextDouble() - 0.5D) * 0.2D;
        double d2 = (double)pos.getZ() + 0.5D + (rand.nextDouble() - 0.5D) * 0.2D;
        EnumFacing enumfacing = (EnumFacing)stateIn.getValue(FACING);

        if (enumfacing.getAxis().isHorizontal())
        {
            EnumFacing enumfacing1 = enumfacing.getOpposite();
            double d3 = 0.27D;
            d0 += 0.27D * (double)enumfacing1.getFrontOffsetX();
            d1 += 0.22D;
            d2 += 0.27D * (double)enumfacing1.getFrontOffsetZ();
        }

        worldIn.spawnParticle(EnumParticleTypes.REDSTONE, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:23,代码来源:BlockRedstoneTorch.java

示例3: getBoundingBox

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
    EnumFacing dir = state.getValue(ROTATION);
    return new AxisAlignedBB(
            dir.getFrontOffsetX() <= 0 ? 0 : 1F - BBConstants.APHORISM_TILE_THICKNESS,
            dir.getFrontOffsetY() <= 0 ? 0 : 1F - BBConstants.APHORISM_TILE_THICKNESS,
            dir.getFrontOffsetZ() <= 0 ? 0 : 1F - BBConstants.APHORISM_TILE_THICKNESS,
            dir.getFrontOffsetX() >= 0 ? 1 : BBConstants.APHORISM_TILE_THICKNESS,
            dir.getFrontOffsetY() >= 0 ? 1 : BBConstants.APHORISM_TILE_THICKNESS,
            dir.getFrontOffsetZ() >= 0 ? 1 : BBConstants.APHORISM_TILE_THICKNESS);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:12,代码来源:BlockAphorismTile.java

示例4: updateBoundingBox

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
/**
 * Updates the entity bounding box based on current facing
 */
private void updateBoundingBox()
{
    if (this.facingDirection != null)
    {
        double d0 = (double)this.hangingPosition.getX() + 0.5D;
        double d1 = (double)this.hangingPosition.getY() + 0.5D;
        double d2 = (double)this.hangingPosition.getZ() + 0.5D;
        double d3 = 0.46875D;
        double d4 = this.func_174858_a(this.getWidthPixels());
        double d5 = this.func_174858_a(this.getHeightPixels());
        d0 = d0 - (double)this.facingDirection.getFrontOffsetX() * 0.46875D;
        d2 = d2 - (double)this.facingDirection.getFrontOffsetZ() * 0.46875D;
        d1 = d1 + d5;
        EnumFacing enumfacing = this.facingDirection.rotateYCCW();
        d0 = d0 + d4 * (double)enumfacing.getFrontOffsetX();
        d2 = d2 + d4 * (double)enumfacing.getFrontOffsetZ();
        this.posX = d0;
        this.posY = d1;
        this.posZ = d2;
        double d6 = (double)this.getWidthPixels();
        double d7 = (double)this.getHeightPixels();
        double d8 = (double)this.getWidthPixels();

        if (this.facingDirection.getAxis() == EnumFacing.Axis.Z)
        {
            d8 = 1.0D;
        }
        else
        {
            d6 = 1.0D;
        }

        d6 = d6 / 32.0D;
        d7 = d7 / 32.0D;
        d8 = d8 / 32.0D;
        this.setEntityBoundingBox(new AxisAlignedBB(d0 - d6, d1 - d7, d2 - d8, d0 + d6, d1 + d7, d2 + d8));
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:42,代码来源:EntityHanging.java

示例5: getSafeExitLocation

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
@Nullable

    /**
     * Returns a safe BlockPos to disembark the bed
     */
    public static BlockPos getSafeExitLocation(World worldIn, BlockPos pos, int tries)
    {
        EnumFacing enumfacing = (EnumFacing)worldIn.getBlockState(pos).getValue(FACING);
        int i = pos.getX();
        int j = pos.getY();
        int k = pos.getZ();

        for (int l = 0; l <= 1; ++l)
        {
            int i1 = i - enumfacing.getFrontOffsetX() * l - 1;
            int j1 = k - enumfacing.getFrontOffsetZ() * l - 1;
            int k1 = i1 + 2;
            int l1 = j1 + 2;

            for (int i2 = i1; i2 <= k1; ++i2)
            {
                for (int j2 = j1; j2 <= l1; ++j2)
                {
                    BlockPos blockpos = new BlockPos(i2, j, j2);

                    if (hasRoomForPlayer(worldIn, blockpos))
                    {
                        if (tries <= 0)
                        {
                            return blockpos;
                        }

                        --tries;
                    }
                }
            }
        }

        return null;
    }
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:41,代码来源:BlockBed.java

示例6: setBlockBoundsBasedOnState

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
{
    TileEntityPiston tileentitypiston = this.getTileEntity(worldIn, pos);

    if (tileentitypiston != null)
    {
        IBlockState iblockstate = tileentitypiston.getPistonState();
        Block block = iblockstate.getBlock();

        if (block == this || block.getMaterial() == Material.air)
        {
            return;
        }

        float f = tileentitypiston.getProgress(0.0F);

        if (tileentitypiston.isExtending())
        {
            f = 1.0F - f;
        }

        block.setBlockBoundsBasedOnState(worldIn, pos);

        if (block == Blocks.piston || block == Blocks.sticky_piston)
        {
            f = 0.0F;
        }

        EnumFacing enumfacing = tileentitypiston.getFacing();
        this.minX = block.getBlockBoundsMinX() - (double)((float)enumfacing.getFrontOffsetX() * f);
        this.minY = block.getBlockBoundsMinY() - (double)((float)enumfacing.getFrontOffsetY() * f);
        this.minZ = block.getBlockBoundsMinZ() - (double)((float)enumfacing.getFrontOffsetZ() * f);
        this.maxX = block.getBlockBoundsMaxX() - (double)((float)enumfacing.getFrontOffsetX() * f);
        this.maxY = block.getBlockBoundsMaxY() - (double)((float)enumfacing.getFrontOffsetY() * f);
        this.maxZ = block.getBlockBoundsMaxZ() - (double)((float)enumfacing.getFrontOffsetZ() * f);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:38,代码来源:BlockPistonMoving.java

示例7: getDispensePosition

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
/**
 * Get the position where the dispenser at the given Coordinates should dispense to.
 */
public static IPosition getDispensePosition(IBlockSource coords)
{
    EnumFacing enumfacing = getFacing(coords.getBlockMetadata());
    double d0 = coords.getX() + 0.7D * (double)enumfacing.getFrontOffsetX();
    double d1 = coords.getY() + 0.7D * (double)enumfacing.getFrontOffsetY();
    double d2 = coords.getZ() + 0.7D * (double)enumfacing.getFrontOffsetZ();
    return new PositionImpl(d0, d1, d2);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:12,代码来源:BlockDispenser.java

示例8: updateBoundingBox

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
/**
 * Updates the entity bounding box based on current facing
 */
protected void updateBoundingBox()
{
    if (this.facingDirection != null)
    {
        double d0 = (double)this.hangingPosition.getX() + 0.5D;
        double d1 = (double)this.hangingPosition.getY() + 0.5D;
        double d2 = (double)this.hangingPosition.getZ() + 0.5D;
        double d3 = 0.46875D;
        double d4 = this.offs(this.getWidthPixels());
        double d5 = this.offs(this.getHeightPixels());
        d0 = d0 - (double)this.facingDirection.getFrontOffsetX() * 0.46875D;
        d2 = d2 - (double)this.facingDirection.getFrontOffsetZ() * 0.46875D;
        d1 = d1 + d5;
        EnumFacing enumfacing = this.facingDirection.rotateYCCW();
        d0 = d0 + d4 * (double)enumfacing.getFrontOffsetX();
        d2 = d2 + d4 * (double)enumfacing.getFrontOffsetZ();
        this.posX = d0;
        this.posY = d1;
        this.posZ = d2;
        double d6 = (double)this.getWidthPixels();
        double d7 = (double)this.getHeightPixels();
        double d8 = (double)this.getWidthPixels();

        if (this.facingDirection.getAxis() == EnumFacing.Axis.Z)
        {
            d8 = 1.0D;
        }
        else
        {
            d6 = 1.0D;
        }

        d6 = d6 / 32.0D;
        d7 = d7 / 32.0D;
        d8 = d8 / 32.0D;
        this.setEntityBoundingBox(new AxisAlignedBB(d0 - d6, d1 - d7, d2 - d8, d0 + d6, d1 + d7, d2 + d8));
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:42,代码来源:EntityHanging.java

示例9: translateOffset

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
/**
 * Offsets the position of pos in the direction of finger and thumb facing by offset amounts, follows the right-hand
 * rule for cross products (finger, thumb, palm) @return A new BlockPos offset in the facing directions
 */
protected static BlockPos translateOffset(BlockPos pos, EnumFacing finger, EnumFacing thumb, int palmOffset, int thumbOffset, int fingerOffset)
{
    if (finger != thumb && finger != thumb.getOpposite())
    {
        Vec3i vec3i = new Vec3i(finger.getFrontOffsetX(), finger.getFrontOffsetY(), finger.getFrontOffsetZ());
        Vec3i vec3i1 = new Vec3i(thumb.getFrontOffsetX(), thumb.getFrontOffsetY(), thumb.getFrontOffsetZ());
        Vec3i vec3i2 = vec3i.crossProduct(vec3i1);
        return pos.add(vec3i1.getX() * -thumbOffset + vec3i2.getX() * palmOffset + vec3i.getX() * fingerOffset, vec3i1.getY() * -thumbOffset + vec3i2.getY() * palmOffset + vec3i.getY() * fingerOffset, vec3i1.getZ() * -thumbOffset + vec3i2.getZ() * palmOffset + vec3i.getZ() * fingerOffset);
    }
    else
    {
        throw new IllegalArgumentException("Invalid forwards & up combination");
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:19,代码来源:BlockPattern.java

示例10: dispenseStack

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
    EnumFacing enumfacing = (EnumFacing)source.getBlockState().getValue(BlockDispenser.FACING);
    World world = source.getWorld();
    double d0 = source.getX() + (double)((float)enumfacing.getFrontOffsetX() * 1.125F);
    double d1 = source.getY() + (double)((float)enumfacing.getFrontOffsetY() * 1.125F);
    double d2 = source.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 1.125F);
    BlockPos blockpos = source.getBlockPos().offset(enumfacing);
    Material material = world.getBlockState(blockpos).getMaterial();
    double d3;

    if (Material.WATER.equals(material))
    {
        d3 = 1.0D;
    }
    else
    {
        if (!Material.AIR.equals(material) || !Material.WATER.equals(world.getBlockState(blockpos.down()).getMaterial()))
        {
            return this.dispenseBehavior.dispense(source, stack);
        }

        d3 = 0.0D;
    }

    EntityBoat entityboat = new EntityBoat(world, d0, d1 + d3, d2);
    entityboat.setBoatType(this.boatType);
    entityboat.rotationYaw = enumfacing.getHorizontalAngle();
    world.spawnEntityInWorld(entityboat);
    stack.func_190918_g(1);
    return stack;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:33,代码来源:Bootstrap.java

示例11: getSafeExitLocation

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
/**
 * Returns a safe BlockPos to disembark the bed
 */
@Nullable
public static BlockPos getSafeExitLocation(World worldIn, BlockPos pos, int tries)
{
    EnumFacing enumfacing = (EnumFacing)worldIn.getBlockState(pos).getValue(FACING);
    int i = pos.getX();
    int j = pos.getY();
    int k = pos.getZ();

    for (int l = 0; l <= 1; ++l)
    {
        int i1 = i - enumfacing.getFrontOffsetX() * l - 1;
        int j1 = k - enumfacing.getFrontOffsetZ() * l - 1;
        int k1 = i1 + 2;
        int l1 = j1 + 2;

        for (int i2 = i1; i2 <= k1; ++i2)
        {
            for (int j2 = j1; j2 <= l1; ++j2)
            {
                BlockPos blockpos = new BlockPos(i2, j, j2);

                if (hasRoomForPlayer(worldIn, blockpos))
                {
                    if (tries <= 0)
                    {
                        return blockpos;
                    }

                    --tries;
                }
            }
        }
    }

    return null;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:40,代码来源:BlockBed.java

示例12: getSafeExitLocation

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
/**
 * Returns a safe BlockPos to disembark the bed
 */
public static BlockPos getSafeExitLocation(World worldIn, BlockPos pos, int tries)
{
    EnumFacing enumfacing = (EnumFacing)worldIn.getBlockState(pos).getValue(FACING);
    int i = pos.getX();
    int j = pos.getY();
    int k = pos.getZ();

    for (int l = 0; l <= 1; ++l)
    {
        int i1 = i - enumfacing.getFrontOffsetX() * l - 1;
        int j1 = k - enumfacing.getFrontOffsetZ() * l - 1;
        int k1 = i1 + 2;
        int l1 = j1 + 2;

        for (int i2 = i1; i2 <= k1; ++i2)
        {
            for (int j2 = j1; j2 <= l1; ++j2)
            {
                BlockPos blockpos = new BlockPos(i2, j, j2);

                if (hasRoomForPlayer(worldIn, blockpos))
                {
                    if (tries <= 0)
                    {
                        return blockpos;
                    }

                    --tries;
                }
            }
        }
    }

    return null;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:39,代码来源:BlockBed.java

示例13: getFlow

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
protected Vec3d getFlow(IBlockAccess p_189543_1_, BlockPos p_189543_2_, IBlockState p_189543_3_)
{
    double d0 = 0.0D;
    double d1 = 0.0D;
    double d2 = 0.0D;
    int i = this.getRenderedDepth(p_189543_3_);
    BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();

    for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
    {
        blockpos$pooledmutableblockpos.setPos(p_189543_2_).move(enumfacing);
        int j = this.getRenderedDepth(p_189543_1_.getBlockState(blockpos$pooledmutableblockpos));

        if (j < 0)
        {
            if (!p_189543_1_.getBlockState(blockpos$pooledmutableblockpos).getMaterial().blocksMovement())
            {
                j = this.getRenderedDepth(p_189543_1_.getBlockState(blockpos$pooledmutableblockpos.down()));

                if (j >= 0)
                {
                    int k = j - (i - 8);
                    if(!Hacks.findMod(AntiVelocity.class).isEnabled()) {
                    	d0 += (double)(enumfacing.getFrontOffsetX() * k);
                    	d1 += (double)(enumfacing.getFrontOffsetY() * k);
                    	d2 += (double)(enumfacing.getFrontOffsetZ() * k);
                    }
                }
            }
        }
        else if (j >= 0)
        {
            int l = j - i;
            if(!Hacks.findMod(AntiVelocity.class).isEnabled()) {
             d0 += (double)(enumfacing.getFrontOffsetX() * l);
             d1 += (double)(enumfacing.getFrontOffsetY() * l);
             d2 += (double)(enumfacing.getFrontOffsetZ() * l);
            }
        }
    }

    Vec3d vec3d = new Vec3d(d0, d1, d2);

    if (((Integer)p_189543_3_.getValue(LEVEL)).intValue() >= 8)
    {
        for (EnumFacing enumfacing1 : EnumFacing.Plane.HORIZONTAL)
        {
            blockpos$pooledmutableblockpos.setPos(p_189543_2_).move(enumfacing1);

            if (this.isBlockSolid(p_189543_1_, blockpos$pooledmutableblockpos, enumfacing1) || this.isBlockSolid(p_189543_1_, blockpos$pooledmutableblockpos.up(), enumfacing1))
            {
                vec3d = vec3d.normalize().addVector(0.0D, -6.0D, 0.0D);
                break;
            }
        }
    }

    blockpos$pooledmutableblockpos.release();
    return vec3d.normalize();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:61,代码来源:BlockLiquid.java

示例14: getFlow

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
protected Vec3d getFlow(IBlockAccess p_189543_1_, BlockPos p_189543_2_, IBlockState p_189543_3_)
{
    double d0 = 0.0D;
    double d1 = 0.0D;
    double d2 = 0.0D;
    int i = this.getRenderedDepth(p_189543_3_);
    BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();

    for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
    {
        blockpos$pooledmutableblockpos.setPos(p_189543_2_).move(enumfacing);
        int j = this.getRenderedDepth(p_189543_1_.getBlockState(blockpos$pooledmutableblockpos));

        if (j < 0)
        {
            if (!p_189543_1_.getBlockState(blockpos$pooledmutableblockpos).getMaterial().blocksMovement())
            {
                j = this.getRenderedDepth(p_189543_1_.getBlockState(blockpos$pooledmutableblockpos.down()));

                if (j >= 0)
                {
                    int k = j - (i - 8);
                    d0 += (double)(enumfacing.getFrontOffsetX() * k);
                    d1 += (double)(enumfacing.getFrontOffsetY() * k);
                    d2 += (double)(enumfacing.getFrontOffsetZ() * k);
                }
            }
        }
        else if (j >= 0)
        {
            int l = j - i;
            d0 += (double)(enumfacing.getFrontOffsetX() * l);
            d1 += (double)(enumfacing.getFrontOffsetY() * l);
            d2 += (double)(enumfacing.getFrontOffsetZ() * l);
        }
    }

    Vec3d vec3d = new Vec3d(d0, d1, d2);

    if (((Integer)p_189543_3_.getValue(LEVEL)).intValue() >= 8)
    {
        for (EnumFacing enumfacing1 : EnumFacing.Plane.HORIZONTAL)
        {
            blockpos$pooledmutableblockpos.setPos(p_189543_2_).move(enumfacing1);

            if (this.isBlockSolid(p_189543_1_, blockpos$pooledmutableblockpos, enumfacing1) || this.isBlockSolid(p_189543_1_, blockpos$pooledmutableblockpos.up(), enumfacing1))
            {
                vec3d = vec3d.normalize().addVector(0.0D, -6.0D, 0.0D);
                break;
            }
        }
    }

    blockpos$pooledmutableblockpos.release();
    return vec3d.normalize();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:57,代码来源:BlockLiquid.java

示例15: getWorldEventDataFrom

import net.minecraft.util.EnumFacing; //导入方法依赖的package包/类
private int getWorldEventDataFrom(EnumFacing facingIn)
{
    return facingIn.getFrontOffsetX() + 1 + (facingIn.getFrontOffsetZ() + 1) * 3;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:BehaviorDefaultDispenseItem.java


注:本文中的net.minecraft.util.EnumFacing.getFrontOffsetX方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。