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


Java BlockPos.MutableBlockPos方法代码示例

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


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

示例1: getNearbyCornerBlocks

import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
private List<TileEntityStructure> getNearbyCornerBlocks(BlockPos p_184418_1_, BlockPos p_184418_2_)
{
    List<TileEntityStructure> list = Lists.<TileEntityStructure>newArrayList();

    for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(p_184418_1_, p_184418_2_))
    {
        IBlockState iblockstate = this.world.getBlockState(blockpos$mutableblockpos);

        if (iblockstate.getBlock() == Blocks.STRUCTURE_BLOCK)
        {
            TileEntity tileentity = this.world.getTileEntity(blockpos$mutableblockpos);

            if (tileentity != null && tileentity instanceof TileEntityStructure)
            {
                list.add((TileEntityStructure)tileentity);
            }
        }
    }

    return list;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:22,代码来源:TileEntityStructure.java

示例2: RenderChunk

import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
public RenderChunk(World p_i47120_1_, RenderGlobal p_i47120_2_, int p_i47120_3_)
{
    for (int i = 0; i < this.mapEnumFacing.length; ++i)
    {
        this.mapEnumFacing[i] = new BlockPos.MutableBlockPos();
    }

    this.world = p_i47120_1_;
    this.renderGlobal = p_i47120_2_;
    this.index = p_i47120_3_;

    if (OpenGlHelper.useVbo())
    {
        for (int j = 0; j < BlockRenderLayer.values().length; ++j)
        {
            this.vertexBuffers[j] = new VertexBuffer(DefaultVertexFormats.BLOCK);
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:20,代码来源:RenderChunk.java

示例3: isFree

import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
private PathNodeType isFree(int p_186327_1_, int p_186327_2_, int p_186327_3_)
{
    BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();

    for (int i = p_186327_1_; i < p_186327_1_ + this.entitySizeX; ++i)
    {
        for (int j = p_186327_2_; j < p_186327_2_ + this.entitySizeY; ++j)
        {
            for (int k = p_186327_3_; k < p_186327_3_ + this.entitySizeZ; ++k)
            {
                IBlockState iblockstate = this.blockaccess.getBlockState(blockpos$mutableblockpos.setPos(i, j, k));

                if (iblockstate.getMaterial() != Material.WATER)
                {
                    return PathNodeType.BLOCKED;
                }
            }
        }
    }

    return PathNodeType.WATER;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:23,代码来源:SwimNodeProcessor.java

示例4: doVoidFogParticles

import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
public void doVoidFogParticles(int posX, int posY, int posZ)
{
    int i = 32;
    Random random = new Random();
    ItemStack itemstack = this.mc.player.getHeldItemMainhand();

    if (itemstack == null || Block.getBlockFromItem(itemstack.getItem()) != Blocks.BARRIER)
    {
        itemstack = this.mc.player.getHeldItemOffhand();
    }

    boolean flag = this.mc.playerController.getCurrentGameType() == GameType.CREATIVE && !itemstack.func_190926_b() && itemstack.getItem() == Item.getItemFromBlock(Blocks.BARRIER);
    BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();

    for (int j = 0; j < 667; ++j)
    {
        this.showBarrierParticles(posX, posY, posZ, 16, random, flag, blockpos$mutableblockpos);
        this.showBarrierParticles(posX, posY, posZ, 32, random, flag, blockpos$mutableblockpos);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:21,代码来源:WorldClient.java

示例5: onUpdate

import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
@Override
public void onUpdate() {
    oldMotionX = motionX;
    oldMotionY = motionY;
    oldMotionZ = motionZ;
    super.onUpdate();
    motionX *= 0.95D; // equal to the potion effect friction. 0.95F
    motionY *= 0.95D;
    motionZ *= 0.95D;
    if (motionX * motionX + motionY * motionY + motionZ * motionZ < 0.1D) {
        setDead();
    }
    if (!world.isRemote) {
        BlockPos pos = new BlockPos(posX, posY, posZ);
        BlockPos.MutableBlockPos mPos = new BlockPos.MutableBlockPos(pos);
        if (tryCutPlants(pos)) {
            int plantsCut = 1;
            for (int x = -1; x <= 1; x++) {
                for (int y = -1; y <= 1; y++) {
                    for (int z = -1; z <= 1; z++) {
                        if (x == 0 && y == 0 && z == 0) continue;
                        mPos.setPos(pos.getX() + x, pos.getY() + y, pos.getZ() + z);
                        if (tryCutPlants(mPos)) plantsCut++;
                    }
                }
            }
            // slow the vortex down for each plant it broke
            double mult = Math.pow(0.8D, plantsCut);
            motionX *= mult;
            motionY *= mult;
            motionZ *= mult;
        }
    }

}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:36,代码来源:EntityVortex.java

示例6: getAverageGroundLevel

import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
protected int getAverageGroundLevel(World worldIn, StructureBoundingBox structurebb)
{
    int i = 0;
    int j = 0;
    BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();

    for (int k = this.boundingBox.minZ; k <= this.boundingBox.maxZ; ++k)
    {
        for (int l = this.boundingBox.minX; l <= this.boundingBox.maxX; ++l)
        {
            blockpos$mutableblockpos.setPos(l, 64, k);

            if (structurebb.isVecInside(blockpos$mutableblockpos))
            {
                i += Math.max(worldIn.getTopSolidOrLiquidBlock(blockpos$mutableblockpos).getY(), worldIn.provider.getAverageGroundLevel() - 1);
                ++j;
            }
        }
    }

    if (j == 0)
    {
        return -1;
    }
    else
    {
        return i / j;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:30,代码来源:StructureVillagePieces.java

示例7: hasWater

import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
private boolean hasWater(World worldIn, BlockPos pos)
{
    for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(pos.add(-4, 0, -4), pos.add(4, 1, 4)))
    {
        if (worldIn.getBlockState(blockpos$mutableblockpos).getMaterial() == Material.WATER)
        {
            return true;
        }
    }

    return false;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:13,代码来源:BlockFarmland.java

示例8: getBrightness

import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
/**
 * Gets how bright this entity is.
 */
public float getBrightness(float partialTicks)
{
    BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(MathHelper.floor(this.posX), 0, MathHelper.floor(this.posZ));

    if (this.world.isBlockLoaded(blockpos$mutableblockpos))
    {
        blockpos$mutableblockpos.setY(MathHelper.floor(this.posY + (double)this.getEyeHeight()));
        return this.world.getLightBrightness(blockpos$mutableblockpos);
    }
    else
    {
        return 0.0F;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:Entity.java

示例9: generate

import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
public boolean generate(World worldIn, Random rand, BlockPos position)
{
    for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(position.add(-1, -2, -1), position.add(1, 2, 1)))
    {
        boolean flag = blockpos$mutableblockpos.getX() == position.getX();
        boolean flag1 = blockpos$mutableblockpos.getY() == position.getY();
        boolean flag2 = blockpos$mutableblockpos.getZ() == position.getZ();
        boolean flag3 = Math.abs(blockpos$mutableblockpos.getY() - position.getY()) == 2;

        if (flag && flag1 && flag2)
        {
            this.setBlockAndNotifyAdequately(worldIn, new BlockPos(blockpos$mutableblockpos), Blocks.END_GATEWAY.getDefaultState());
        }
        else if (flag1)
        {
            this.setBlockAndNotifyAdequately(worldIn, blockpos$mutableblockpos, Blocks.AIR.getDefaultState());
        }
        else if (flag3 && flag && flag2)
        {
            this.setBlockAndNotifyAdequately(worldIn, blockpos$mutableblockpos, Blocks.BEDROCK.getDefaultState());
        }
        else if ((flag || flag2) && !flag3)
        {
            this.setBlockAndNotifyAdequately(worldIn, blockpos$mutableblockpos, Blocks.BEDROCK.getDefaultState());
        }
        else
        {
            this.setBlockAndNotifyAdequately(worldIn, blockpos$mutableblockpos, Blocks.AIR.getDefaultState());
        }
    }

    return true;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:34,代码来源:WorldGenEndGateway.java

示例10: beforePlace

import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
@Override
public void beforePlace(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider, BlockPos pos, float sif, int count)
{
    BlockPos.MutableBlockPos p = new BlockPos.MutableBlockPos(pos);
    for (int y1 = 0; y1 < count + 1; y1++)
    {
        p.setY(p.getY() + y1);
        world.setBlockToAir(p);
    }
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:11,代码来源:CrystalGenPredicates.java

示例11: propagateUpdate

import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
public void propagateUpdate(World worldIn, BlockPos pos)
{
    IBlockState iblockstate = worldIn.getBlockState(pos);

    if (iblockstate.getBlock() == Blocks.COMMAND_BLOCK || iblockstate.getBlock() == Blocks.REPEATING_COMMAND_BLOCK)
    {
        BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(pos);
        blockpos$mutableblockpos.move((EnumFacing)iblockstate.getValue(FACING));

        for (TileEntity tileentity = worldIn.getTileEntity(blockpos$mutableblockpos); tileentity instanceof TileEntityCommandBlock; tileentity = worldIn.getTileEntity(blockpos$mutableblockpos))
        {
            TileEntityCommandBlock tileentitycommandblock = (TileEntityCommandBlock)tileentity;

            if (tileentitycommandblock.getMode() != TileEntityCommandBlock.Mode.SEQUENCE)
            {
                break;
            }

            IBlockState iblockstate1 = worldIn.getBlockState(blockpos$mutableblockpos);
            Block block = iblockstate1.getBlock();

            if (block != Blocks.CHAIN_COMMAND_BLOCK || worldIn.isUpdateScheduled(blockpos$mutableblockpos, block))
            {
                break;
            }

            worldIn.scheduleUpdate(new BlockPos(blockpos$mutableblockpos), block, this.tickRate(worldIn));
            blockpos$mutableblockpos.move((EnumFacing)iblockstate1.getValue(FACING));
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:32,代码来源:BlockCommandBlock.java

示例12: getBrightnessForRender

import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
@Override
public int getBrightnessForRender() {
	BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(MathHelper.floor(posX), 0, MathHelper.floor(posZ));

	if (world != null && world.isBlockLoaded(blockpos$mutableblockpos)) {
		blockpos$mutableblockpos.setY(MathHelper.floor(posY + getEyeHeight()));
		return world.getCombinedLight(blockpos$mutableblockpos, 0);
	}
	else {
		return 15;
	}
}
 
开发者ID:p455w0rd,项目名称:EndermanEvolution,代码行数:14,代码来源:EntityFrienderman.java

示例13: getBrightness

import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
@Override
public float getBrightness() {
	BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(MathHelper.floor(posX), 0, MathHelper.floor(posZ));

	if (world != null && world.isBlockLoaded(blockpos$mutableblockpos)) {
		blockpos$mutableblockpos.setY(MathHelper.floor(posY + getEyeHeight()));
		return world.getLightBrightness(blockpos$mutableblockpos);
	}
	else {
		return 1.0F;
	}
}
 
开发者ID:p455w0rd,项目名称:EndermanEvolution,代码行数:13,代码来源:EntityFrienderman.java

示例14: showBarrierParticles

import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
public void showBarrierParticles(int p_184153_1_, int p_184153_2_, int p_184153_3_, int p_184153_4_, Random random, boolean p_184153_6_, BlockPos.MutableBlockPos pos)
{
    int i = p_184153_1_ + this.rand.nextInt(p_184153_4_) - this.rand.nextInt(p_184153_4_);
    int j = p_184153_2_ + this.rand.nextInt(p_184153_4_) - this.rand.nextInt(p_184153_4_);
    int k = p_184153_3_ + this.rand.nextInt(p_184153_4_) - this.rand.nextInt(p_184153_4_);
    pos.setPos(i, j, k);
    IBlockState iblockstate = this.getBlockState(pos);
    iblockstate.getBlock().randomDisplayTick(iblockstate, this, pos, random);

    if (p_184153_6_ && iblockstate.getBlock() == Blocks.BARRIER)
    {
        this.spawnParticle(EnumParticleTypes.BARRIER, (double)((float)i + 0.5F), (double)((float)j + 0.5F), (double)((float)k + 0.5F), 0.0D, 0.0D, 0.0D, new int[0]);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:15,代码来源:WorldClient.java

示例15: offsetToAverageGroundLevel

import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
protected boolean offsetToAverageGroundLevel(World worldIn, StructureBoundingBox structurebb, int yOffset)
{
    if (this.horizontalPos >= 0)
    {
        return true;
    }
    else
    {
        int i = 0;
        int j = 0;
        BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();

        for (int k = this.boundingBox.minZ; k <= this.boundingBox.maxZ; ++k)
        {
            for (int l = this.boundingBox.minX; l <= this.boundingBox.maxX; ++l)
            {
                blockpos$mutableblockpos.setPos(l, 64, k);

                if (structurebb.isVecInside(blockpos$mutableblockpos))
                {
                    i += Math.max(worldIn.getTopSolidOrLiquidBlock(blockpos$mutableblockpos).getY(), worldIn.provider.getAverageGroundLevel());
                    ++j;
                }
            }
        }

        if (j == 0)
        {
            return false;
        }
        else
        {
            this.horizontalPos = i / j;
            this.boundingBox.offset(0, this.horizontalPos - this.boundingBox.minY + yOffset, 0);
            return true;
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:39,代码来源:ComponentScatteredFeaturePieces.java


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