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


Java BlockPos.down方法代碼示例

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


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

示例1: toggleDoor

import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
public void toggleDoor(World worldIn, BlockPos pos, boolean open)
{
    IBlockState iblockstate = worldIn.getBlockState(pos);

    if (iblockstate.getBlock() == this)
    {
        BlockPos blockpos = iblockstate.getValue(HALF) == BlockDoor.EnumDoorHalf.LOWER ? pos : pos.down();
        IBlockState iblockstate1 = pos == blockpos ? iblockstate : worldIn.getBlockState(blockpos);

        if (iblockstate1.getBlock() == this && ((Boolean)iblockstate1.getValue(OPEN)).booleanValue() != open)
        {
            worldIn.setBlockState(blockpos, iblockstate1.withProperty(OPEN, Boolean.valueOf(open)), 10);
            worldIn.markBlockRangeForRenderUpdate(blockpos, pos);
            worldIn.playEvent((EntityPlayer)null, open ? this.getOpenSound() : this.getCloseSound(), pos, 0);
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:18,代碼來源:BlockDoor.java

示例2: getTopSolidOrLiquidBlock

import net.minecraft.util.math.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();
        IBlockState state = chunk.getBlockState(blockpos1);

        if (state.getMaterial().blocksMovement() && !state.getBlock().isLeaves(state, this, blockpos1) && !state.getBlock().isFoliage(this, blockpos1))
        {
            break;
        }
    }

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

示例3: randomDisplayTick

import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
{
    if (rand.nextInt(16) == 0)
    {
        BlockPos blockpos = pos.down();

        if (canFallThrough(worldIn.getBlockState(blockpos)))
        {
            double d0 = (double)((float)pos.getX() + rand.nextFloat());
            double d1 = (double)pos.getY() - 0.05D;
            double d2 = (double)((float)pos.getZ() + rand.nextFloat());
            worldIn.spawnParticle(EnumParticleTypes.FALLING_DUST, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[] {Block.getStateId(stateIn)});
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:17,代碼來源:BlockFalling.java

示例4: handleFalling

import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
/**
 * process player falling based on movement packet
 */
public void handleFalling(double y, boolean onGroundIn)
{
    int i = MathHelper.floor(this.posX);
    int j = MathHelper.floor(this.posY - 0.20000000298023224D);
    int k = MathHelper.floor(this.posZ);
    BlockPos blockpos = new BlockPos(i, j, k);
    IBlockState iblockstate = this.world.getBlockState(blockpos);

    if (iblockstate.getMaterial() == Material.AIR)
    {
        BlockPos blockpos1 = blockpos.down();
        IBlockState iblockstate1 = this.world.getBlockState(blockpos1);
        Block block = iblockstate1.getBlock();

        if (block instanceof BlockFence || block instanceof BlockWall || block instanceof BlockFenceGate)
        {
            blockpos = blockpos1;
            iblockstate = iblockstate1;
        }
    }

    super.updateFallState(y, onGroundIn, iblockstate, blockpos);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:27,代碼來源:EntityPlayerMP.java

示例5: generate

import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
@Override
public boolean generate(World worldIn, Random rand, BlockPos position)
{
	for (int i = 0; i < 16; ++i)
	{
		BlockPos offset = position.add(rand.nextInt(8) - rand.nextInt(8), 4, rand.nextInt(8) - rand.nextInt(8));
		while (!worldIn.getBlockState(offset).getPropertyKeys().contains(ExPBlockProperties.DIRT_CLASS) && offset.getY() > 96)
		{
			offset = offset.down();
		}
		
		IBlockState at = worldIn.getBlockState(offset);
		IBlockState above = worldIn.getBlockState(offset.up());
		if (above.getMaterial() == Material.WATER && worldIn.isAirBlock(offset.up().up()))
		{
			boolean allow = !(above.getBlock() instanceof IWater) || !((IWater) above.getBlock()).isSalt(worldIn, offset.up());
			if (allow)
			{
				worldIn.setBlockState(offset, ExPBlocks.cattail.getDefaultState().withProperty(ExPBlockProperties.DIRT_CLASS, at.getValue(ExPBlockProperties.DIRT_CLASS)), 2);
			}
		}
	}
	
	return true;
}
 
開發者ID:V0idWa1k3r,項目名稱:ExPetrum,代碼行數:26,代碼來源:CattailGenerator.java

示例6: onBlockHarvested

import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player)
{
    BlockPos blockpos = pos.down();
    BlockPos blockpos1 = pos.up();

    if (player.capabilities.isCreativeMode && state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER && worldIn.getBlockState(blockpos).getBlock() == this)
    {
        worldIn.setBlockToAir(blockpos);
    }

    if (state.getValue(HALF) == BlockDoor.EnumDoorHalf.LOWER && worldIn.getBlockState(blockpos1).getBlock() == this)
    {
        if (player.capabilities.isCreativeMode)
        {
            worldIn.setBlockToAir(pos);
        }

        worldIn.setBlockToAir(blockpos1);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:21,代碼來源:BlockDoor.java

示例7: breakBlock

import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state) {
    super.breakBlock(world, pos, state);

    if(state.getValue(BASE)) {
        BlockPos top = pos.up();
        IBlockState topState = world.getBlockState(top);
        if(topState.getBlock() == this && !topState.getValue(BASE)) {
            world.setBlockToAir(top);
        }
    } else {
        BlockPos base = pos.down();
        IBlockState baseState = world.getBlockState(base);
        if(baseState.getBlock() == this && baseState.getValue(BASE)) {
            world.setBlockToAir(base);
        }
    }
}
 
開發者ID:Guichaguri,項目名稱:ProjectEon,代碼行數:19,代碼來源:BlockTesla.java

示例8: checkFallable

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

        if (!fallInstantly && worldIn.isAreaLoaded(pos.add(-32, -32, -32), pos.add(32, 32, 32)))
        {
            if (!worldIn.isRemote)
            {
                EntityFallingBlock entityfallingblock = new EntityFallingBlock(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, worldIn.getBlockState(pos));
                this.onStartFalling(entityfallingblock);
                worldIn.spawnEntityInWorld(entityfallingblock);
            }
        }
        else
        {
            IBlockState state = worldIn.getBlockState(pos);
            worldIn.setBlockToAir(pos);
            BlockPos blockpos;

            for (blockpos = pos.down(); (worldIn.isAirBlock(blockpos) || canFallThrough(worldIn.getBlockState(blockpos))) && blockpos.getY() > 0; blockpos = blockpos.down())
            {
                ;
            }

            if (blockpos.getY() > 0)
            {
                worldIn.setBlockState(blockpos.up(), state); //Forge: Fix loss of state information during world gen.
            }
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:34,代碼來源:BlockFalling.java

示例9: Size

import net.minecraft.util.math.BlockPos; //導入方法依賴的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.leftDir = EnumFacing.EAST;
        this.rightDir = EnumFacing.WEST;
    }
    else
    {
        this.leftDir = EnumFacing.NORTH;
        this.rightDir = EnumFacing.SOUTH;
    }

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

    int i = this.getDistanceUntilEdge(p_i45694_2_, this.leftDir) - 1;

    if (i >= 0)
    {
        this.bottomLeft = p_i45694_2_.offset(this.leftDir, i);
        this.width = this.getDistanceUntilEdge(this.bottomLeft, this.rightDir);

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

    if (this.bottomLeft != null)
    {
        this.height = this.calculatePortalHeight();
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:41,代碼來源:BlockPortal.java

示例10: addVine

import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
private void addVine(World worldIn, BlockPos pos, PropertyBool prop)
{
    IBlockState iblockstate = Blocks.VINE.getDefaultState().withProperty(prop, Boolean.valueOf(true));
    this.setBlockAndNotifyAdequately(worldIn, pos, iblockstate);
    int i = 4;

    for (pos = pos.down(); worldIn.getBlockState(pos).getMaterial() == Material.AIR && i > 0; --i)
    {
        this.setBlockAndNotifyAdequately(worldIn, pos, iblockstate);
        pos = pos.down();
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:13,代碼來源:WorldGenSwamp.java

示例11: leavesGenEucalyptusImpl

import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
public static void leavesGenEucalyptusImpl(Pair<ITreeGenerator, BlockPos> p, int height)
{
	BlockPos start = p.getRight().up(height + 2);
	for (int i = 0; i < 6 + p.getLeft().genWorld().rand.nextInt(3) && i < height - 1; ++i)
	{
		BlockPos at = start.down(i);
		leavesGenHickoryImplLayer(p.getKey(), p.getKey().genWorld(), at, i);
	}
}
 
開發者ID:V0idWa1k3r,項目名稱:ExPetrum,代碼行數:10,代碼來源:TreeGenImpl.java

示例12: func_190876_a

import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
private void func_190876_a(double p_190876_1_, double p_190876_3_, double p_190876_5_, double p_190876_7_, float p_190876_9_, int p_190876_10_)
{
    BlockPos blockpos = new BlockPos(p_190876_1_, p_190876_7_, p_190876_3_);
    boolean flag = false;
    double d0 = 0.0D;

    while (true)
    {
        if (!EntityEvoker.this.world.isBlockNormalCube(blockpos, true) && EntityEvoker.this.world.isBlockNormalCube(blockpos.down(), true))
        {
            if (!EntityEvoker.this.world.isAirBlock(blockpos))
            {
                IBlockState iblockstate = EntityEvoker.this.world.getBlockState(blockpos);
                AxisAlignedBB axisalignedbb = iblockstate.getCollisionBoundingBox(EntityEvoker.this.world, blockpos);

                if (axisalignedbb != null)
                {
                    d0 = axisalignedbb.maxY;
                }
            }

            flag = true;
            break;
        }

        blockpos = blockpos.down();

        if (blockpos.getY() < MathHelper.floor(p_190876_5_) - 1)
        {
            break;
        }
    }

    if (flag)
    {
        EntityEvokerFangs entityevokerfangs = new EntityEvokerFangs(EntityEvoker.this.world, p_190876_1_, (double)blockpos.getY() + d0, p_190876_3_, p_190876_9_, p_190876_10_, EntityEvoker.this);
        EntityEvoker.this.world.spawnEntityInWorld(entityevokerfangs);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:40,代碼來源:EntityEvoker.java

示例13: canCreatureTypeSpawnAtLocation

import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
public static boolean canCreatureTypeSpawnAtLocation(EntityLiving.SpawnPlacementType spawnPlacementTypeIn, World worldIn, BlockPos pos)
{
    if (!worldIn.getWorldBorder().contains(pos))
    {
        return false;
    }
    else
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);

        if (spawnPlacementTypeIn == EntityLiving.SpawnPlacementType.IN_WATER)
        {
            return iblockstate.getMaterial() == Material.WATER && worldIn.getBlockState(pos.down()).getMaterial() == Material.WATER && !worldIn.getBlockState(pos.up()).isNormalCube();
        }
        else
        {
            BlockPos blockpos = pos.down();

            if (!worldIn.getBlockState(blockpos).isFullyOpaque())
            {
                return false;
            }
            else
            {
                Block block = worldIn.getBlockState(blockpos).getBlock();
                boolean flag = block != Blocks.BEDROCK && block != Blocks.BARRIER;
                return flag && isValidEmptySpawnBlock(iblockstate) && isValidEmptySpawnBlock(worldIn.getBlockState(pos.up()));
            }
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:32,代碼來源:WorldEntitySpawner.java

示例14: canPlaceBlockAt

import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
    Block block = worldIn.getBlockState(pos.down()).getBlock();

    if (block == this)
    {
        return true;
    }
    else if (block != Blocks.GRASS && block != Blocks.DIRT && block != Blocks.SAND)
    {
        return false;
    }
    else
    {
        BlockPos blockpos = pos.down();

        for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
        {
            IBlockState iblockstate = worldIn.getBlockState(blockpos.offset(enumfacing));

            if (iblockstate.getMaterial() == Material.WATER || iblockstate.getBlock() == Blocks.FROSTED_ICE)
            {
                return true;
            }
        }

        return false;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:30,代碼來源:BlockReed.java

示例15: work

import net.minecraft.util.math.BlockPos; //導入方法依賴的package包/類
@Override
public void work()
{
	if(canExtractEnergy())
	{
		if(world.isRemote)
		{
			createParticles();
		}

		extractWorkEnergy();

		BlockPos nextTop = getPos().down();

		while(nextTop.getY() >= 0 && world.isAirBlock(nextTop) || BlockUtil.isFluid(world.getBlockState(nextTop)))
		{
			nextTop = nextTop.down();
		}

		IBlockState breakState = world.getBlockState(nextTop);
		if(breakState.getBlock().getBlockHardness(breakState, world, nextTop) > -1 && !world.isRemote)
		{

			world.setBlockState(getPos().up(), breakState);
			world.destroyBlock(nextTop, false);
		}
	}
}
 
開發者ID:Lemonszz,項目名稱:Anima-Mundi,代碼行數:29,代碼來源:TileEntityExtractor.java


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