本文整理匯總了Java中net.minecraft.util.BlockPos.MutableBlockPos方法的典型用法代碼示例。如果您正苦於以下問題:Java BlockPos.MutableBlockPos方法的具體用法?Java BlockPos.MutableBlockPos怎麽用?Java BlockPos.MutableBlockPos使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.util.BlockPos
的用法示例。
在下文中一共展示了BlockPos.MutableBlockPos方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getPathPointTo
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
/**
* Returns given entity's position as PathPoint
*/
public PathPoint getPathPointTo(Entity entityIn)
{
int i;
if (this.canSwim && entityIn.isInWater())
{
i = (int)entityIn.getEntityBoundingBox().minY;
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(MathHelper.floor_double(entityIn.posX), i, MathHelper.floor_double(entityIn.posZ));
for (Block block = this.blockaccess.getBlockState(blockpos$mutableblockpos).getBlock(); block == Blocks.flowing_water || block == Blocks.water; block = this.blockaccess.getBlockState(blockpos$mutableblockpos).getBlock())
{
++i;
blockpos$mutableblockpos.func_181079_c(MathHelper.floor_double(entityIn.posX), i, MathHelper.floor_double(entityIn.posZ));
}
this.avoidsWater = false;
}
else
{
i = MathHelper.floor_double(entityIn.getEntityBoundingBox().minY + 0.5D);
}
return this.openPoint(MathHelper.floor_double(entityIn.getEntityBoundingBox().minX), i, MathHelper.floor_double(entityIn.getEntityBoundingBox().minZ));
}
示例2: doVoidFogParticles
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public void doVoidFogParticles(int p_73029_1_, int p_73029_2_, int p_73029_3_)
{
int i = 16;
Random random = new Random();
ItemStack itemstack = this.mc.thePlayer.getHeldItem();
boolean flag = this.mc.playerController.getCurrentGameType() == WorldSettings.GameType.CREATIVE && itemstack != null && Block.getBlockFromItem(itemstack.getItem()) == Blocks.barrier;
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
for (int j = 0; j < 1000; ++j)
{
int k = p_73029_1_ + this.rand.nextInt(i) - this.rand.nextInt(i);
int l = p_73029_2_ + this.rand.nextInt(i) - this.rand.nextInt(i);
int i1 = p_73029_3_ + this.rand.nextInt(i) - this.rand.nextInt(i);
blockpos$mutableblockpos.func_181079_c(k, l, i1);
IBlockState iblockstate = this.getBlockState(blockpos$mutableblockpos);
iblockstate.getBlock().randomDisplayTick(this, blockpos$mutableblockpos, iblockstate, random);
if (flag && iblockstate.getBlock() == Blocks.barrier)
{
this.spawnParticle(EnumParticleTypes.BARRIER, (double)((float)k + 0.5F), (double)((float)l + 0.5F), (double)((float)i1 + 0.5F), 0.0D, 0.0D, 0.0D, new int[0]);
}
}
}
示例3: getAverageGroundLevel
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
protected int getAverageGroundLevel(World worldIn, StructureBoundingBox p_74889_2_)
{
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.func_181079_c(l, 64, k);
if (p_74889_2_.isVecInside(blockpos$mutableblockpos))
{
i += Math.max(worldIn.getTopSolidOrLiquidBlock(blockpos$mutableblockpos).getY(), worldIn.provider.getAverageGroundLevel());
++j;
}
}
}
if (j == 0)
{
return -1;
}
else
{
return i / j;
}
}
示例4: func_74935_a
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
protected boolean func_74935_a(World worldIn, StructureBoundingBox p_74935_2_, int p_74935_3_)
{
if (this.field_74936_d >= 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.func_181079_c(l, 64, k);
if (p_74935_2_.isVecInside(blockpos$mutableblockpos))
{
i += Math.max(worldIn.getTopSolidOrLiquidBlock(blockpos$mutableblockpos).getY(), worldIn.provider.getAverageGroundLevel());
++j;
}
}
}
if (j == 0)
{
return false;
}
else
{
this.field_74936_d = i / j;
this.boundingBox.offset(0, this.field_74936_d - this.boundingBox.minY + p_74935_3_, 0);
return true;
}
}
}
示例5: func_147461_a
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public List<AxisAlignedBB> func_147461_a(AxisAlignedBB bb)
{
List<AxisAlignedBB> list = Lists.<AxisAlignedBB>newArrayList();
int i = MathHelper.floor_double(bb.minX);
int j = MathHelper.floor_double(bb.maxX + 1.0D);
int k = MathHelper.floor_double(bb.minY);
int l = MathHelper.floor_double(bb.maxY + 1.0D);
int i1 = MathHelper.floor_double(bb.minZ);
int j1 = MathHelper.floor_double(bb.maxZ + 1.0D);
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
for (int k1 = i; k1 < j; ++k1)
{
for (int l1 = i1; l1 < j1; ++l1)
{
if (this.isBlockLoaded(blockpos$mutableblockpos.func_181079_c(k1, 64, l1)))
{
for (int i2 = k - 1; i2 < l; ++i2)
{
blockpos$mutableblockpos.func_181079_c(k1, i2, l1);
IBlockState iblockstate;
if (k1 >= -30000000 && k1 < 30000000 && l1 >= -30000000 && l1 < 30000000)
{
iblockstate = this.getBlockState(blockpos$mutableblockpos);
}
else
{
iblockstate = Blocks.bedrock.getDefaultState();
}
iblockstate.getBlock().addCollisionBoxesToList(this, blockpos$mutableblockpos, iblockstate, bb, list, (Entity)null);
}
}
}
}
return list;
}
示例6: isMaterialInBB
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
/**
* Returns true if the given bounding box contains the given material
*/
public boolean isMaterialInBB(AxisAlignedBB bb, Material materialIn)
{
int i = MathHelper.floor_double(bb.minX);
int j = MathHelper.floor_double(bb.maxX + 1.0D);
int k = MathHelper.floor_double(bb.minY);
int l = MathHelper.floor_double(bb.maxY + 1.0D);
int i1 = MathHelper.floor_double(bb.minZ);
int j1 = MathHelper.floor_double(bb.maxZ + 1.0D);
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
for (int k1 = i; k1 < j; ++k1)
{
for (int l1 = k; l1 < l; ++l1)
{
for (int i2 = i1; i2 < j1; ++i2)
{
if (this.getBlockState(blockpos$mutableblockpos.func_181079_c(k1, l1, i2)).getBlock().getMaterial() == materialIn)
{
return true;
}
}
}
}
return false;
}
示例7: 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;
}
示例8: isFlammableWithin
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public boolean isFlammableWithin(AxisAlignedBB bb)
{
int i = MathHelper.floor_double(bb.minX);
int j = MathHelper.floor_double(bb.maxX + 1.0D);
int k = MathHelper.floor_double(bb.minY);
int l = MathHelper.floor_double(bb.maxY + 1.0D);
int i1 = MathHelper.floor_double(bb.minZ);
int j1 = MathHelper.floor_double(bb.maxZ + 1.0D);
if (this.isAreaLoaded(i, k, i1, j, l, j1, true))
{
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
for (int k1 = i; k1 < j; ++k1)
{
for (int l1 = k; l1 < l; ++l1)
{
for (int i2 = i1; i2 < j1; ++i2)
{
Block block = this.getBlockState(blockpos$mutableblockpos.func_181079_c(k1, l1, i2)).getBlock();
if (block == Blocks.fire || block == Blocks.flowing_lava || block == Blocks.lava)
{
return true;
}
}
}
}
}
return false;
}
示例9: checkBlockCollision
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
/**
* Returns true if there are any blocks in the region constrained by an AxisAlignedBB
*/
public boolean checkBlockCollision(AxisAlignedBB bb)
{
int i = MathHelper.floor_double(bb.minX);
int j = MathHelper.floor_double(bb.maxX);
int k = MathHelper.floor_double(bb.minY);
int l = MathHelper.floor_double(bb.maxY);
int i1 = MathHelper.floor_double(bb.minZ);
int j1 = MathHelper.floor_double(bb.maxZ);
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
for (int k1 = i; k1 <= j; ++k1)
{
for (int l1 = k; l1 <= l; ++l1)
{
for (int i2 = i1; i2 <= j1; ++i2)
{
Block block = this.getBlockState(blockpos$mutableblockpos.func_181079_c(k1, l1, i2)).getBlock();
if (block.getMaterial() != Material.air)
{
return true;
}
}
}
}
return false;
}
示例10: handleMaterialAcceleration
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
/**
* handles the acceleration of an object whilst in water. Not sure if it is used elsewhere.
*/
public boolean handleMaterialAcceleration(AxisAlignedBB bb, Material materialIn, Entity entityIn)
{
int i = MathHelper.floor_double(bb.minX);
int j = MathHelper.floor_double(bb.maxX + 1.0D);
int k = MathHelper.floor_double(bb.minY);
int l = MathHelper.floor_double(bb.maxY + 1.0D);
int i1 = MathHelper.floor_double(bb.minZ);
int j1 = MathHelper.floor_double(bb.maxZ + 1.0D);
if (!this.isAreaLoaded(i, k, i1, j, l, j1, true))
{
return false;
}
else
{
boolean flag = false;
Vec3 vec3 = new Vec3(0.0D, 0.0D, 0.0D);
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
for (int k1 = i; k1 < j; ++k1)
{
for (int l1 = k; l1 < l; ++l1)
{
for (int i2 = i1; i2 < j1; ++i2)
{
blockpos$mutableblockpos.func_181079_c(k1, l1, i2);
IBlockState iblockstate = this.getBlockState(blockpos$mutableblockpos);
Block block = iblockstate.getBlock();
if (block.getMaterial() == materialIn)
{
double d0 = (double)((float)(l1 + 1) - BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue()));
if ((double)l >= d0)
{
flag = true;
vec3 = block.modifyAcceleration(this, blockpos$mutableblockpos, entityIn, vec3);
}
}
}
}
}
if (vec3.lengthVector() > 0.0D && entityIn.isPushedByWater())
{
vec3 = vec3.normalize();
double d1 = 0.014D;
entityIn.motionX += vec3.xCoord * d1;
entityIn.motionY += vec3.yCoord * d1;
entityIn.motionZ += vec3.zCoord * d1;
}
return flag;
}
}
示例11: getCollidingBoundingBoxes
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public List<AxisAlignedBB> getCollidingBoundingBoxes(Entity entityIn, AxisAlignedBB bb)
{
List<AxisAlignedBB> list = Lists.<AxisAlignedBB>newArrayList();
int i = MathHelper.floor_double(bb.minX);
int j = MathHelper.floor_double(bb.maxX + 1.0D);
int k = MathHelper.floor_double(bb.minY);
int l = MathHelper.floor_double(bb.maxY + 1.0D);
int i1 = MathHelper.floor_double(bb.minZ);
int j1 = MathHelper.floor_double(bb.maxZ + 1.0D);
WorldBorder worldborder = this.getWorldBorder();
boolean flag = entityIn.isOutsideBorder();
boolean flag1 = this.isInsideBorder(worldborder, entityIn);
IBlockState iblockstate = Blocks.stone.getDefaultState();
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
for (int k1 = i; k1 < j; ++k1)
{
for (int l1 = i1; l1 < j1; ++l1)
{
if (this.isBlockLoaded(blockpos$mutableblockpos.func_181079_c(k1, 64, l1)))
{
for (int i2 = k - 1; i2 < l; ++i2)
{
blockpos$mutableblockpos.func_181079_c(k1, i2, l1);
if (flag && flag1)
{
entityIn.setOutsideBorder(false);
}
else if (!flag && !flag1)
{
entityIn.setOutsideBorder(true);
}
IBlockState iblockstate1 = iblockstate;
if (worldborder.contains(blockpos$mutableblockpos) || !flag1)
{
iblockstate1 = this.getBlockState(blockpos$mutableblockpos);
}
iblockstate1.getBlock().addCollisionBoxesToList(this, blockpos$mutableblockpos, iblockstate1, bb, list, entityIn);
}
}
}
}
double d0 = 0.25D;
List<Entity> list1 = this.getEntitiesWithinAABBExcludingEntity(entityIn, bb.expand(d0, d0, d0));
for (int j2 = 0; j2 < list1.size(); ++j2)
{
if (entityIn.riddenByEntity != list1 && entityIn.ridingEntity != list1)
{
AxisAlignedBB axisalignedbb = ((Entity)list1.get(j2)).getCollisionBoundingBox();
if (axisalignedbb != null && axisalignedbb.intersectsWith(bb))
{
list.add(axisalignedbb);
}
axisalignedbb = entityIn.getCollisionBox((Entity)list1.get(j2));
if (axisalignedbb != null && axisalignedbb.intersectsWith(bb))
{
list.add(axisalignedbb);
}
}
}
return list;
}
示例12: func_176170_a
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public static int func_176170_a(IBlockAccess blockaccessIn, Entity entityIn, int x, int y, int z, int sizeX, int sizeY, int sizeZ, boolean avoidWater, boolean breakDoors, boolean enterDoors)
{
boolean flag = false;
BlockPos blockpos = new BlockPos(entityIn);
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
for (int i = x; i < x + sizeX; ++i)
{
for (int j = y; j < y + sizeY; ++j)
{
for (int k = z; k < z + sizeZ; ++k)
{
blockpos$mutableblockpos.func_181079_c(i, j, k);
Block block = blockaccessIn.getBlockState(blockpos$mutableblockpos).getBlock();
if (block.getMaterial() != Material.air)
{
if (block != Blocks.trapdoor && block != Blocks.iron_trapdoor)
{
if (block != Blocks.flowing_water && block != Blocks.water)
{
if (!enterDoors && block instanceof BlockDoor && block.getMaterial() == Material.wood)
{
return 0;
}
}
else
{
if (avoidWater)
{
return -1;
}
flag = true;
}
}
else
{
flag = true;
}
if (entityIn.worldObj.getBlockState(blockpos$mutableblockpos).getBlock() instanceof BlockRailBase)
{
if (!(entityIn.worldObj.getBlockState(blockpos).getBlock() instanceof BlockRailBase) && !(entityIn.worldObj.getBlockState(blockpos.down()).getBlock() instanceof BlockRailBase))
{
return -3;
}
}
else if (!block.isPassable(blockaccessIn, blockpos$mutableblockpos) && (!breakDoors || !(block instanceof BlockDoor) || block.getMaterial() != Material.wood))
{
if (block instanceof BlockFence || block instanceof BlockFenceGate || block instanceof BlockWall)
{
return -3;
}
if (block == Blocks.trapdoor || block == Blocks.iron_trapdoor)
{
return -4;
}
Material material = block.getMaterial();
if (material != Material.lava)
{
return 0;
}
if (!entityIn.isInLava())
{
return -2;
}
}
}
}
}
}
return flag ? 2 : 1;
}
示例13: isAABBInMaterial
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
/**
* checks if the given AABB is in the material given. Used while swimming.
*/
public boolean isAABBInMaterial(AxisAlignedBB bb, Material materialIn)
{
int i = MathHelper.floor_double(bb.minX);
int j = MathHelper.floor_double(bb.maxX + 1.0D);
int k = MathHelper.floor_double(bb.minY);
int l = MathHelper.floor_double(bb.maxY + 1.0D);
int i1 = MathHelper.floor_double(bb.minZ);
int j1 = MathHelper.floor_double(bb.maxZ + 1.0D);
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
for (int k1 = i; k1 < j; ++k1)
{
for (int l1 = k; l1 < l; ++l1)
{
for (int i2 = i1; i2 < j1; ++i2)
{
IBlockState iblockstate = this.getBlockState(blockpos$mutableblockpos.func_181079_c(k1, l1, i2));
Block block = iblockstate.getBlock();
if (block.getMaterial() == materialIn)
{
int j2 = ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue();
double d0 = (double)(l1 + 1);
if (j2 < 8)
{
d0 = (double)(l1 + 1) - (double)j2 / 8.0D;
}
if (d0 >= bb.minY)
{
return true;
}
}
}
}
}
return false;
}
示例14: generate
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public boolean generate(World worldIn, Random rand, BlockPos position)
{
if (worldIn.isAirBlock(position) && worldIn.getBlockState(position.down()).getBlock() == this.baseBlockRequired)
{
int i = rand.nextInt(32) + 6;
int j = rand.nextInt(4) + 1;
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
for (int k = position.getX() - j; k <= position.getX() + j; ++k)
{
for (int l = position.getZ() - j; l <= position.getZ() + j; ++l)
{
int i1 = k - position.getX();
int j1 = l - position.getZ();
if (i1 * i1 + j1 * j1 <= j * j + 1 && worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(k, position.getY() - 1, l)).getBlock() != this.baseBlockRequired)
{
return false;
}
}
}
for (int l1 = position.getY(); l1 < position.getY() + i && l1 < 256; ++l1)
{
for (int i2 = position.getX() - j; i2 <= position.getX() + j; ++i2)
{
for (int j2 = position.getZ() - j; j2 <= position.getZ() + j; ++j2)
{
int k2 = i2 - position.getX();
int k1 = j2 - position.getZ();
if (k2 * k2 + k1 * k1 <= j * j + 1)
{
worldIn.setBlockState(new BlockPos(i2, l1, j2), Blocks.obsidian.getDefaultState(), 2);
}
}
}
}
Entity entity = new EntityEnderCrystal(worldIn);
entity.setLocationAndAngles((double)((float)position.getX() + 0.5F), (double)(position.getY() + i), (double)((float)position.getZ() + 0.5F), rand.nextFloat() * 360.0F, 0.0F);
worldIn.spawnEntityInWorld(entity);
worldIn.setBlockState(position.up(i), Blocks.bedrock.getDefaultState(), 2);
return true;
}
else
{
return false;
}
}
示例15: isLiquidInStructureBoundingBox
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
/**
* checks the entire StructureBoundingBox for Liquids
*/
protected boolean isLiquidInStructureBoundingBox(World worldIn, StructureBoundingBox boundingboxIn)
{
int i = Math.max(this.boundingBox.minX - 1, boundingboxIn.minX);
int j = Math.max(this.boundingBox.minY - 1, boundingboxIn.minY);
int k = Math.max(this.boundingBox.minZ - 1, boundingboxIn.minZ);
int l = Math.min(this.boundingBox.maxX + 1, boundingboxIn.maxX);
int i1 = Math.min(this.boundingBox.maxY + 1, boundingboxIn.maxY);
int j1 = Math.min(this.boundingBox.maxZ + 1, boundingboxIn.maxZ);
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
for (int k1 = i; k1 <= l; ++k1)
{
for (int l1 = k; l1 <= j1; ++l1)
{
if (worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(k1, j, l1)).getBlock().getMaterial().isLiquid())
{
return true;
}
if (worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(k1, i1, l1)).getBlock().getMaterial().isLiquid())
{
return true;
}
}
}
for (int i2 = i; i2 <= l; ++i2)
{
for (int k2 = j; k2 <= i1; ++k2)
{
if (worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(i2, k2, k)).getBlock().getMaterial().isLiquid())
{
return true;
}
if (worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(i2, k2, j1)).getBlock().getMaterial().isLiquid())
{
return true;
}
}
}
for (int j2 = k; j2 <= j1; ++j2)
{
for (int l2 = j; l2 <= i1; ++l2)
{
if (worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(i, l2, j2)).getBlock().getMaterial().isLiquid())
{
return true;
}
if (worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(l, l2, j2)).getBlock().getMaterial().isLiquid())
{
return true;
}
}
}
return false;
}