當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。