本文整理匯總了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;
}
示例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;
}
示例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);
}