本文整理匯總了Java中net.minecraft.enchantment.EnchantmentHelper.getMaxEnchantmentLevel方法的典型用法代碼示例。如果您正苦於以下問題:Java EnchantmentHelper.getMaxEnchantmentLevel方法的具體用法?Java EnchantmentHelper.getMaxEnchantmentLevel怎麽用?Java EnchantmentHelper.getMaxEnchantmentLevel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.enchantment.EnchantmentHelper
的用法示例。
在下文中一共展示了EnchantmentHelper.getMaxEnchantmentLevel方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: func_190547_a
import net.minecraft.enchantment.EnchantmentHelper; //導入方法依賴的package包/類
public void func_190547_a(EntityLivingBase p_190547_1_, float p_190547_2_)
{
int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.POWER, p_190547_1_);
int j = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.PUNCH, p_190547_1_);
this.setDamage((double)(p_190547_2_ * 2.0F) + this.rand.nextGaussian() * 0.25D + (double)((float)this.world.getDifficulty().getDifficultyId() * 0.11F));
if (i > 0)
{
this.setDamage(this.getDamage() + (double)i * 0.5D + 0.5D);
}
if (j > 0)
{
this.setKnockbackStrength(j);
}
if (EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.FLAME, p_190547_1_) > 0)
{
this.setFire(100);
}
}
示例2: frostWalk
import net.minecraft.enchantment.EnchantmentHelper; //導入方法依賴的package包/類
protected void frostWalk(BlockPos pos)
{
int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.FROST_WALKER, this);
if (i > 0)
{
EnchantmentFrostWalker.freezeNearby(this, this.world, pos, i);
}
}
示例3: frostWalk
import net.minecraft.enchantment.EnchantmentHelper; //導入方法依賴的package包/類
protected void frostWalk(BlockPos pos)
{
int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.FROST_WALKER, this);
if (i > 0)
{
EnchantmentFrostWalker.freezeNearby(this, this.worldObj, pos, i);
}
}
示例4: attackEntityWithRangedAttack
import net.minecraft.enchantment.EnchantmentHelper; //導入方法依賴的package包/類
/**
* Attack the specified entity using a ranged attack.
*
* @param distanceFactor How far the target is, normalized and clamped between 0.1 and 1.0
*/
public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor)
{
EntityTippedArrow entitytippedarrow = new EntityTippedArrow(this.worldObj, this);
double d0 = target.posX - this.posX;
double d1 = target.getEntityBoundingBox().minY + (double)(target.height / 3.0F) - entitytippedarrow.posY;
double d2 = target.posZ - this.posZ;
double d3 = (double)MathHelper.sqrt_double(d0 * d0 + d2 * d2);
entitytippedarrow.setThrowableHeading(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float)(14 - this.worldObj.getDifficulty().getDifficultyId() * 4));
int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.POWER, this);
int j = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.PUNCH, this);
DifficultyInstance difficultyinstance = this.worldObj.getDifficultyForLocation(new BlockPos(this));
entitytippedarrow.setDamage((double)(distanceFactor * 2.0F) + this.rand.nextGaussian() * 0.25D + (double)((float)this.worldObj.getDifficulty().getDifficultyId() * 0.11F));
if (i > 0)
{
entitytippedarrow.setDamage(entitytippedarrow.getDamage() + (double)i * 0.5D + 0.5D);
}
if (j > 0)
{
entitytippedarrow.setKnockbackStrength(j);
}
boolean flag = this.isBurning() && difficultyinstance.isHard() && this.rand.nextBoolean() || this.getSkeletonType() == SkeletonType.WITHER;
flag = flag || EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.FLAME, this) > 0;
if (flag)
{
entitytippedarrow.setFire(100);
}
ItemStack itemstack = this.getHeldItem(EnumHand.OFF_HAND);
if (itemstack != null && itemstack.getItem() == Items.TIPPED_ARROW)
{
entitytippedarrow.setPotionEffect(itemstack);
}
else if (this.getSkeletonType() == SkeletonType.STRAY)
{
entitytippedarrow.addEffect(new PotionEffect(MobEffects.SLOWNESS, 600));
}
this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
this.worldObj.spawnEntityInWorld(entitytippedarrow);
}