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


Java EnchantmentHelper.getAquaAffinityModifier方法代码示例

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


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

示例1: getToolDigEfficiency

import net.minecraft.enchantment.EnchantmentHelper; //导入方法依赖的package包/类
/**
 * Block hardness will be further counted in net/minecraft/block/Block.getPlayerRelativeBlockHardness
 */
public float getToolDigEfficiency(Block p_180471_1_)
{
    float f = this.inventory.getStrVsBlock(p_180471_1_);

    if (f > 1.0F)
    {
        int i = EnchantmentHelper.getEfficiencyModifier(this);
        ItemStack itemstack = this.inventory.getCurrentItem();

        if (i > 0 && itemstack != null)
        {
            f += (float)(i * i + 1);
        }
    }

    if (this.isPotionActive(Potion.digSpeed))
    {
        f *= 1.0F + (float)(this.getActivePotionEffect(Potion.digSpeed).getAmplifier() + 1) * 0.2F;
    }

    if (this.isPotionActive(Potion.digSlowdown))
    {
        float f1 = 1.0F;

        switch (this.getActivePotionEffect(Potion.digSlowdown).getAmplifier())
        {
            case 0:
                f1 = 0.3F;
                break;

            case 1:
                f1 = 0.09F;
                break;

            case 2:
                f1 = 0.0027F;
                break;

            case 3:
            default:
                f1 = 8.1E-4F;
        }

        f *= f1;
    }

    if (this.isInsideOfMaterial(Material.water) && !EnchantmentHelper.getAquaAffinityModifier(this))
    {
        f /= 5.0F;
    }

    if (!this.onGround)
    {
        f /= 5.0F;
    }

    return f;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:62,代码来源:EntityPlayer.java

示例2: getDigSpeed

import net.minecraft.enchantment.EnchantmentHelper; //导入方法依赖的package包/类
public float getDigSpeed(IBlockState state)
{
    float f = this.inventory.getStrVsBlock(state);

    if (f > 1.0F)
    {
        int i = EnchantmentHelper.getEfficiencyModifier(this);
        ItemStack itemstack = this.getHeldItemMainhand();

        if (i > 0 && !itemstack.func_190926_b())
        {
            f += (float)(i * i + 1);
        }
    }

    if (this.isPotionActive(MobEffects.HASTE))
    {
        f *= 1.0F + (float)(this.getActivePotionEffect(MobEffects.HASTE).getAmplifier() + 1) * 0.2F;
    }

    if (this.isPotionActive(MobEffects.MINING_FATIGUE))
    {
        float f1;

        switch (this.getActivePotionEffect(MobEffects.MINING_FATIGUE).getAmplifier())
        {
            case 0:
                f1 = 0.3F;
                break;

            case 1:
                f1 = 0.09F;
                break;

            case 2:
                f1 = 0.0027F;
                break;

            case 3:
            default:
                f1 = 8.1E-4F;
        }

        f *= f1;
    }

    if (this.isInsideOfMaterial(Material.WATER) && !EnchantmentHelper.getAquaAffinityModifier(this))
    {
        f /= 5.0F;
    }

    if (!this.onGround)
    {
        f /= 5.0F;
    }

    return f;
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:59,代码来源:EntityPlayer.java

示例3: getDigSpeed

import net.minecraft.enchantment.EnchantmentHelper; //导入方法依赖的package包/类
public float getDigSpeed(IBlockState state, BlockPos pos)
{
    float f = this.inventory.getStrVsBlock(state);

    if (f > 1.0F)
    {
        int i = EnchantmentHelper.getEfficiencyModifier(this);
        ItemStack itemstack = this.getHeldItemMainhand();

        if (i > 0 && itemstack != null)
        {
            f += (float)(i * i + 1);
        }
    }

    if (this.isPotionActive(MobEffects.HASTE))
    {
        f *= 1.0F + (float)(this.getActivePotionEffect(MobEffects.HASTE).getAmplifier() + 1) * 0.2F;
    }

    if (this.isPotionActive(MobEffects.MINING_FATIGUE))
    {
        float f1;

        switch (this.getActivePotionEffect(MobEffects.MINING_FATIGUE).getAmplifier())
        {
            case 0:
                f1 = 0.3F;
                break;
            case 1:
                f1 = 0.09F;
                break;
            case 2:
                f1 = 0.0027F;
                break;
            case 3:
            default:
                f1 = 8.1E-4F;
        }

        f *= f1;
    }

    if (this.isInsideOfMaterial(Material.WATER) && !EnchantmentHelper.getAquaAffinityModifier(this))
    {
        f /= 5.0F;
    }

    if (!this.onGround)
    {
        f /= 5.0F;
    }

    f = net.minecraftforge.event.ForgeEventFactory.getBreakSpeed(this, state, f, pos);
    return (f < 0 ? 0 : f);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:57,代码来源:EntityPlayer.java


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