本文整理汇总了Java中net.minecraft.util.math.BlockPos.PooledMutableBlockPos方法的典型用法代码示例。如果您正苦于以下问题:Java BlockPos.PooledMutableBlockPos方法的具体用法?Java BlockPos.PooledMutableBlockPos怎么用?Java BlockPos.PooledMutableBlockPos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.util.math.BlockPos
的用法示例。
在下文中一共展示了BlockPos.PooledMutableBlockPos方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: willSuffocateHere
import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
private static boolean willSuffocateHere(World world, double posX, double posY, double posZ, float width, float eyeHeight) {
BlockPos.PooledMutableBlockPos mutableBlockPos = BlockPos.PooledMutableBlockPos.retain();
for (int i = 0; i < 8; ++i) {
int x = MathHelper.floor(posX + ((((i >> 1) % 2) - 0.5F) * width * 0.8F));
int y = MathHelper.floor(posY + ((((i >> 0) % 2) - 0.5F) * 0.1F) + eyeHeight);
int z = MathHelper.floor(posZ + ((((i >> 2) % 2) - 0.5F) * width * 0.8F));
if (mutableBlockPos.getX() != x || mutableBlockPos.getY() != y || mutableBlockPos.getZ() != z) {
mutableBlockPos.setPos(x, y, z);
if (world.getBlockState(mutableBlockPos).causesSuffocation()) {
mutableBlockPos.release();
return true;
}
}
}
mutableBlockPos.release();
return false;
}
示例2: isWet
import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
/**
* Checks if this entity is either in water or on an open air block in rain (used in wolves).
*/
public boolean isWet()
{
if (this.inWater)
{
return true;
}
else
{
BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain(this.posX, this.posY, this.posZ);
if (!this.worldObj.isRainingAt(blockpos$pooledmutableblockpos) && !this.worldObj.isRainingAt(blockpos$pooledmutableblockpos.setPos(this.posX, this.posY + (double)this.height, this.posZ)))
{
blockpos$pooledmutableblockpos.release();
return false;
}
else
{
blockpos$pooledmutableblockpos.release();
return true;
}
}
}
示例3: checkBlockCollision
import net.minecraft.util.math.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(bb.minX);
int j = MathHelper.ceil(bb.maxX);
int k = MathHelper.floor(bb.minY);
int l = MathHelper.ceil(bb.maxY);
int i1 = MathHelper.floor(bb.minZ);
int j1 = MathHelper.ceil(bb.maxZ);
BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();
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$pooledmutableblockpos.setPos(k1, l1, i2));
if (iblockstate.getMaterial() != Material.AIR)
{
blockpos$pooledmutableblockpos.release();
return true;
}
}
}
}
blockpos$pooledmutableblockpos.release();
return false;
}
示例4: containsAnyLiquid
import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
/**
* Checks if any of the blocks within the aabb are liquids.
*/
public boolean containsAnyLiquid(AxisAlignedBB bb)
{
int i = MathHelper.floor(bb.minX);
int j = MathHelper.ceil(bb.maxX);
int k = MathHelper.floor(bb.minY);
int l = MathHelper.ceil(bb.maxY);
int i1 = MathHelper.floor(bb.minZ);
int j1 = MathHelper.ceil(bb.maxZ);
BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();
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$pooledmutableblockpos.setPos(k1, l1, i2));
if (iblockstate.getMaterial().isLiquid())
{
blockpos$pooledmutableblockpos.release();
return true;
}
}
}
}
blockpos$pooledmutableblockpos.release();
return false;
}
示例5: isMaterialInBB
import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
/**
* Returns true if the given bounding box contains the given material
*/
public boolean isMaterialInBB(AxisAlignedBB bb, Material materialIn)
{
int i = MathHelper.floor(bb.minX);
int j = MathHelper.ceil(bb.maxX);
int k = MathHelper.floor(bb.minY);
int l = MathHelper.ceil(bb.maxY);
int i1 = MathHelper.floor(bb.minZ);
int j1 = MathHelper.ceil(bb.maxZ);
BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();
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$pooledmutableblockpos.setPos(k1, l1, i2)).getMaterial() == materialIn)
{
blockpos$pooledmutableblockpos.release();
return true;
}
}
}
}
blockpos$pooledmutableblockpos.release();
return false;
}
示例6: containsAnyLiquid
import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
/**
* Checks if any of the blocks within the aabb are liquids.
*/
public boolean containsAnyLiquid(AxisAlignedBB bb)
{
int i = MathHelper.floor_double(bb.minX);
int j = MathHelper.ceiling_double_int(bb.maxX);
int k = MathHelper.floor_double(bb.minY);
int l = MathHelper.ceiling_double_int(bb.maxY);
int i1 = MathHelper.floor_double(bb.minZ);
int j1 = MathHelper.ceiling_double_int(bb.maxZ);
BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();
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$pooledmutableblockpos.setPos(k1, l1, i2));
if (iblockstate.getMaterial().isLiquid())
{
blockpos$pooledmutableblockpos.release();
return true;
}
}
}
}
blockpos$pooledmutableblockpos.release();
return false;
}
示例7: doBlockCollisions
import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
protected void doBlockCollisions()
{
AxisAlignedBB axisalignedbb = this.getEntityBoundingBox();
BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain(axisalignedbb.minX + 0.001D, axisalignedbb.minY + 0.001D, axisalignedbb.minZ + 0.001D);
BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos1 = BlockPos.PooledMutableBlockPos.retain(axisalignedbb.maxX - 0.001D, axisalignedbb.maxY - 0.001D, axisalignedbb.maxZ - 0.001D);
BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos2 = BlockPos.PooledMutableBlockPos.retain();
if (this.worldObj.isAreaLoaded(blockpos$pooledmutableblockpos, blockpos$pooledmutableblockpos1))
{
for (int i = blockpos$pooledmutableblockpos.getX(); i <= blockpos$pooledmutableblockpos1.getX(); ++i)
{
for (int j = blockpos$pooledmutableblockpos.getY(); j <= blockpos$pooledmutableblockpos1.getY(); ++j)
{
for (int k = blockpos$pooledmutableblockpos.getZ(); k <= blockpos$pooledmutableblockpos1.getZ(); ++k)
{
blockpos$pooledmutableblockpos2.setPos(i, j, k);
IBlockState iblockstate = this.worldObj.getBlockState(blockpos$pooledmutableblockpos2);
try
{
iblockstate.getBlock().onEntityCollidedWithBlock(this.worldObj, blockpos$pooledmutableblockpos2, iblockstate, this);
}
catch (Throwable throwable)
{
CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Colliding entity with block");
CrashReportCategory crashreportcategory = crashreport.makeCategory("Block being collided with");
CrashReportCategory.addBlockInfo(crashreportcategory, blockpos$pooledmutableblockpos2, iblockstate);
throw new ReportedException(crashreport);
}
}
}
}
}
blockpos$pooledmutableblockpos.release();
blockpos$pooledmutableblockpos1.release();
blockpos$pooledmutableblockpos2.release();
}
示例8: isEntityInsideOpaqueBlock
import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
/**
* Checks if this entity is inside of an opaque block
*/
public boolean isEntityInsideOpaqueBlock()
{
if (this.noClip)
{
return false;
}
else
{
BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();
for (int i = 0; i < 8; ++i)
{
int j = MathHelper.floor_double(this.posY + (double)(((float)((i >> 0) % 2) - 0.5F) * 0.1F) + (double)this.getEyeHeight());
int k = MathHelper.floor_double(this.posX + (double)(((float)((i >> 1) % 2) - 0.5F) * this.width * 0.8F));
int l = MathHelper.floor_double(this.posZ + (double)(((float)((i >> 2) % 2) - 0.5F) * this.width * 0.8F));
if (blockpos$pooledmutableblockpos.getX() != k || blockpos$pooledmutableblockpos.getY() != j || blockpos$pooledmutableblockpos.getZ() != l)
{
blockpos$pooledmutableblockpos.setPos(k, j, l);
if (this.worldObj.getBlockState(blockpos$pooledmutableblockpos).getBlock().isVisuallyOpaque())
{
blockpos$pooledmutableblockpos.release();
return true;
}
}
}
blockpos$pooledmutableblockpos.release();
return false;
}
}
示例9: getFlow
import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
protected Vec3d getFlow(IBlockAccess p_189543_1_, BlockPos p_189543_2_, IBlockState p_189543_3_)
{
double d0 = 0.0D;
double d1 = 0.0D;
double d2 = 0.0D;
int i = this.getRenderedDepth(p_189543_3_);
BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
{
blockpos$pooledmutableblockpos.setPos(p_189543_2_).move(enumfacing);
int j = this.getRenderedDepth(p_189543_1_.getBlockState(blockpos$pooledmutableblockpos));
if (j < 0)
{
if (!p_189543_1_.getBlockState(blockpos$pooledmutableblockpos).getMaterial().blocksMovement())
{
j = this.getRenderedDepth(p_189543_1_.getBlockState(blockpos$pooledmutableblockpos.down()));
if (j >= 0)
{
int k = j - (i - 8);
d0 += (double)(enumfacing.getFrontOffsetX() * k);
d1 += (double)(enumfacing.getFrontOffsetY() * k);
d2 += (double)(enumfacing.getFrontOffsetZ() * k);
}
}
}
else if (j >= 0)
{
int l = j - i;
d0 += (double)(enumfacing.getFrontOffsetX() * l);
d1 += (double)(enumfacing.getFrontOffsetY() * l);
d2 += (double)(enumfacing.getFrontOffsetZ() * l);
}
}
Vec3d vec3d = new Vec3d(d0, d1, d2);
if (((Integer)p_189543_3_.getValue(LEVEL)).intValue() >= 8)
{
for (EnumFacing enumfacing1 : EnumFacing.Plane.HORIZONTAL)
{
blockpos$pooledmutableblockpos.setPos(p_189543_2_).move(enumfacing1);
if (this.isBlockSolid(p_189543_1_, blockpos$pooledmutableblockpos, enumfacing1) || this.isBlockSolid(p_189543_1_, blockpos$pooledmutableblockpos.up(), enumfacing1))
{
vec3d = vec3d.normalize().addVector(0.0D, -6.0D, 0.0D);
break;
}
}
}
blockpos$pooledmutableblockpos.release();
return vec3d.normalize();
}
示例10: getWaterLevelAbove
import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
public float getWaterLevelAbove()
{
AxisAlignedBB axisalignedbb = this.getEntityBoundingBox();
int i = MathHelper.floor_double(axisalignedbb.minX);
int j = MathHelper.ceiling_double_int(axisalignedbb.maxX);
int k = MathHelper.floor_double(axisalignedbb.maxY);
int l = MathHelper.ceiling_double_int(axisalignedbb.maxY - this.lastYd);
int i1 = MathHelper.floor_double(axisalignedbb.minZ);
int j1 = MathHelper.ceiling_double_int(axisalignedbb.maxZ);
BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();
try
{
label78:
for (int k1 = k; k1 < l; ++k1)
{
float f = 0.0F;
int l1 = i;
while (true)
{
if (l1 >= j)
{
if (f < 1.0F)
{
float f2 = (float)blockpos$pooledmutableblockpos.getY() + f;
return f2;
}
break;
}
for (int i2 = i1; i2 < j1; ++i2)
{
blockpos$pooledmutableblockpos.setPos(l1, k1, i2);
IBlockState iblockstate = this.worldObj.getBlockState(blockpos$pooledmutableblockpos);
if (iblockstate.getMaterial() == Material.WATER)
{
f = Math.max(f, getBlockLiquidHeight(iblockstate, this.worldObj, blockpos$pooledmutableblockpos));
}
if (f >= 1.0F)
{
continue label78;
}
}
++l1;
}
}
float f1 = (float)(l + 1);
return f1;
}
finally
{
blockpos$pooledmutableblockpos.release();
}
}
示例11: handleMaterialAcceleration
import net.minecraft.util.math.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(bb.minX);
int j = MathHelper.ceil(bb.maxX);
int k = MathHelper.floor(bb.minY);
int l = MathHelper.ceil(bb.maxY);
int i1 = MathHelper.floor(bb.minZ);
int j1 = MathHelper.ceil(bb.maxZ);
if (!this.isAreaLoaded(i, k, i1, j, l, j1, true))
{
return false;
}
else
{
boolean flag = false;
Vec3d vec3d = Vec3d.ZERO;
BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();
for (int k1 = i; k1 < j; ++k1)
{
for (int l1 = k; l1 < l; ++l1)
{
for (int i2 = i1; i2 < j1; ++i2)
{
blockpos$pooledmutableblockpos.setPos(k1, l1, i2);
IBlockState iblockstate = this.getBlockState(blockpos$pooledmutableblockpos);
Block block = iblockstate.getBlock();
if (iblockstate.getMaterial() == materialIn)
{
double d0 = (double)((float)(l1 + 1) - BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue()));
if ((double)l >= d0)
{
flag = true;
vec3d = block.modifyAcceleration(this, blockpos$pooledmutableblockpos, entityIn, vec3d);
}
}
}
}
}
blockpos$pooledmutableblockpos.release();
if (vec3d.lengthVector() > 0.0D && entityIn.isPushedByWater())
{
vec3d = vec3d.normalize();
double d1 = 0.014D;
entityIn.motionX += vec3d.xCoord * 0.014D;
entityIn.motionY += vec3d.yCoord * 0.014D;
entityIn.motionZ += vec3d.zCoord * 0.014D;
}
return flag;
}
}
示例12: getBoatGlide
import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
/**
* Decides how much the boat should be gliding on the land (based on any slippery blocks)
*/
public float getBoatGlide()
{
AxisAlignedBB axisalignedbb = this.getEntityBoundingBox();
AxisAlignedBB axisalignedbb1 = new AxisAlignedBB(axisalignedbb.minX, axisalignedbb.minY - 0.001D, axisalignedbb.minZ, axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ);
int i = MathHelper.floor(axisalignedbb1.minX) - 1;
int j = MathHelper.ceil(axisalignedbb1.maxX) + 1;
int k = MathHelper.floor(axisalignedbb1.minY) - 1;
int l = MathHelper.ceil(axisalignedbb1.maxY) + 1;
int i1 = MathHelper.floor(axisalignedbb1.minZ) - 1;
int j1 = MathHelper.ceil(axisalignedbb1.maxZ) + 1;
List<AxisAlignedBB> list = Lists.<AxisAlignedBB>newArrayList();
float f = 0.0F;
int k1 = 0;
BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();
try
{
for (int l1 = i; l1 < j; ++l1)
{
for (int i2 = i1; i2 < j1; ++i2)
{
int j2 = (l1 != i && l1 != j - 1 ? 0 : 1) + (i2 != i1 && i2 != j1 - 1 ? 0 : 1);
if (j2 != 2)
{
for (int k2 = k; k2 < l; ++k2)
{
if (j2 <= 0 || k2 != k && k2 != l - 1)
{
blockpos$pooledmutableblockpos.setPos(l1, k2, i2);
IBlockState iblockstate = this.world.getBlockState(blockpos$pooledmutableblockpos);
iblockstate.addCollisionBoxToList(this.world, blockpos$pooledmutableblockpos, axisalignedbb1, list, this, false);
if (!list.isEmpty())
{
f += iblockstate.getBlock().slipperiness;
++k1;
}
list.clear();
}
}
}
}
}
}
finally
{
blockpos$pooledmutableblockpos.release();
}
return f / (float)k1;
}
示例13: checkInWater
import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
private boolean checkInWater()
{
AxisAlignedBB axisalignedbb = this.getEntityBoundingBox();
int i = MathHelper.floor(axisalignedbb.minX);
int j = MathHelper.ceil(axisalignedbb.maxX);
int k = MathHelper.floor(axisalignedbb.minY);
int l = MathHelper.ceil(axisalignedbb.minY + 0.001D);
int i1 = MathHelper.floor(axisalignedbb.minZ);
int j1 = MathHelper.ceil(axisalignedbb.maxZ);
boolean flag = false;
this.waterLevel = Double.MIN_VALUE;
BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();
try
{
for (int k1 = i; k1 < j; ++k1)
{
for (int l1 = k; l1 < l; ++l1)
{
for (int i2 = i1; i2 < j1; ++i2)
{
blockpos$pooledmutableblockpos.setPos(k1, l1, i2);
IBlockState iblockstate = this.world.getBlockState(blockpos$pooledmutableblockpos);
if (iblockstate.getMaterial() == Material.WATER)
{
float f = BlockLiquid.func_190972_g(iblockstate, this.world, blockpos$pooledmutableblockpos);
this.waterLevel = Math.max((double)f, this.waterLevel);
flag |= axisalignedbb.minY < (double)f;
}
}
}
}
}
finally
{
blockpos$pooledmutableblockpos.release();
}
return flag;
}
示例14: isAABBInMaterial
import net.minecraft.util.math.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.ceiling_double_int(bb.maxX);
int k = MathHelper.floor_double(bb.minY);
int l = MathHelper.ceiling_double_int(bb.maxY);
int i1 = MathHelper.floor_double(bb.minZ);
int j1 = MathHelper.ceiling_double_int(bb.maxZ);
BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();
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$pooledmutableblockpos.setPos(k1, l1, i2));
Boolean result = iblockstate.getBlock().isAABBInsideMaterial(this, blockpos$pooledmutableblockpos, bb, materialIn);
if (result != null) return result;
if (iblockstate.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)
{
blockpos$pooledmutableblockpos.release();
return true;
}
}
}
}
}
blockpos$pooledmutableblockpos.release();
return false;
}
示例15: getUnderwaterStatus
import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
/**
* Decides whether the boat is currently underwater.
*/
@Nullable
private EntityBoat.Status getUnderwaterStatus()
{
AxisAlignedBB axisalignedbb = this.getEntityBoundingBox();
double d0 = axisalignedbb.maxY + 0.001D;
int i = MathHelper.floor_double(axisalignedbb.minX);
int j = MathHelper.ceiling_double_int(axisalignedbb.maxX);
int k = MathHelper.floor_double(axisalignedbb.maxY);
int l = MathHelper.ceiling_double_int(d0);
int i1 = MathHelper.floor_double(axisalignedbb.minZ);
int j1 = MathHelper.ceiling_double_int(axisalignedbb.maxZ);
boolean flag = false;
BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();
try
{
for (int k1 = i; k1 < j; ++k1)
{
for (int l1 = k; l1 < l; ++l1)
{
for (int i2 = i1; i2 < j1; ++i2)
{
blockpos$pooledmutableblockpos.setPos(k1, l1, i2);
IBlockState iblockstate = this.worldObj.getBlockState(blockpos$pooledmutableblockpos);
if (iblockstate.getMaterial() == Material.WATER && d0 < (double)getLiquidHeight(iblockstate, this.worldObj, blockpos$pooledmutableblockpos))
{
if (((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() != 0)
{
EntityBoat.Status entityboat$status = EntityBoat.Status.UNDER_FLOWING_WATER;
return entityboat$status;
}
flag = true;
}
}
}
}
}
finally
{
blockpos$pooledmutableblockpos.release();
}
return flag ? EntityBoat.Status.UNDER_WATER : null;
}