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


Java BlockPos.getY方法代碼示例

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


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

示例1: 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

示例2: generateChestContents

import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
protected boolean generateChestContents(World worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, List<WeightedRandomChestContent> listIn, int max)
{
    BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));

    if (boundingBoxIn.isVecInside(blockpos) && worldIn.getBlockState(blockpos).getBlock().getMaterial() == Material.air)
    {
        int i = rand.nextBoolean() ? 1 : 0;
        worldIn.setBlockState(blockpos, Blocks.rail.getStateFromMeta(this.getMetadataWithOffset(Blocks.rail, i)), 2);
        EntityMinecartChest entityminecartchest = new EntityMinecartChest(worldIn, (double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.5F), (double)((float)blockpos.getZ() + 0.5F));
        WeightedRandomChestContent.generateChestContents(rand, listIn, entityminecartchest, max);
        worldIn.spawnEntityInWorld(entityminecartchest);
        return true;
    }
    else
    {
        return false;
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:19,代碼來源:StructureMineshaftPieces.java

示例3: getTopSolidOrLiquidBlock

import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
/**
 * Finds the highest block on the x and z coordinate that is solid or liquid, and returns its y coord.
 */
public BlockPos getTopSolidOrLiquidBlock(BlockPos pos)
{
    Chunk chunk = this.getChunkFromBlockCoords(pos);
    BlockPos blockpos;
    BlockPos blockpos1;

    for (blockpos = new BlockPos(pos.getX(), chunk.getTopFilledSegment() + 16, pos.getZ()); blockpos.getY() >= 0; blockpos = blockpos1)
    {
        blockpos1 = blockpos.down();
        Material material = chunk.getBlock(blockpos1).getMaterial();

        if (material.blocksMovement() && material != Material.leaves)
        {
            break;
        }
    }

    return blockpos;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:23,代碼來源:World.java

示例4: randomDisplayTick

import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
	EnumFacing enumfacing = (EnumFacing) state.getValue(FACING);
	double d0 = (double) pos.getX() + 0.5D;
	double d1 = (double) pos.getY() + 0.7D;
	double d2 = (double) pos.getZ() + 0.5D;
	double d3 = 0.22D;
	double d4 = 0.27D;

	if (enumfacing.getAxis().isHorizontal()) {
		EnumFacing enumfacing1 = enumfacing.getOpposite();
		worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d4 * (double) enumfacing1.getFrontOffsetX(),
				d1 + d3, d2 + d4 * (double) enumfacing1.getFrontOffsetZ(), 0.0D, 0.0D, 0.0D, new int[0]);
		worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + d4 * (double) enumfacing1.getFrontOffsetX(), d1 + d3,
				d2 + d4 * (double) enumfacing1.getFrontOffsetZ(), 0.0D, 0.0D, 0.0D, new int[0]);
	} else {
		worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
		worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
	}
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:20,代碼來源:BlockTorch.java

示例5: writePacketData

import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
/**
 * Writes the raw packet data to the data stream.
 */
public void writePacketData(PacketBuffer buf) throws IOException
{
    buf.writeFloat((float)this.posX);
    buf.writeFloat((float)this.posY);
    buf.writeFloat((float)this.posZ);
    buf.writeFloat(this.strength);
    buf.writeInt(this.affectedBlockPositions.size());
    int i = (int)this.posX;
    int j = (int)this.posY;
    int k = (int)this.posZ;

    for (BlockPos blockpos : this.affectedBlockPositions)
    {
        int l = blockpos.getX() - i;
        int i1 = blockpos.getY() - j;
        int j1 = blockpos.getZ() - k;
        buf.writeByte(l);
        buf.writeByte(i1);
        buf.writeByte(j1);
    }

    buf.writeFloat(this.field_149152_f);
    buf.writeFloat(this.field_149153_g);
    buf.writeFloat(this.field_149159_h);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:29,代碼來源:S27PacketExplosion.java

示例6: func_179867_a

import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
private Vec3 func_179867_a(BlockPos p_179867_1_)
{
    for (int i = 0; i < 10; ++i)
    {
        BlockPos blockpos = p_179867_1_.add(this.worldObj.rand.nextInt(16) - 8, this.worldObj.rand.nextInt(6) - 3, this.worldObj.rand.nextInt(16) - 8);

        if (this.theVillage.func_179866_a(blockpos) && SpawnerAnimals.canCreatureTypeSpawnAtLocation(EntityLiving.SpawnPlacementType.ON_GROUND, this.worldObj, blockpos))
        {
            return new Vec3((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ());
        }
    }

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

示例7: onBlockDestroyedByExplosion

import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
/**
 * Called when this Block is destroyed by an Explosion
 */
public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn)
{
    if (!worldIn.isRemote)
    {
        EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), explosionIn.getExplosivePlacedBy());
        entitytntprimed.fuse = worldIn.rand.nextInt(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8;
        worldIn.spawnEntityInWorld(entitytntprimed);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:13,代碼來源:BlockTNT.java

示例8: addBlockDestroyEffects

import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public void addBlockDestroyEffects(BlockPos pos, IBlockState state)
{
    boolean flag;

    if (Reflector.ForgeBlock_addDestroyEffects.exists() && Reflector.ForgeBlock_isAir.exists())
    {
        Block block = state.getBlock();
        Reflector.callBoolean(block, Reflector.ForgeBlock_isAir, new Object[] {this.worldObj, pos});
        flag = !Reflector.callBoolean(block, Reflector.ForgeBlock_isAir, new Object[] {this.worldObj, pos}) && !Reflector.callBoolean(block, Reflector.ForgeBlock_addDestroyEffects, new Object[] {this.worldObj, pos, this});
    }
    else
    {
        flag = state.getBlock().getMaterial() != Material.air;
    }

    if (flag)
    {
        state = state.getBlock().getActualState(state, this.worldObj, pos);
        byte b0 = 4;

        for (int i = 0; i < b0; ++i)
        {
            for (int j = 0; j < b0; ++j)
            {
                for (int k = 0; k < b0; ++k)
                {
                    double d0 = (double)pos.getX() + ((double)i + 0.5D) / (double)b0;
                    double d1 = (double)pos.getY() + ((double)j + 0.5D) / (double)b0;
                    double d2 = (double)pos.getZ() + ((double)k + 0.5D) / (double)b0;
                    this.addEffect((new EntityDiggingFX(this.worldObj, d0, d1, d2, d0 - (double)pos.getX() - 0.5D, d1 - (double)pos.getY() - 0.5D, d2 - (double)pos.getZ() - 0.5D, state)).func_174846_a(pos));
                }
            }
        }
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:36,代碼來源:EffectRenderer.java

示例9: getSmoothColorMultiplier

import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
private static int getSmoothColorMultiplier(IBlockAccess p_getSmoothColorMultiplier_0_, BlockPos p_getSmoothColorMultiplier_1_, CustomColors.IColorizer p_getSmoothColorMultiplier_2_, BlockPosM p_getSmoothColorMultiplier_3_)
{
    int i = 0;
    int j = 0;
    int k = 0;
    int l = p_getSmoothColorMultiplier_1_.getX();
    int i1 = p_getSmoothColorMultiplier_1_.getY();
    int j1 = p_getSmoothColorMultiplier_1_.getZ();
    BlockPosM blockposm = p_getSmoothColorMultiplier_3_;

    for (int k1 = l - 1; k1 <= l + 1; ++k1)
    {
        for (int l1 = j1 - 1; l1 <= j1 + 1; ++l1)
        {
            blockposm.setXyz(k1, i1, l1);
            int i2 = p_getSmoothColorMultiplier_2_.getColor(p_getSmoothColorMultiplier_0_, blockposm);
            i += i2 >> 16 & 255;
            j += i2 >> 8 & 255;
            k += i2 & 255;
        }
    }

    int j2 = i / 9;
    int k2 = j / 9;
    int l2 = k / 9;
    return j2 << 16 | k2 << 8 | l2;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:28,代碼來源:CustomColors.java

示例10: checkFall

import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
private void checkFall(World worldIn, BlockPos pos)
{
    if (BlockFalling.canFallInto(worldIn, pos.down()) && pos.getY() >= 0)
    {
        int i = 32;

        if (!BlockFalling.fallInstantly && worldIn.isAreaLoaded(pos.add(-i, -i, -i), pos.add(i, i, i)))
        {
            worldIn.spawnEntityInWorld(new EntityFallingBlock(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), this.getDefaultState()));
        }
        else
        {
            worldIn.setBlockToAir(pos);
            BlockPos blockpos;

            for (blockpos = pos; BlockFalling.canFallInto(worldIn, blockpos) && blockpos.getY() > 0; blockpos = blockpos.down())
            {
                ;
            }

            if (blockpos.getY() > 0)
            {
                worldIn.setBlockState(blockpos, this.getDefaultState(), 2);
            }
        }
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:28,代碼來源:BlockDragonEgg.java

示例11: func_175926_c

import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
private boolean func_175926_c(World worldIn, BlockPos p_175926_2_, int p_175926_3_)
{
    boolean flag = true;

    if (p_175926_2_.getY() >= 1 && p_175926_2_.getY() + p_175926_3_ + 1 <= 256)
    {
        for (int i = 0; i <= 1 + p_175926_3_; ++i)
        {
            int j = 2;

            if (i == 0)
            {
                j = 1;
            }
            else if (i >= 1 + p_175926_3_ - 2)
            {
                j = 2;
            }

            for (int k = -j; k <= j && flag; ++k)
            {
                for (int l = -j; l <= j && flag; ++l)
                {
                    if (p_175926_2_.getY() + i < 0 || p_175926_2_.getY() + i >= 256 || !this.func_150523_a(worldIn.getBlockState(p_175926_2_.add(k, i, l)).getBlock()))
                    {
                        flag = false;
                    }
                }
            }
        }

        return flag;
    }
    else
    {
        return false;
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:39,代碼來源:WorldGenHugeTrees.java

示例12: dropRecord

import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
private void dropRecord(World worldIn, BlockPos pos, IBlockState state)
{
    if (!worldIn.isRemote)
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof BlockJukebox.TileEntityJukebox)
        {
            BlockJukebox.TileEntityJukebox blockjukebox$tileentityjukebox = (BlockJukebox.TileEntityJukebox)tileentity;
            ItemStack itemstack = blockjukebox$tileentityjukebox.getRecord();

            if (itemstack != null)
            {
                worldIn.playAuxSFX(1005, pos, 0);
                worldIn.playRecord(pos, (String)null);
                blockjukebox$tileentityjukebox.setRecord((ItemStack)null);
                float f = 0.7F;
                double d0 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
                double d1 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.2D + 0.6D;
                double d2 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
                ItemStack itemstack1 = itemstack.copy();
                EntityItem entityitem = new EntityItem(worldIn, (double)pos.getX() + d0, (double)pos.getY() + d1, (double)pos.getZ() + d2, itemstack1);
                entityitem.setDefaultPickupDelay();
                worldIn.spawnEntityInWorld(entityitem);
            }
        }
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:29,代碼來源:BlockJukebox.java

示例13: getCollisionBoundingBox

import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
{
    float f = 0.0625F;
    float f1 = (float)(1 + ((Integer)state.getValue(BITES)).intValue() * 2) / 16.0F;
    float f2 = 0.5F;
    return new AxisAlignedBB((double)((float)pos.getX() + f1), (double)pos.getY(), (double)((float)pos.getZ() + f), (double)((float)(pos.getX() + 1) - f), (double)((float)pos.getY() + f2), (double)((float)(pos.getZ() + 1) - f));
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:8,代碼來源:BlockCake.java

示例14: canBlockStay

import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
    if (pos.getY() >= 0 && pos.getY() < 256)
    {
        IBlockState iblockstate = worldIn.getBlockState(pos.down());
        return iblockstate.getBlock().getMaterial() == Material.water && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0;
    }
    else
    {
        return false;
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:13,代碼來源:BlockLilyPad.java

示例15: randomDisplayTick

import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (rand.nextInt(100) == 0)
    {
        worldIn.playSound((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "portal.portal", 0.5F, rand.nextFloat() * 0.4F + 0.8F, false);
    }

    for (int i = 0; i < 4; ++i)
    {
        double d0 = (double)((float)pos.getX() + rand.nextFloat());
        double d1 = (double)((float)pos.getY() + rand.nextFloat());
        double d2 = (double)((float)pos.getZ() + rand.nextFloat());
        double d3 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
        double d4 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
        double d5 = ((double)rand.nextFloat() - 0.5D) * 0.5D;
        int j = rand.nextInt(2) * 2 - 1;

        if (worldIn.getBlockState(pos.west()).getBlock() != this && worldIn.getBlockState(pos.east()).getBlock() != this)
        {
            d0 = (double)pos.getX() + 0.5D + 0.25D * (double)j;
            d3 = (double)(rand.nextFloat() * 2.0F * (float)j);
        }
        else
        {
            d2 = (double)pos.getZ() + 0.5D + 0.25D * (double)j;
            d5 = (double)(rand.nextFloat() * 2.0F * (float)j);
        }

        worldIn.spawnParticle(EnumParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5, new int[0]);
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:32,代碼來源:BlockPortal.java


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