当前位置: 首页>>代码示例>>Java>>正文


Java MathHelper.ceiling_float_int方法代码示例

本文整理汇总了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);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:17,代码来源:ScoreHealthCriteria.java

示例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);
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:24,代码来源:EntityLivingBase.java

示例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));
                }
            }
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:37,代码来源:EntityFallingBlock.java

示例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);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:30,代码来源:EntityLivingBase.java

示例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);
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:28,代码来源:EntityHorse.java

示例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;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:15,代码来源:BlockPressurePlateWeighted.java

示例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);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:42,代码来源:PathNavigate.java

示例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);
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:49,代码来源:SlotFurnaceOutput.java

示例9: ceil

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public static int ceil(float p_ceil_0_)
{
    return MathHelper.ceiling_float_int(p_ceil_0_);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:5,代码来源:RealmsMth.java


注:本文中的net.minecraft.util.MathHelper.ceiling_float_int方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。