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


Java EntityTippedArrow.setPotionEffect方法代码示例

本文整理汇总了Java中net.minecraft.entity.projectile.EntityTippedArrow.setPotionEffect方法的典型用法代码示例。如果您正苦于以下问题:Java EntityTippedArrow.setPotionEffect方法的具体用法?Java EntityTippedArrow.setPotionEffect怎么用?Java EntityTippedArrow.setPotionEffect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.entity.projectile.EntityTippedArrow的用法示例。


在下文中一共展示了EntityTippedArrow.setPotionEffect方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getArrow

import net.minecraft.entity.projectile.EntityTippedArrow; //导入方法依赖的package包/类
protected EntityArrow getArrow(float distanceFactor) {
	ItemStack arrowItem = this.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);

	if (arrowItem.getItem() == Items.SPECTRAL_ARROW) {
		EntitySpectralArrow entityspectralarrow = new EntitySpectralArrow(this.world, this);
		entityspectralarrow.setEnchantmentEffectsFromEntity(this, distanceFactor);
		return entityspectralarrow;
	} else {
		EntityTippedArrow entityarrow = new EntityTippedArrow(this.world, this);
		entityarrow.setEnchantmentEffectsFromEntity(this, distanceFactor);

		if (arrowItem.getItem() == Items.TIPPED_ARROW)
			entityarrow.setPotionEffect(arrowItem);

		return entityarrow;
	}
}
 
开发者ID:The-Fireplace-Minecraft-Mods,项目名称:Overlord,代码行数:18,代码来源:EntityConvertedSkeleton.java

示例2: getArrow

import net.minecraft.entity.projectile.EntityTippedArrow; //导入方法依赖的package包/类
protected EntityArrow getArrow(float distanceFactor) {
	ItemStack arrowStack = this.getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);

	if (arrowStack.getItem() == Items.SPECTRAL_ARROW) {
		EntitySpectralArrow entityspectralarrow = new EntitySpectralArrow(this.world, this);
		entityspectralarrow.setEnchantmentEffectsFromEntity(this, distanceFactor);
		return entityspectralarrow;
	} else {
		EntityTippedArrow entityarrow = new EntityTippedArrow(this.world, this);
		entityarrow.setEnchantmentEffectsFromEntity(this, distanceFactor);

		if (arrowStack.getItem() == Items.TIPPED_ARROW)
			entityarrow.setPotionEffect(arrowStack);

		return entityarrow;
	}
}
 
开发者ID:The-Fireplace-Minecraft-Mods,项目名称:Overlord,代码行数:18,代码来源:EntitySkeletonWarrior.java

示例3: attackEntityWithRangedAttack

import net.minecraft.entity.projectile.EntityTippedArrow; //导入方法依赖的package包/类
public void attackEntityWithRangedAttack(EntityLivingBase target, float arrowSpeed)
{
	EntityTippedArrow entitytippedarrow = new EntityTippedArrow(this.world, 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(d0 * d0 + d2 * d2);
       entitytippedarrow.setThrowableHeading(d0, d1 + d3 * 0.2, d2, 1.6F, (float)(14 - this.world.getDifficulty().getDifficultyId() * 4));
       int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.POWER, this);
       int j = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.PUNCH, this);
       entitytippedarrow.setDamage((double)(arrowSpeed * 2.0F) + this.rand.nextGaussian() * 0.25D + (double)((float)this.world.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() && this.rand.nextBoolean();
       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);

       this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
       this.world.spawnEntity(entitytippedarrow);
}
 
开发者ID:murapix,项目名称:Inhuman-Resources,代码行数:33,代码来源:MobRanged.java

示例4: shootThisDirection

import net.minecraft.entity.projectile.EntityTippedArrow; //导入方法依赖的package包/类
public void shootThisDirection(EnumFacing enumfacing) {
  BlockPos position = this.getPosition().up().offset(enumfacing, 2);
  EntityTippedArrow entitytippedarrow = new EntityTippedArrow(world, position.getX(), position.getY(), position.getZ());
  entitytippedarrow.setPotionEffect(PotionUtils.addPotionToItemStack(new ItemStack(Items.TIPPED_ARROW), PotionType.getPotionTypeForName("slowness")));
  entitytippedarrow.pickupStatus = EntityArrow.PickupStatus.CREATIVE_ONLY;
  entitytippedarrow.setThrowableHeading((double) enumfacing.getFrontOffsetX(), YAW, (double) enumfacing.getFrontOffsetZ(), VELOCITY, INACCRACY);
  world.spawnEntity(entitytippedarrow);
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:9,代码来源:EntityMinecartTurret.java

示例5: createArrow

import net.minecraft.entity.projectile.EntityTippedArrow; //导入方法依赖的package包/类
public EntityArrow createArrow(World worldIn, ItemStack stack, EntityLivingBase shooter)
{
    EntityTippedArrow entitytippedarrow = new EntityTippedArrow(worldIn, shooter);
    entitytippedarrow.setPotionEffect(stack);
    return entitytippedarrow;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:7,代码来源:ItemTippedArrow.java

示例6: attackEntityWithRangedAttack

import net.minecraft.entity.projectile.EntityTippedArrow; //导入方法依赖的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

示例7: onArrowLoose

import net.minecraft.entity.projectile.EntityTippedArrow; //导入方法依赖的package包/类
@SubscribeEvent
public void onArrowLoose(ArrowLooseEvent event) {
    EntityPlayer player = event.getEntityPlayer();
    if (this.isActive(player)) {
        if (!event.hasAmmo()) {
            ItemStack stack = event.getBow();
            World world = player.getEntityWorld();
            EntitySkeleton skeleton = (EntitySkeleton) PossessHandler.get(player).getPossessing();
            float velocity = ItemBow.getArrowVelocity(event.getCharge());
            if (velocity >= 0.1) {
                if (!world.isRemote) {
                    EntityTippedArrow arrow = new EntityTippedArrow(world, player);
                    if (skeleton.getSkeletonType() != SkeletonType.STRAY) {
                        arrow.setPotionEffect(new ItemStack(Items.ARROW));
                    } else {
                        arrow.setPotionEffect(new ItemStack(Items.TIPPED_ARROW));
                        arrow.addEffect(new PotionEffect(MobEffects.SLOWNESS, 600));
                    }
                    arrow.setAim(player, player.rotationPitch, player.rotationYaw, 0.0F, velocity * 3.0F, 1.0F);
                    arrow.pickupStatus = EntityArrow.PickupStatus.CREATIVE_ONLY;
                    if (velocity == 1.0F) {
                        arrow.setIsCritical(true);
                    }
                    int power = EnchantmentHelper.getEnchantmentLevel(Enchantments.POWER, stack);
                    if (power > 0) {
                        arrow.setDamage(arrow.getDamage() + (double) power * 0.5 + 0.5);
                    }
                    int punch = EnchantmentHelper.getEnchantmentLevel(Enchantments.PUNCH, stack);
                    if (punch > 0) {
                        arrow.setKnockbackStrength(punch);
                    }
                    if (EnchantmentHelper.getEnchantmentLevel(Enchantments.FLAME, stack) > 0) {
                        arrow.setFire(100);
                    }
                    stack.damageItem(1, player);
                    world.spawnEntityInWorld(arrow);
                }
                world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.NEUTRAL, 1.0F, 1.0F / (world.rand.nextFloat() * 0.4F + 1.2F) + velocity * 0.5F);
                player.addStat(StatList.getObjectUseStats(stack.getItem()));
            }
        }
    }
}
 
开发者ID:Fararise,项目名称:Possessed,代码行数:44,代码来源:SkeletonHandler.java

示例8: attackEntityWithRangedAttack

import net.minecraft.entity.projectile.EntityTippedArrow; //导入方法依赖的package包/类
/**
 * Attack the specified entity using a ranged attack.
 */
public void attackEntityWithRangedAttack(EntityLivingBase target, float p_82196_2_)
{
    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)(p_82196_2_ * 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.func_190083_c() && this.rand.nextBoolean() || this.func_189771_df() == 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.func_189771_df() == 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:BlazeAxtrius,项目名称:ExpandedRailsMod,代码行数:49,代码来源:EntitySkeleton.java


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