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


Java EnchantmentHelper.getMaxEnchantmentLevel方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:22,代码来源:EntityArrow.java

示例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);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:10,代码来源:EntityLivingBase.java

示例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);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:10,代码来源:EntityLivingBase.java

示例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);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:51,代码来源:EntitySkeleton.java


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