本文整理匯總了Java中net.minecraft.util.MathHelper.ceiling_float_int方法的典型用法代碼示例。如果您正苦於以下問題:Java MathHelper.ceiling_float_int方法的具體用法?Java MathHelper.ceiling_float_int怎麽用?Java MathHelper.ceiling_float_int使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.util.MathHelper
的用法示例。
在下文中一共展示了MathHelper.ceiling_float_int方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: func_96635_a
import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
public int func_96635_a(List<EntityPlayer> p_96635_1_)
{
float f = 0.0F;
for (EntityPlayer entityplayer : p_96635_1_)
{
f += entityplayer.getHealth() + entityplayer.getAbsorptionAmount();
}
if (p_96635_1_.size() > 0)
{
f /= (float)p_96635_1_.size();
}
return MathHelper.ceiling_float_int(f);
}
示例2: fall
import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
public void fall(float distance, float damageMultiplier)
{
super.fall(distance, damageMultiplier);
PotionEffect potioneffect = this.getActivePotionEffect(Potion.jump);
float f = potioneffect != null ? (float)(potioneffect.getAmplifier() + 1) : 0.0F;
int i = MathHelper.ceiling_float_int((distance - 3.0F - f) * damageMultiplier);
if (i > 0)
{
this.playSound(this.getFallSoundString(i), 1.0F, 1.0F);
this.attackEntityFrom(DamageSource.fall, (float)i);
int j = MathHelper.floor_double(this.posX);
int k = MathHelper.floor_double(this.posY - 0.20000000298023224D);
int l = MathHelper.floor_double(this.posZ);
Block block = this.worldObj.getBlockState(new BlockPos(j, k, l)).getBlock();
if (block.getMaterial() != Material.air)
{
Block.SoundType block$soundtype = block.stepSound;
this.playSound(block$soundtype.getStepSound(), block$soundtype.getVolume() * 0.5F, block$soundtype.getFrequency() * 0.75F);
}
}
}
示例3: fall
import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
public void fall(float distance, float damageMultiplier)
{
Block block = this.fallTile.getBlock();
if (this.hurtEntities)
{
int i = MathHelper.ceiling_float_int(distance - 1.0F);
if (i > 0)
{
List<Entity> list = Lists.newArrayList(this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox()));
boolean flag = block == Blocks.anvil;
DamageSource damagesource = flag ? DamageSource.anvil : DamageSource.fallingBlock;
for (Entity entity : list)
{
entity.attackEntityFrom(damagesource, (float)Math.min(MathHelper.floor_float((float)i * this.fallHurtAmount), this.fallHurtMax));
}
if (flag && (double)this.rand.nextFloat() < 0.05000000074505806D + (double)i * 0.05D)
{
int j = ((Integer)this.fallTile.getValue(BlockAnvil.DAMAGE)).intValue();
++j;
if (j > 2)
{
this.canSetAsBlock = true;
}
else
{
this.fallTile = this.fallTile.withProperty(BlockAnvil.DAMAGE, Integer.valueOf(j));
}
}
}
}
}
示例4: updateFallState
import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
protected void updateFallState(double y, boolean onGroundIn, Block blockIn, BlockPos pos)
{
if (!this.isInWater())
{
this.handleWaterMovement();
}
if (!this.worldObj.isRemote && this.fallDistance > 3.0F && onGroundIn)
{
IBlockState iblockstate = this.worldObj.getBlockState(pos);
Block block = iblockstate.getBlock();
float f = (float)MathHelper.ceiling_float_int(this.fallDistance - 3.0F);
if (block.getMaterial() != Material.air)
{
double d0 = (double)Math.min(0.2F + f / 15.0F, 10.0F);
if (d0 > 2.5D)
{
d0 = 2.5D;
}
int i = (int)(150.0D * d0);
((WorldServer)this.worldObj).spawnParticle(EnumParticleTypes.BLOCK_DUST, this.posX, this.posY, this.posZ, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, new int[] {Block.getStateId(iblockstate)});
}
}
super.updateFallState(y, onGroundIn, blockIn, pos);
}
示例5: fall
import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
public void fall(float distance, float damageMultiplier)
{
if (distance > 1.0F)
{
this.playSound("mob.horse.land", 0.4F, 1.0F);
}
int i = MathHelper.ceiling_float_int((distance * 0.5F - 3.0F) * damageMultiplier);
if (i > 0)
{
this.attackEntityFrom(DamageSource.fall, (float)i);
if (this.riddenByEntity != null)
{
this.riddenByEntity.attackEntityFrom(DamageSource.fall, (float)i);
}
Block block = this.worldObj.getBlockState(new BlockPos(this.posX, this.posY - 0.2D - (double)this.prevRotationYaw, this.posZ)).getBlock();
if (block.getMaterial() != Material.air && !this.isSilent())
{
Block.SoundType block$soundtype = block.stepSound;
this.worldObj.playSoundAtEntity(this, block$soundtype.getStepSound(), block$soundtype.getVolume() * 0.5F, block$soundtype.getFrequency() * 0.75F);
}
}
}
示例6: computeRedstoneStrength
import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
protected int computeRedstoneStrength(World worldIn, BlockPos pos)
{
int i = Math.min(worldIn.getEntitiesWithinAABB(Entity.class, this.getSensitiveAABB(pos)).size(), this.field_150068_a);
if (i > 0)
{
float f = (float)Math.min(this.field_150068_a, i) / (float)this.field_150068_a;
return MathHelper.ceiling_float_int(f * 15.0F);
}
else
{
return 0;
}
}
示例7: pathFollow
import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
protected void pathFollow()
{
Vec3 vec3 = this.getEntityPosition();
int i = this.currentPath.getCurrentPathLength();
for (int j = this.currentPath.getCurrentPathIndex(); j < this.currentPath.getCurrentPathLength(); ++j)
{
if (this.currentPath.getPathPointFromIndex(j).yCoord != (int)vec3.yCoord)
{
i = j;
break;
}
}
float f = this.theEntity.width * this.theEntity.width * this.heightRequirement;
for (int k = this.currentPath.getCurrentPathIndex(); k < i; ++k)
{
Vec3 vec31 = this.currentPath.getVectorFromIndex(this.theEntity, k);
if (vec3.squareDistanceTo(vec31) < (double)f)
{
this.currentPath.setCurrentPathIndex(k + 1);
}
}
int j1 = MathHelper.ceiling_float_int(this.theEntity.width);
int k1 = (int)this.theEntity.height + 1;
int l = j1;
for (int i1 = i - 1; i1 >= this.currentPath.getCurrentPathIndex(); --i1)
{
if (this.isDirectPathBetweenPoints(vec3, this.currentPath.getVectorFromIndex(this.theEntity, i1), j1, k1, l))
{
this.currentPath.setCurrentPathIndex(i1);
break;
}
}
this.checkForStuck(vec3);
}
示例8: onCrafting
import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
/**
* the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
*/
protected void onCrafting(ItemStack stack)
{
stack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.field_75228_b);
if (!this.thePlayer.worldObj.isRemote)
{
int i = this.field_75228_b;
float f = FurnaceRecipes.instance().getSmeltingExperience(stack);
if (f == 0.0F)
{
i = 0;
}
else if (f < 1.0F)
{
int j = MathHelper.floor_float((float)i * f);
if (j < MathHelper.ceiling_float_int((float)i * f) && Math.random() < (double)((float)i * f - (float)j))
{
++j;
}
i = j;
}
while (i > 0)
{
int k = EntityXPOrb.getXPSplit(i);
i -= k;
this.thePlayer.worldObj.spawnEntityInWorld(new EntityXPOrb(this.thePlayer.worldObj, this.thePlayer.posX, this.thePlayer.posY + 0.5D, this.thePlayer.posZ + 0.5D, k));
}
}
this.field_75228_b = 0;
if (stack.getItem() == Items.iron_ingot)
{
this.thePlayer.triggerAchievement(AchievementList.acquireIron);
}
if (stack.getItem() == Items.cooked_fish)
{
this.thePlayer.triggerAchievement(AchievementList.cookFish);
}
}
示例9: ceil
import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
public static int ceil(float p_ceil_0_)
{
return MathHelper.ceiling_float_int(p_ceil_0_);
}