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


Java BlockPos.getZ方法代碼示例

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


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

示例1: findPossibleShelter

import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
private Vec3 findPossibleShelter()
{
    Random random = this.theCreature.getRNG();
    BlockPos blockpos = new BlockPos(this.theCreature.posX, this.theCreature.getEntityBoundingBox().minY, this.theCreature.posZ);

    for (int i = 0; i < 10; ++i)
    {
        BlockPos blockpos1 = blockpos.add(random.nextInt(20) - 10, random.nextInt(6) - 3, random.nextInt(20) - 10);

        if (!this.theWorld.canSeeSky(blockpos1) && this.theCreature.getBlockPathWeight(blockpos1) < 0.0F)
        {
            return new Vec3((double)blockpos1.getX(), (double)blockpos1.getY(), (double)blockpos1.getZ());
        }
    }

    return null;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:18,代碼來源:EntityAIFleeSun.java

示例2: randomDisplayTick

import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, 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)state.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:SkidJava,項目名稱:BaseClient,代碼行數:22,代碼來源:BlockRedstoneTorch.java

示例3: attachToFence

import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public static boolean attachToFence(EntityPlayer player, World worldIn, BlockPos fence)
{
    EntityLeashKnot entityleashknot = EntityLeashKnot.getKnotForPosition(worldIn, fence);
    boolean flag = false;
    double d0 = 7.0D;
    int i = fence.getX();
    int j = fence.getY();
    int k = fence.getZ();

    for (EntityLiving entityliving : worldIn.getEntitiesWithinAABB(EntityLiving.class, new AxisAlignedBB((double)i - d0, (double)j - d0, (double)k - d0, (double)i + d0, (double)j + d0, (double)k + d0)))
    {
        if (entityliving.getLeashed() && entityliving.getLeashedToEntity() == player)
        {
            if (entityleashknot == null)
            {
                entityleashknot = EntityLeashKnot.createKnot(worldIn, fence);
            }

            entityliving.setLeashedToEntity(entityleashknot, true);
            flag = true;
        }
    }

    return flag;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:26,代碼來源:ItemLead.java

示例4: generate

import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public boolean generate(World worldIn, Random rand, BlockPos position)
{
    for (int i = 0; i < 10; ++i)
    {
        int j = position.getX() + rand.nextInt(8) - rand.nextInt(8);
        int k = position.getY() + rand.nextInt(4) - rand.nextInt(4);
        int l = position.getZ() + rand.nextInt(8) - rand.nextInt(8);

        if (worldIn.isAirBlock(new BlockPos(j, k, l)) && Blocks.waterlily.canPlaceBlockAt(worldIn, new BlockPos(j, k, l)))
        {
            worldIn.setBlockState(new BlockPos(j, k, l), Blocks.waterlily.getDefaultState(), 2);
        }
    }

    return true;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:17,代碼來源:WorldGenWaterlily.java

示例5: generate

import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public boolean generate(World worldIn, Random rand, BlockPos position)
{
    if (worldIn.getBlockState(position).getBlock().getMaterial() != Material.water)
    {
        return false;
    }
    else
    {
        int i = rand.nextInt(this.numberOfBlocks - 2) + 2;
        int j = 1;

        for (int k = position.getX() - i; k <= position.getX() + i; ++k)
        {
            for (int l = position.getZ() - i; l <= position.getZ() + i; ++l)
            {
                int i1 = k - position.getX();
                int j1 = l - position.getZ();

                if (i1 * i1 + j1 * j1 <= i * i)
                {
                    for (int k1 = position.getY() - j; k1 <= position.getY() + j; ++k1)
                    {
                        BlockPos blockpos = new BlockPos(k, k1, l);
                        Block block = worldIn.getBlockState(blockpos).getBlock();

                        if (block == Blocks.dirt || block == Blocks.clay)
                        {
                            worldIn.setBlockState(blockpos, this.field_150546_a.getDefaultState(), 2);
                        }
                    }
                }
            }
        }

        return true;
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:38,代碼來源:WorldGenClay.java

示例6: getSubSet

import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
private Set getSubSet(NextTickListEntry p_getSubSet_1_, boolean p_getSubSet_2_)
{
    if (p_getSubSet_1_ == null)
    {
        return null;
    }
    else
    {
        BlockPos blockpos = p_getSubSet_1_.position;
        int i = blockpos.getX() >> 4;
        int j = blockpos.getZ() >> 4;
        return this.getSubSet(i, j, p_getSubSet_2_);
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:15,代碼來源:NextTickHashSet.java

示例7: canSeeSky

import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public boolean canSeeSky(BlockPos pos)
{
    int i = pos.getX() & 15;
    int j = pos.getY();
    int k = pos.getZ() & 15;
    return j >= this.heightMap[k << 4 | i];
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:8,代碼來源:Chunk.java

示例8: func_181638_a

import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
private boolean func_181638_a(World p_181638_1_, BlockPos p_181638_2_, int p_181638_3_)
{
    int i = p_181638_2_.getX();
    int j = p_181638_2_.getY();
    int k = p_181638_2_.getZ();
    BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();

    for (int l = 0; l <= p_181638_3_ + 1; ++l)
    {
        int i1 = 1;

        if (l == 0)
        {
            i1 = 0;
        }

        if (l >= p_181638_3_ - 1)
        {
            i1 = 2;
        }

        for (int j1 = -i1; j1 <= i1; ++j1)
        {
            for (int k1 = -i1; k1 <= i1; ++k1)
            {
                if (!this.func_150523_a(p_181638_1_.getBlockState(blockpos$mutableblockpos.func_181079_c(i + j1, j + l, k + k1)).getBlock()))
                {
                    return false;
                }
            }
        }
    }

    return true;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:36,代碼來源:WorldGenCanopyTree.java

示例9: getSafeExitLocation

import net.minecraft.util.BlockPos; //導入方法依賴的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:SkidJava,項目名稱:BaseClient,代碼行數:39,代碼來源:BlockBed.java

示例10: func_179661_a

import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
private static AxisAlignedBB func_179661_a(BlockPos p_179661_0_, int p_179661_1_, int p_179661_2_, int p_179661_3_)
{
    boolean flag = p_179661_1_ < 0;
    boolean flag1 = p_179661_2_ < 0;
    boolean flag2 = p_179661_3_ < 0;
    int i = p_179661_0_.getX() + (flag ? p_179661_1_ : 0);
    int j = p_179661_0_.getY() + (flag1 ? p_179661_2_ : 0);
    int k = p_179661_0_.getZ() + (flag2 ? p_179661_3_ : 0);
    int l = p_179661_0_.getX() + (flag ? 0 : p_179661_1_) + 1;
    int i1 = p_179661_0_.getY() + (flag1 ? 0 : p_179661_2_) + 1;
    int j1 = p_179661_0_.getZ() + (flag2 ? 0 : p_179661_3_) + 1;
    return new AxisAlignedBB((double)i, (double)j, (double)k, (double)l, (double)i1, (double)j1);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:14,代碼來源:PlayerSelector.java

示例11: getCollisionBoundingBox

import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
{
    if (((Boolean)state.getValue(OPEN)).booleanValue())
    {
        return null;
    }
    else
    {
        EnumFacing.Axis enumfacing$axis = ((EnumFacing)state.getValue(FACING)).getAxis();
        return enumfacing$axis == EnumFacing.Axis.Z ? new AxisAlignedBB((double)pos.getX(), (double)pos.getY(), (double)((float)pos.getZ() + 0.375F), (double)(pos.getX() + 1), (double)((float)pos.getY() + 1.5F), (double)((float)pos.getZ() + 0.625F)) : new AxisAlignedBB((double)((float)pos.getX() + 0.375F), (double)pos.getY(), (double)pos.getZ(), (double)((float)pos.getX() + 0.625F), (double)((float)pos.getY() + 1.5F), (double)(pos.getZ() + 1));
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:13,代碼來源:BlockFenceGate.java

示例12: pushOutOfBlocks

import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
protected boolean pushOutOfBlocks(double x, double y, double z)
{
    BlockPos blockpos = new BlockPos(x, y, z);
    double d0 = x - (double)blockpos.getX();
    double d1 = y - (double)blockpos.getY();
    double d2 = z - (double)blockpos.getZ();
    List<AxisAlignedBB> list = this.worldObj.func_147461_a(this.getEntityBoundingBox());

    if (list.isEmpty() && !this.worldObj.isBlockFullCube(blockpos))
    {
        return false;
    }
    else
    {
        int i = 3;
        double d3 = 9999.0D;

        if (!this.worldObj.isBlockFullCube(blockpos.west()) && d0 < d3)
        {
            d3 = d0;
            i = 0;
        }

        if (!this.worldObj.isBlockFullCube(blockpos.east()) && 1.0D - d0 < d3)
        {
            d3 = 1.0D - d0;
            i = 1;
        }

        if (!this.worldObj.isBlockFullCube(blockpos.up()) && 1.0D - d1 < d3)
        {
            d3 = 1.0D - d1;
            i = 3;
        }

        if (!this.worldObj.isBlockFullCube(blockpos.north()) && d2 < d3)
        {
            d3 = d2;
            i = 4;
        }

        if (!this.worldObj.isBlockFullCube(blockpos.south()) && 1.0D - d2 < d3)
        {
            d3 = 1.0D - d2;
            i = 5;
        }

        float f = this.rand.nextFloat() * 0.2F + 0.1F;

        if (i == 0)
        {
            this.motionX = (double)(-f);
        }

        if (i == 1)
        {
            this.motionX = (double)f;
        }

        if (i == 3)
        {
            this.motionY = (double)f;
        }

        if (i == 4)
        {
            this.motionZ = (double)(-f);
        }

        if (i == 5)
        {
            this.motionZ = (double)f;
        }

        return true;
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:78,代碼來源:Entity.java

示例13: getCollisionBoundingBox

import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
{
    return new AxisAlignedBB((double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), (double)(pos.getX() + 1), (double)(pos.getY() + 1), (double)(pos.getZ() + 1));
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:5,代碼來源:BlockFarmland.java

示例14: createSpawnPosition

import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
/**
 * creates a spawn position at random within 256 blocks of 0,0
 */
private void createSpawnPosition(WorldSettings p_73052_1_)
{
    if (!this.provider.canRespawnHere())
    {
        this.worldInfo.setSpawn(BlockPos.ORIGIN.up(this.provider.getAverageGroundLevel()));
    }
    else if (this.worldInfo.getTerrainType() == WorldType.DEBUG_WORLD)
    {
        this.worldInfo.setSpawn(BlockPos.ORIGIN.up());
    }
    else
    {
        this.findingSpawnPoint = true;
        WorldChunkManager worldchunkmanager = this.provider.getWorldChunkManager();
        List<BiomeGenBase> list = worldchunkmanager.getBiomesToSpawnIn();
        Random random = new Random(this.getSeed());
        BlockPos blockpos = worldchunkmanager.findBiomePosition(0, 0, 256, list, random);
        int i = 0;
        int j = this.provider.getAverageGroundLevel();
        int k = 0;

        if (blockpos != null)
        {
            i = blockpos.getX();
            k = blockpos.getZ();
        }
        else
        {
            logger.warn("Unable to find spawn biome");
        }

        int l = 0;

        while (!this.provider.canCoordinateBeSpawn(i, k))
        {
            i += random.nextInt(64) - random.nextInt(64);
            k += random.nextInt(64) - random.nextInt(64);
            ++l;

            if (l == 1000)
            {
                break;
            }
        }

        this.worldInfo.setSpawn(new BlockPos(i, j, k));
        this.findingSpawnPoint = false;

        if (p_73052_1_.isBonusChestEnabled())
        {
            this.createBonusChest();
        }
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:58,代碼來源:WorldServer.java

示例15: getCollisionBoundingBox

import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
{
    int i = ((Integer)state.getValue(LAYERS)).intValue() - 1;
    float f = 0.125F;
    return new AxisAlignedBB((double)pos.getX() + this.minX, (double)pos.getY() + this.minY, (double)pos.getZ() + this.minZ, (double)pos.getX() + this.maxX, (double)((float)pos.getY() + (float)i * f), (double)pos.getZ() + this.maxZ);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:7,代碼來源:BlockSnow.java


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