本文整理汇总了Java中net.minecraft.util.math.MathHelper.ceiling_double_int方法的典型用法代码示例。如果您正苦于以下问题:Java MathHelper.ceiling_double_int方法的具体用法?Java MathHelper.ceiling_double_int怎么用?Java MathHelper.ceiling_double_int使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.util.math.MathHelper
的用法示例。
在下文中一共展示了MathHelper.ceiling_double_int方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderAir
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
protected void renderAir(int width, int height)
{
if (pre(AIR)) return;
mc.mcProfiler.startSection("air");
EntityPlayer player = (EntityPlayer)this.mc.getRenderViewEntity();
GlStateManager.enableBlend();
int left = width / 2 + 91;
int top = height - right_height;
if (player.isInsideOfMaterial(Material.WATER))
{
int air = player.getAir();
int full = MathHelper.ceiling_double_int((double)(air - 2) * 10.0D / 300.0D);
int partial = MathHelper.ceiling_double_int((double)air * 10.0D / 300.0D) - full;
for (int i = 0; i < full + partial; ++i)
{
drawTexturedModalRect(left - i * 8 - 9, top, (i < full ? 16 : 25), 18, 9, 9);
}
right_height += 10;
}
GlStateManager.disableBlend();
mc.mcProfiler.endSection();
post(AIR);
}
示例2: getEntitiesWithinAABB
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
public <T extends Entity> List<T> getEntitiesWithinAABB(Class <? extends T > clazz, AxisAlignedBB aabb, @Nullable Predicate <? super T > filter)
{
int i = MathHelper.floor_double((aabb.minX - MAX_ENTITY_RADIUS) / 16.0D);
int j = MathHelper.ceiling_double_int((aabb.maxX + MAX_ENTITY_RADIUS) / 16.0D);
int k = MathHelper.floor_double((aabb.minZ - MAX_ENTITY_RADIUS) / 16.0D);
int l = MathHelper.ceiling_double_int((aabb.maxZ + MAX_ENTITY_RADIUS) / 16.0D);
List<T> list = Lists.<T>newArrayList();
for (int i1 = i; i1 < j; ++i1)
{
for (int j1 = k; j1 < l; ++j1)
{
if (this.isChunkLoaded(i1, j1, true))
{
this.getChunkFromChunkCoords(i1, j1).getEntitiesOfTypeWithinAAAB(clazz, aabb, list, filter);
}
}
}
return list;
}
示例3: checkBlockCollision
import net.minecraft.util.math.MathHelper; //导入方法依赖的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.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() != Material.AIR)
{
blockpos$pooledmutableblockpos.release();
return true;
}
}
}
}
blockpos$pooledmutableblockpos.release();
return false;
}
示例4: containsAnyLiquid
import net.minecraft.util.math.MathHelper; //导入方法依赖的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;
}
示例5: isFlammableWithin
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
public boolean isFlammableWithin(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);
if (this.isAreaLoaded(i, k, i1, j, l, j1, true))
{
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)
{
Block block = this.getBlockState(blockpos$pooledmutableblockpos.setPos(k1, l1, i2)).getBlock();
if (block == Blocks.FIRE || block == Blocks.FLOWING_LAVA || block == Blocks.LAVA)
{
blockpos$pooledmutableblockpos.release();
return true;
}
else if (block.isBurning(this, new BlockPos(k1, l1, i2)))
{
return true;
}
}
}
}
blockpos$pooledmutableblockpos.release();
}
return false;
}
示例6: isMaterialInBB
import net.minecraft.util.math.MathHelper; //导入方法依赖的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.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)
{
if (this.getBlockState(blockpos$pooledmutableblockpos.setPos(k1, l1, i2)).getMaterial() == materialIn)
{
blockpos$pooledmutableblockpos.release();
return true;
}
}
}
}
blockpos$pooledmutableblockpos.release();
return false;
}
示例7: ScaledResolution
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
public ScaledResolution(Minecraft minecraftClient)
{
this.scaledWidth = minecraftClient.displayWidth;
this.scaledHeight = minecraftClient.displayHeight;
this.scaleFactor = 1;
boolean flag = minecraftClient.isUnicode();
int i = minecraftClient.gameSettings.guiScale;
if (i == 0)
{
i = 1000;
}
while (this.scaleFactor < i && this.scaledWidth / (this.scaleFactor + 1) >= 320 && this.scaledHeight / (this.scaleFactor + 1) >= 240)
{
++this.scaleFactor;
}
if (flag && this.scaleFactor % 2 != 0 && this.scaleFactor != 1)
{
--this.scaleFactor;
}
this.scaledWidthD = (double)this.scaledWidth / (double)this.scaleFactor;
this.scaledHeightD = (double)this.scaledHeight / (double)this.scaleFactor;
this.scaledWidth = MathHelper.ceiling_double_int(this.scaledWidthD);
this.scaledHeight = MathHelper.ceiling_double_int(this.scaledHeightD);
}
示例8: getCollisionBoxes
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
public List<AxisAlignedBB> getCollisionBoxes(AxisAlignedBB bb)
{
List<AxisAlignedBB> list = Lists.<AxisAlignedBB>newArrayList();
int i = MathHelper.floor_double(bb.minX) - 1;
int j = MathHelper.ceiling_double_int(bb.maxX) + 1;
int k = MathHelper.floor_double(bb.minY) - 1;
int l = MathHelper.ceiling_double_int(bb.maxY) + 1;
int i1 = MathHelper.floor_double(bb.minZ) - 1;
int j1 = MathHelper.ceiling_double_int(bb.maxZ) + 1;
BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();
for (int k1 = i; k1 < j; ++k1)
{
for (int l1 = i1; l1 < j1; ++l1)
{
int i2 = (k1 != i && k1 != j - 1 ? 0 : 1) + (l1 != i1 && l1 != j1 - 1 ? 0 : 1);
if (i2 != 2 && this.isBlockLoaded(blockpos$pooledmutableblockpos.setPos(k1, 64, l1)))
{
for (int j2 = k; j2 < l; ++j2)
{
if (i2 <= 0 || j2 != k && j2 != l - 1)
{
blockpos$pooledmutableblockpos.setPos(k1, j2, l1);
IBlockState iblockstate;
if (k1 >= -30000000 && k1 < 30000000 && l1 >= -30000000 && l1 < 30000000)
{
iblockstate = this.getBlockState(blockpos$pooledmutableblockpos);
}
else
{
iblockstate = Blocks.BEDROCK.getDefaultState();
}
iblockstate.addCollisionBoxToList(this, blockpos$pooledmutableblockpos, bb, list, (Entity)null);
}
}
}
}
}
blockpos$pooledmutableblockpos.release();
return list;
}
示例9: collidesWithAnyBlock
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
/**
* Returns true if the given bbox collides with any block.
*/
public boolean collidesWithAnyBlock(AxisAlignedBB bbox)
{
List<AxisAlignedBB> list = Lists.<AxisAlignedBB>newArrayList();
int i = MathHelper.floor_double(bbox.minX) - 1;
int j = MathHelper.ceiling_double_int(bbox.maxX) + 1;
int k = MathHelper.floor_double(bbox.minY) - 1;
int l = MathHelper.ceiling_double_int(bbox.maxY) + 1;
int i1 = MathHelper.floor_double(bbox.minZ) - 1;
int j1 = MathHelper.ceiling_double_int(bbox.maxZ) + 1;
BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();
try
{
for (int k1 = i; k1 < j; ++k1)
{
for (int l1 = i1; l1 < j1; ++l1)
{
int i2 = (k1 != i && k1 != j - 1 ? 0 : 1) + (l1 != i1 && l1 != j1 - 1 ? 0 : 1);
if (i2 != 2 && this.isBlockLoaded(blockpos$pooledmutableblockpos.setPos(k1, 64, l1)))
{
for (int j2 = k; j2 < l; ++j2)
{
if (i2 <= 0 || j2 != k && j2 != l - 1)
{
blockpos$pooledmutableblockpos.setPos(k1, j2, l1);
if (k1 < -30000000 || k1 >= 30000000 || l1 < -30000000 || l1 >= 30000000)
{
boolean flag1 = true;
return flag1;
}
IBlockState iblockstate = this.getBlockState(blockpos$pooledmutableblockpos);
iblockstate.addCollisionBoxToList(this, blockpos$pooledmutableblockpos, bbox, list, (Entity)null);
if (!list.isEmpty())
{
boolean flag = true;
return flag;
}
}
}
}
}
}
return false;
}
finally
{
blockpos$pooledmutableblockpos.release();
}
}
示例10: handleMaterialAcceleration
import net.minecraft.util.math.MathHelper; //导入方法依赖的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.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);
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();
Boolean result = block.isEntityInsideMaterial(this, blockpos$pooledmutableblockpos, iblockstate, entityIn, (double)l, materialIn, false);
if (result != null && result == true)
{
// Forge: When requested call blocks modifyAcceleration method, and more importantly cause this method to return true, which results in an entity being "inWater"
flag = true;
vec3d = block.modifyAcceleration(this, blockpos$pooledmutableblockpos, entityIn, vec3d);
continue;
}
else if (result != null && result == false) continue;
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;
}
}
示例11: isAABBInMaterial
import net.minecraft.util.math.MathHelper; //导入方法依赖的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;
}
示例12: getWaterLevelAbove
import net.minecraft.util.math.MathHelper; //导入方法依赖的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();
}
}
示例13: getBoatGlide
import net.minecraft.util.math.MathHelper; //导入方法依赖的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_double(axisalignedbb1.minX) - 1;
int j = MathHelper.ceiling_double_int(axisalignedbb1.maxX) + 1;
int k = MathHelper.floor_double(axisalignedbb1.minY) - 1;
int l = MathHelper.ceiling_double_int(axisalignedbb1.maxY) + 1;
int i1 = MathHelper.floor_double(axisalignedbb1.minZ) - 1;
int j1 = MathHelper.ceiling_double_int(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.worldObj.getBlockState(blockpos$pooledmutableblockpos);
iblockstate.addCollisionBoxToList(this.worldObj, blockpos$pooledmutableblockpos, axisalignedbb1, list, this);
if (!list.isEmpty())
{
f += iblockstate.getBlock().slipperiness;
++k1;
}
list.clear();
}
}
}
}
}
}
finally
{
blockpos$pooledmutableblockpos.release();
}
return f / (float)k1;
}
示例14: checkInWater
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
private boolean checkInWater()
{
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.minY);
int l = MathHelper.ceiling_double_int(axisalignedbb.minY + 0.001D);
int i1 = MathHelper.floor_double(axisalignedbb.minZ);
int j1 = MathHelper.ceiling_double_int(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.worldObj.getBlockState(blockpos$pooledmutableblockpos);
if (iblockstate.getMaterial() == Material.WATER)
{
float f = getLiquidHeight(iblockstate, this.worldObj, blockpos$pooledmutableblockpos);
this.waterLevel = Math.max((double)f, this.waterLevel);
flag |= axisalignedbb.minY < (double)f;
}
}
}
}
}
finally
{
blockpos$pooledmutableblockpos.release();
}
return flag;
}
示例15: getUnderwaterStatus
import net.minecraft.util.math.MathHelper; //导入方法依赖的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;
}