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


Java MathHelper.floor_float方法代码示例

本文整理汇总了Java中net.minecraft.util.MathHelper.floor_float方法的典型用法代码示例。如果您正苦于以下问题:Java MathHelper.floor_float方法的具体用法?Java MathHelper.floor_float怎么用?Java MathHelper.floor_float使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.util.MathHelper的用法示例。


在下文中一共展示了MathHelper.floor_float方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: calcRedstoneFromInventory

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public static int calcRedstoneFromInventory(IInventory inv)
{
    if (inv == null)
    {
        return 0;
    }
    else
    {
        int i = 0;
        float f = 0.0F;

        for (int j = 0; j < inv.getSizeInventory(); ++j)
        {
            ItemStack itemstack = inv.getStackInSlot(j);

            if (itemstack != null)
            {
                f += (float)itemstack.stackSize / (float)Math.min(inv.getInventoryStackLimit(), itemstack.getMaxStackSize());
                ++i;
            }
        }

        f = f / (float)inv.getSizeInventory();
        return MathHelper.floor_float(f * 14.0F) + (i > 0 ? 1 : 0);
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:27,代码来源:Container.java

示例2: computeStackSize

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
/**
 * Compute the new stack size, Returns the stack with the new size. Args : dragSlots, dragMode, dragStack,
 * slotStackSize
 */
public static void computeStackSize(Set<Slot> p_94525_0_, int p_94525_1_, ItemStack p_94525_2_, int p_94525_3_)
{
    switch (p_94525_1_)
    {
        case 0:
            p_94525_2_.stackSize = MathHelper.floor_float((float)p_94525_2_.stackSize / (float)p_94525_0_.size());
            break;

        case 1:
            p_94525_2_.stackSize = 1;
            break;

        case 2:
            p_94525_2_.stackSize = p_94525_2_.getItem().getItemStackLimit();
    }

    p_94525_2_.stackSize += p_94525_3_;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:23,代码来源:Container.java

示例3: initProcessor

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public void initProcessor(IBlockAccess iblockaccessIn, Entity entityIn)
{
    this.blockaccess = iblockaccessIn;
    this.pointMap.clearMap();
    this.entitySizeX = MathHelper.floor_float(entityIn.width + 1.0F);
    this.entitySizeY = MathHelper.floor_float(entityIn.height + 1.0F);
    this.entitySizeZ = MathHelper.floor_float(entityIn.width + 1.0F);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:9,代码来源:NodeProcessor.java

示例4: EntityTrackerEntry

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public EntityTrackerEntry(Entity trackedEntityIn, int trackingDistanceThresholdIn, int updateFrequencyIn, boolean sendVelocityUpdatesIn)
{
    this.trackedEntity = trackedEntityIn;
    this.trackingDistanceThreshold = trackingDistanceThresholdIn;
    this.updateFrequency = updateFrequencyIn;
    this.sendVelocityUpdates = sendVelocityUpdatesIn;
    this.encodedPosX = MathHelper.floor_double(trackedEntityIn.posX * 32.0D);
    this.encodedPosY = MathHelper.floor_double(trackedEntityIn.posY * 32.0D);
    this.encodedPosZ = MathHelper.floor_double(trackedEntityIn.posZ * 32.0D);
    this.encodedRotationYaw = MathHelper.floor_float(trackedEntityIn.rotationYaw * 256.0F / 360.0F);
    this.encodedRotationPitch = MathHelper.floor_float(trackedEntityIn.rotationPitch * 256.0F / 360.0F);
    this.lastHeadMotion = MathHelper.floor_float(trackedEntityIn.getRotationYawHead() * 256.0F / 360.0F);
    this.onGround = trackedEntityIn.onGround;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:15,代码来源:EntityTrackerEntry.java

示例5: calcModifierDamage

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
/**
 * Calculates the damage protection of the enchantment based on level and damage source passed.
 */
public int calcModifierDamage(int level, DamageSource source)
{
    if (source.canHarmInCreative())
    {
        return 0;
    }
    else
    {
        float f = (float)(6 + level * level) / 3.0F;
        return this.protectionType == 0 ? MathHelper.floor_float(f * 0.75F) : (this.protectionType == 1 && source.isFireDamage() ? MathHelper.floor_float(f * 1.25F) : (this.protectionType == 2 && source == DamageSource.fall ? MathHelper.floor_float(f * 2.5F) : (this.protectionType == 3 && source.isExplosion() ? MathHelper.floor_float(f * 1.5F) : (this.protectionType == 4 && source.isProjectile() ? MathHelper.floor_float(f * 1.5F) : 0))));
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:16,代码来源:EnchantmentProtection.java

示例6: func_150541_c

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
private void func_150541_c(World worldIn, int p_150541_2_, int p_150541_3_, int p_150541_4_, int p_150541_5_, Random p_150541_6_)
{
    int i = p_150541_6_.nextInt(5) + (this.useBaseHeight ? this.baseHeight : 3);
    int j = 0;

    for (int k = p_150541_4_ - i; k <= p_150541_4_; ++k)
    {
        int l = p_150541_4_ - k;
        int i1 = p_150541_5_ + MathHelper.floor_float((float)l / (float)i * 3.5F);
        this.func_175925_a(worldIn, new BlockPos(p_150541_2_, k, p_150541_3_), i1 + (l > 0 && i1 == j && (k & 1) == 0 ? 1 : 0));
        j = i1;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:14,代码来源:WorldGenMegaPineTree.java

示例7: calculateChatboxHeight

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public static int calculateChatboxHeight(float p_146243_0_)
{
    int i = 180;
    int j = 20;
    return MathHelper.floor_float(p_146243_0_ * (float)(i - j) + (float)j);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:7,代码来源:GuiNewChat.java

示例8: getInt

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

示例9: formatStreamKbps

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public static int formatStreamKbps(float p_152946_0_)
{
    return MathHelper.floor_float(230.0F + p_152946_0_ * 3270.0F);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:TwitchStream.java

示例10: formatStreamFps

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public static int formatStreamFps(float p_152948_0_)
{
    return MathHelper.floor_float(10.0F + p_152948_0_ * 50.0F);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:TwitchStream.java

示例11: getShort

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public short getShort()
{
    return (short)(MathHelper.floor_float(this.data) & 65535);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:5,代码来源:NBTTagFloat.java

示例12: calculateChatboxWidth

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public static int calculateChatboxWidth(float p_146233_0_)
{
    int i = 320;
    int j = 40;
    return MathHelper.floor_float(p_146233_0_ * (float)(i - j) + (float)j);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:7,代码来源:GuiNewChat.java

示例13: onItemUse

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
/**
 * Called when a Block is right-clicked with this Item
 */
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
{
    if (side == EnumFacing.DOWN)
    {
        return false;
    }
    else
    {
        boolean flag = worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos);
        BlockPos blockpos = flag ? pos : pos.offset(side);

        if (!playerIn.canPlayerEdit(blockpos, side, stack))
        {
            return false;
        }
        else
        {
            BlockPos blockpos1 = blockpos.up();
            boolean flag1 = !worldIn.isAirBlock(blockpos) && !worldIn.getBlockState(blockpos).getBlock().isReplaceable(worldIn, blockpos);
            flag1 = flag1 | (!worldIn.isAirBlock(blockpos1) && !worldIn.getBlockState(blockpos1).getBlock().isReplaceable(worldIn, blockpos1));

            if (flag1)
            {
                return false;
            }
            else
            {
                double d0 = (double)blockpos.getX();
                double d1 = (double)blockpos.getY();
                double d2 = (double)blockpos.getZ();
                List<Entity> list = worldIn.getEntitiesWithinAABBExcludingEntity((Entity)null, AxisAlignedBB.fromBounds(d0, d1, d2, d0 + 1.0D, d1 + 2.0D, d2 + 1.0D));

                if (list.size() > 0)
                {
                    return false;
                }
                else
                {
                    if (!worldIn.isRemote)
                    {
                        worldIn.setBlockToAir(blockpos);
                        worldIn.setBlockToAir(blockpos1);
                        EntityArmorStand entityarmorstand = new EntityArmorStand(worldIn, d0 + 0.5D, d1, d2 + 0.5D);
                        float f = (float)MathHelper.floor_float((MathHelper.wrapAngleTo180_float(playerIn.rotationYaw - 180.0F) + 22.5F) / 45.0F) * 45.0F;
                        entityarmorstand.setLocationAndAngles(d0 + 0.5D, d1, d2 + 0.5D, f, 0.0F);
                        this.applyRandomRotations(entityarmorstand, worldIn.rand);
                        NBTTagCompound nbttagcompound = stack.getTagCompound();

                        if (nbttagcompound != null && nbttagcompound.hasKey("EntityTag", 10))
                        {
                            NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                            entityarmorstand.writeToNBTOptional(nbttagcompound1);
                            nbttagcompound1.merge(nbttagcompound.getCompoundTag("EntityTag"));
                            entityarmorstand.readFromNBT(nbttagcompound1);
                        }

                        worldIn.spawnEntityInWorld(entityarmorstand);
                    }

                    --stack.stackSize;
                    return true;
                }
            }
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:70,代码来源:ItemArmorStand.java

示例14: updateTask

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
/**
 * Updates the task
 */
public void updateTask()
{
    double d0 = this.entityHost.getDistanceSq(this.attackTarget.posX, this.attackTarget.getEntityBoundingBox().minY, this.attackTarget.posZ);
    boolean flag = this.entityHost.getEntitySenses().canSee(this.attackTarget);

    if (flag)
    {
        ++this.field_75318_f;
    }
    else
    {
        this.field_75318_f = 0;
    }

    if (d0 <= (double)this.maxAttackDistance && this.field_75318_f >= 20)
    {
        this.entityHost.getNavigator().clearPathEntity();
    }
    else
    {
        this.entityHost.getNavigator().tryMoveToEntityLiving(this.attackTarget, this.entityMoveSpeed);
    }

    this.entityHost.getLookHelper().setLookPositionWithEntity(this.attackTarget, 30.0F, 30.0F);

    if (--this.rangedAttackTime == 0)
    {
        if (d0 > (double)this.maxAttackDistance || !flag)
        {
            return;
        }

        float f = MathHelper.sqrt_double(d0) / this.field_96562_i;
        float lvt_5_1_ = MathHelper.clamp_float(f, 0.1F, 1.0F);
        this.rangedAttackEntityHost.attackEntityWithRangedAttack(this.attackTarget, lvt_5_1_);
        this.rangedAttackTime = MathHelper.floor_float(f * (float)(this.maxRangedAttackTime - this.field_96561_g) + (float)this.field_96561_g);
    }
    else if (this.rangedAttackTime < 0)
    {
        float f2 = MathHelper.sqrt_double(d0) / this.field_96562_i;
        this.rangedAttackTime = MathHelper.floor_float(f2 * (float)(this.maxRangedAttackTime - this.field_96561_g) + (float)this.field_96561_g);
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:47,代码来源:EntityAIArrowAttack.java

示例15: floor

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


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