当前位置: 首页>>代码示例>>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;未经允许,请勿转载。