本文整理汇总了Java中net.minecraft.util.MathHelper.floor_double方法的典型用法代码示例。如果您正苦于以下问题:Java MathHelper.floor_double方法的具体用法?Java MathHelper.floor_double怎么用?Java MathHelper.floor_double使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.util.MathHelper
的用法示例。
在下文中一共展示了MathHelper.floor_double方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPathPointTo
import net.minecraft.util.MathHelper; //导入方法依赖的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: getEntitiesOfTypeWithinAAAB
import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public <T extends Entity> void getEntitiesOfTypeWithinAAAB(Class <? extends T > entityClass, AxisAlignedBB aabb, List<T> listToFill, Predicate <? super T > p_177430_4_)
{
int i = MathHelper.floor_double((aabb.minY - 2.0D) / 16.0D);
int j = MathHelper.floor_double((aabb.maxY + 2.0D) / 16.0D);
i = MathHelper.clamp_int(i, 0, this.entityLists.length - 1);
j = MathHelper.clamp_int(j, 0, this.entityLists.length - 1);
for (int k = i; k <= j; ++k)
{
for (T t : this.entityLists[k].getByClass(entityClass))
{
if (t.getEntityBoundingBox().intersectsWith(aabb) && (p_177430_4_ == null || p_177430_4_.apply(t)))
{
listToFill.add(t);
}
}
}
}
示例3: resetHeight
import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
/**
* sets the players height back to normal after doing things like sleeping and dieing
*/
protected void resetHeight()
{
float f = MathHelper.sqrt_double(this.motionX * this.motionX * 0.20000000298023224D + this.motionY * this.motionY + this.motionZ * this.motionZ * 0.20000000298023224D) * 0.2F;
if (f > 1.0F)
{
f = 1.0F;
}
this.playSound(this.getSplashSound(), f, 1.0F + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.4F);
float f1 = (float)MathHelper.floor_double(this.getEntityBoundingBox().minY);
for (int i = 0; (float)i < 1.0F + this.width * 20.0F; ++i)
{
float f2 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width;
float f3 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width;
this.worldObj.spawnParticle(EnumParticleTypes.WATER_BUBBLE, this.posX + (double)f2, (double)(f1 + 1.0F), this.posZ + (double)f3, this.motionX, this.motionY - (double)(this.rand.nextFloat() * 0.2F), this.motionZ, new int[0]);
}
for (int j = 0; (float)j < 1.0F + this.width * 20.0F; ++j)
{
float f4 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width;
float f5 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width;
this.worldObj.spawnParticle(EnumParticleTypes.WATER_SPLASH, this.posX + (double)f4, (double)(f1 + 1.0F), this.posZ + (double)f5, this.motionX, this.motionY, this.motionZ, new int[0]);
}
}
示例4: checkBoundingBoxSize
import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public static boolean checkBoundingBoxSize(Entity entity, AxisAlignedBB aabb)
{
if (entity instanceof EntityLivingBase && (!(entity instanceof IBossDisplayData) || !(entity instanceof IEntityMultiPart))
&& !(entity instanceof EntityPlayer))
{
int logSize = MinecraftServer.cauldronConfig.largeBoundingBoxLogSize.getValue();
if (logSize <= 0 || !MinecraftServer.cauldronConfig.checkEntityBoundingBoxes.getValue()) return false;
int x = MathHelper.floor_double(aabb.minX);
int x1 = MathHelper.floor_double(aabb.maxX + 1.0D);
int y = MathHelper.floor_double(aabb.minY);
int y1 = MathHelper.floor_double(aabb.maxY + 1.0D);
int z = MathHelper.floor_double(aabb.minZ);
int z1 = MathHelper.floor_double(aabb.maxZ + 1.0D);
int size = Math.abs(x1 - x) * Math.abs(y1 - y) * Math.abs(z1 - z);
if (size > MinecraftServer.cauldronConfig.largeBoundingBoxLogSize.getValue())
{
logWarning("Entity being removed for bounding box restrictions");
logWarning("BB Size: {0} > {1} avg edge: {2}", size, logSize, aabb.getAverageEdgeLength());
logWarning("Motion: ({0}, {1}, {2})", entity.motionX, entity.motionY, entity.motionZ);
logWarning("Calculated bounding box: {0}", aabb);
logWarning("Entity bounding box: {0}", entity.getBoundingBox());
logWarning("Entity: {0}", entity);
NBTTagCompound tag = new NBTTagCompound();
entity.writeToNBT(tag);
logWarning("Entity NBT: {0}", tag);
logStack();
entity.setDead();
return true;
}
}
return false;
}
示例5: S18PacketEntityTeleport
import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public S18PacketEntityTeleport(Entity entityIn)
{
this.entityId = entityIn.getEntityId();
this.posX = MathHelper.floor_double(entityIn.posX * 32.0D);
this.posY = MathHelper.floor_double(entityIn.posY * 32.0D);
this.posZ = MathHelper.floor_double(entityIn.posZ * 32.0D);
this.yaw = (byte)((int)(entityIn.rotationYaw * 256.0F / 360.0F));
this.pitch = (byte)((int)(entityIn.rotationPitch * 256.0F / 360.0F));
this.onGround = entityIn.onGround;
}
示例6: prepareChunkForSpawn
import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public boolean prepareChunkForSpawn()
{
int i = MathHelper.floor_double(this.posX);
int j = MathHelper.floor_double(this.posZ);
this.worldObj.getBiomeGenForCoords(new BlockPos(i, 0, j));
return true;
}
示例7: S2CPacketSpawnGlobalEntity
import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public S2CPacketSpawnGlobalEntity(Entity entityIn)
{
this.entityId = entityIn.getEntityId();
this.x = MathHelper.floor_double(entityIn.posX * 32.0D);
this.y = MathHelper.floor_double(entityIn.posY * 32.0D);
this.z = MathHelper.floor_double(entityIn.posZ * 32.0D);
if (entityIn instanceof EntityLightningBolt)
{
this.type = 1;
}
}
示例8: S11PacketSpawnExperienceOrb
import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public S11PacketSpawnExperienceOrb(EntityXPOrb xpOrb)
{
this.entityID = xpOrb.getEntityId();
this.posX = MathHelper.floor_double(xpOrb.posX * 32.0D);
this.posY = MathHelper.floor_double(xpOrb.posY * 32.0D);
this.posZ = MathHelper.floor_double(xpOrb.posZ * 32.0D);
this.xpValue = xpOrb.getXpValue();
}
示例9: S0CPacketSpawnPlayer
import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public S0CPacketSpawnPlayer(EntityPlayer player)
{
this.entityId = player.getEntityId();
this.playerId = player.getGameProfile().getId();
this.x = MathHelper.floor_double(player.posX * 32.0D);
this.y = MathHelper.floor_double(player.posY * 32.0D);
this.z = MathHelper.floor_double(player.posZ * 32.0D);
this.yaw = (byte)((int)(player.rotationYaw * 256.0F / 360.0F));
this.pitch = (byte)((int)(player.rotationPitch * 256.0F / 360.0F));
ItemStack itemstack = player.inventory.getCurrentItem();
this.currentItem = itemstack == null ? 0 : Item.getIdFromItem(itemstack.getItem());
this.watcher = player.getDataWatcher();
}
示例10: updateTask
import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
/**
* Updates the task
*/
public void updateTask()
{
this.thePet.getLookHelper().setLookPositionWithEntity(this.theOwner, 10.0F, (float)this.thePet.getVerticalFaceSpeed());
if (!this.thePet.isSitting())
{
if (--this.field_75343_h <= 0)
{
this.field_75343_h = 10;
if (!this.petPathfinder.tryMoveToEntityLiving(this.theOwner, this.followSpeed))
{
if (!this.thePet.getLeashed())
{
if (this.thePet.getDistanceSqToEntity(this.theOwner) >= 144.0D)
{
int i = MathHelper.floor_double(this.theOwner.posX) - 2;
int j = MathHelper.floor_double(this.theOwner.posZ) - 2;
int k = MathHelper.floor_double(this.theOwner.getEntityBoundingBox().minY);
for (int l = 0; l <= 4; ++l)
{
for (int i1 = 0; i1 <= 4; ++i1)
{
if ((l < 1 || i1 < 1 || l > 3 || i1 > 3) && World.doesBlockHaveSolidTopSurface(this.theWorld, new BlockPos(i + l, k - 1, j + i1)) && this.func_181065_a(new BlockPos(i + l, k, j + i1)) && this.func_181065_a(new BlockPos(i + l, k + 1, j + i1)))
{
this.thePet.setLocationAndAngles((double)((float)(i + l) + 0.5F), (double)k, (double)((float)(j + i1) + 0.5F), this.thePet.rotationYaw, this.thePet.rotationPitch);
this.petPathfinder.clearPathEntity();
return;
}
}
}
}
}
}
}
}
}
示例11: updateChunkPositions
import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public void updateChunkPositions(double viewEntityX, double viewEntityZ)
{
int i = MathHelper.floor_double(viewEntityX) - 8;
int j = MathHelper.floor_double(viewEntityZ) - 8;
int k = this.countChunksX * 16;
for (int l = 0; l < this.countChunksX; ++l)
{
int i1 = this.func_178157_a(i, k, l);
for (int j1 = 0; j1 < this.countChunksZ; ++j1)
{
int k1 = this.func_178157_a(j, k, j1);
for (int l1 = 0; l1 < this.countChunksY; ++l1)
{
int i2 = l1 * 16;
RenderChunk renderchunk = this.renderChunks[(j1 * this.countChunksY + l1) * this.countChunksX + l];
BlockPos blockpos = new BlockPos(i1, i2, k1);
if (!blockpos.equals(renderchunk.getPosition()))
{
renderchunk.setPosition(blockpos);
}
}
}
}
}
示例12: getColorSmooth
import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public int getColorSmooth(IBlockAccess p_getColorSmooth_1_, double p_getColorSmooth_2_, double p_getColorSmooth_4_, double p_getColorSmooth_6_, int p_getColorSmooth_8_)
{
if (this.format == 2)
{
return this.color;
}
else
{
int i = MathHelper.floor_double(p_getColorSmooth_2_);
int j = MathHelper.floor_double(p_getColorSmooth_4_);
int k = MathHelper.floor_double(p_getColorSmooth_6_);
int l = 0;
int i1 = 0;
int j1 = 0;
int k1 = 0;
BlockPosM blockposm = new BlockPosM(0, 0, 0);
for (int l1 = i - p_getColorSmooth_8_; l1 <= i + p_getColorSmooth_8_; ++l1)
{
for (int i2 = k - p_getColorSmooth_8_; i2 <= k + p_getColorSmooth_8_; ++i2)
{
blockposm.setXyz(l1, j, i2);
int j2 = this.getColor((IBlockAccess)p_getColorSmooth_1_, blockposm);
l += j2 >> 16 & 255;
i1 += j2 >> 8 & 255;
j1 += j2 & 255;
++k1;
}
}
int k2 = l / k1;
int l2 = i1 / k1;
int i3 = j1 / k1;
return k2 << 16 | l2 << 8 | i3;
}
}
示例13: isFlammableWithin
import net.minecraft.util.MathHelper; //导入方法依赖的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;
}
示例14: getCanSpawnHere
import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
/**
* Checks if the entity's current position is a valid location to spawn this entity.
*/
public boolean getCanSpawnHere()
{
int i = MathHelper.floor_double(this.posX);
int j = MathHelper.floor_double(this.getEntityBoundingBox().minY);
int k = MathHelper.floor_double(this.posZ);
BlockPos blockpos = new BlockPos(i, j, k);
return this.worldObj.getBlockState(blockpos.down()).getBlock() == this.spawnableBlock && this.worldObj.getLight(blockpos) > 8 && super.getCanSpawnHere();
}
示例15: EntityPlayerMP
import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public EntityPlayerMP(MinecraftServer server, WorldServer worldIn, GameProfile profile, ItemInWorldManager interactionManager)
{
super(worldIn, profile);
interactionManager.thisPlayerMP = this;
this.theItemInWorldManager = interactionManager;
BlockPos blockpos = worldIn.getSpawnPoint();
if (!worldIn.provider.getHasNoSky() && worldIn.getWorldInfo().getGameType() != WorldSettings.GameType.ADVENTURE)
{
int i = Math.max(5, server.getSpawnProtectionSize() - 6);
int j = MathHelper.floor_double(worldIn.getWorldBorder().getClosestDistance((double)blockpos.getX(), (double)blockpos.getZ()));
if (j < i)
{
i = j;
}
if (j <= 1)
{
i = 1;
}
blockpos = worldIn.getTopSolidOrLiquidBlock(blockpos.add(this.rand.nextInt(i * 2) - i, 0, this.rand.nextInt(i * 2) - i));
}
this.mcServer = server;
this.statsFile = server.getConfigurationManager().getPlayerStatsFile(this);
this.stepHeight = 0.0F;
this.moveToBlockPosAndAngles(blockpos, 0.0F, 0.0F);
while (!worldIn.getCollidingBoundingBoxes(this, this.getEntityBoundingBox()).isEmpty() && this.posY < 255.0D)
{
this.setPosition(this.posX, this.posY + 1.0D, this.posZ);
}
}