本文整理汇总了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);
}