Java Code Examples for net.minecraft.entity.projectile.EntityArrow.setFire()

The following are Jave code examples for showing how to use setFire() of the net.minecraft.entity.projectile.EntityArrow class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: DecompiledMinecraft   File: EntitySkeleton.java   Source Code and License Vote up 6 votes
/**
 * Attack the specified entity using a ranged attack.
 */
public void attackEntityWithRangedAttack(EntityLivingBase p_82196_1_, float p_82196_2_)
{
    EntityArrow entityarrow = new EntityArrow(this.worldObj, this, p_82196_1_, 1.6F, (float)(14 - this.worldObj.getDifficulty().getDifficultyId() * 4));
    int i = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, this.getHeldItem());
    int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, this.getHeldItem());
    entityarrow.setDamage((double)(p_82196_2_ * 2.0F) + this.rand.nextGaussian() * 0.25D + (double)((float)this.worldObj.getDifficulty().getDifficultyId() * 0.11F));

    if (i > 0)
    {
        entityarrow.setDamage(entityarrow.getDamage() + (double)i * 0.5D + 0.5D);
    }

    if (j > 0)
    {
        entityarrow.setKnockbackStrength(j);
    }

    if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, this.getHeldItem()) > 0 || this.getSkeletonType() == 1)
    {
        entityarrow.setFire(100);
    }

    this.playSound("random.bow", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
    this.worldObj.spawnEntityInWorld(entityarrow);
}
 
Example 2
Project: DecompiledMinecraft   File: EntitySkeleton.java   Source Code and License Vote up 6 votes
/**
 * Attack the specified entity using a ranged attack.
 */
public void attackEntityWithRangedAttack(EntityLivingBase p_82196_1_, float p_82196_2_)
{
    EntityArrow entityarrow = new EntityArrow(this.worldObj, this, p_82196_1_, 1.6F, (float)(14 - this.worldObj.getDifficulty().getDifficultyId() * 4));
    int i = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, this.getHeldItem());
    int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, this.getHeldItem());
    entityarrow.setDamage((double)(p_82196_2_ * 2.0F) + this.rand.nextGaussian() * 0.25D + (double)((float)this.worldObj.getDifficulty().getDifficultyId() * 0.11F));

    if (i > 0)
    {
        entityarrow.setDamage(entityarrow.getDamage() + (double)i * 0.5D + 0.5D);
    }

    if (j > 0)
    {
        entityarrow.setKnockbackStrength(j);
    }

    if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, this.getHeldItem()) > 0 || this.getSkeletonType() == 1)
    {
        entityarrow.setFire(100);
    }

    this.playSound("random.bow", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
    this.worldObj.spawnEntityInWorld(entityarrow);
}
 
Example 3
Project: BaseClient   File: EntitySkeleton.java   Source Code and License Vote up 6 votes
/**
 * Attack the specified entity using a ranged attack.
 */
public void attackEntityWithRangedAttack(EntityLivingBase p_82196_1_, float p_82196_2_)
{
    EntityArrow entityarrow = new EntityArrow(this.worldObj, this, p_82196_1_, 1.6F, (float)(14 - this.worldObj.getDifficulty().getDifficultyId() * 4));
    int i = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, this.getHeldItem());
    int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, this.getHeldItem());
    entityarrow.setDamage((double)(p_82196_2_ * 2.0F) + this.rand.nextGaussian() * 0.25D + (double)((float)this.worldObj.getDifficulty().getDifficultyId() * 0.11F));

    if (i > 0)
    {
        entityarrow.setDamage(entityarrow.getDamage() + (double)i * 0.5D + 0.5D);
    }

    if (j > 0)
    {
        entityarrow.setKnockbackStrength(j);
    }

    if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, this.getHeldItem()) > 0 || this.getSkeletonType() == 1)
    {
        entityarrow.setFire(100);
    }

    this.playSound("random.bow", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
    this.worldObj.spawnEntityInWorld(entityarrow);
}
 
Example 4
Project: BaseClient   File: EntitySkeleton.java   Source Code and License Vote up 6 votes
/**
 * Attack the specified entity using a ranged attack.
 */
public void attackEntityWithRangedAttack(EntityLivingBase p_82196_1_, float p_82196_2_)
{
    EntityArrow entityarrow = new EntityArrow(this.worldObj, this, p_82196_1_, 1.6F, (float)(14 - this.worldObj.getDifficulty().getDifficultyId() * 4));
    int i = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, this.getHeldItem());
    int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, this.getHeldItem());
    entityarrow.setDamage((double)(p_82196_2_ * 2.0F) + this.rand.nextGaussian() * 0.25D + (double)((float)this.worldObj.getDifficulty().getDifficultyId() * 0.11F));

    if (i > 0)
    {
        entityarrow.setDamage(entityarrow.getDamage() + (double)i * 0.5D + 0.5D);
    }

    if (j > 0)
    {
        entityarrow.setKnockbackStrength(j);
    }

    if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, this.getHeldItem()) > 0 || this.getSkeletonType() == 1)
    {
        entityarrow.setFire(100);
    }

    this.playSound("random.bow", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
    this.worldObj.spawnEntityInWorld(entityarrow);
}
 
Example 5
Project: MobBlocker   File: TileEntityChunkProtector.java   Source Code and License Vote up 5 votes
/**
 * Destroys skeleton arrows in the protected area
 * Checks whether the arrow was shot by a class deriving from IRangedAttackMob
 * Sets the arrow on fire for visual effect by default
 * An arrow already on fire is killed
 * The effect of this is that the arrow, for one tick, is engulfed in flame, as it looks strange to have the arrow disappear for no reason
 * @param chunkBounds AxisAlignedBB in which block should act
 */
private void killArrows(AxisAlignedBB chunkBounds) {
	List<EntityArrow> list =  world.getEntitiesWithinAABB(EntityArrow.class, chunkBounds);
	for (EntityArrow arrow : list) {
		if (arrow.shootingEntity instanceof IRangedAttackMob) {
			if (arrow.isBurning()) {
				arrow.setDead();
			} else {
				arrow.setFire(1);
				arrow.addVelocity(-arrow.motionX, 0, -arrow.motionZ);
			}
		}
	}
}
 
Example 6
Project: MobBlocker   File: TileEntityAreaProtector.java   Source Code and License Vote up 5 votes
/**
 * Destroys skeleton arrows in the protected area
 * Checks whether the arrow was shot by a class deriving from IRangedAttackMob
 * Sets the arrow on fire for visual effect by default
 * An arrow already on fire is killed
 * The effect of this is that the arrow, for one tick, is engulfed in flame, as it looks strange to have the arrow disappear for no reason
 * @param areaBounds AxisAlignedBB in which block should act
 */
private void killArrows(AxisAlignedBB areaBounds) {
	List<EntityArrow> list =  world.getEntitiesWithinAABB(EntityArrow.class, areaBounds);
	for (EntityArrow arrow : list) {
		if (arrow.shootingEntity instanceof IRangedAttackMob) {
			if (arrow.isBurning()) {
				arrow.setDead();
			} else {
				arrow.setFire(1);
				arrow.addVelocity(-arrow.motionX, 0, -arrow.motionZ);
			}
		}
	}
}
 
Example 7
Project: DecompiledMinecraft   File: ItemBow.java   Source Code and License Vote up 4 votes
/**
 * Called when the player stops using an Item (stops holding the right mouse button).
 */
public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityPlayer playerIn, int timeLeft)
{
    boolean flag = playerIn.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0;

    if (flag || playerIn.inventory.hasItem(Items.arrow))
    {
        int i = this.getMaxItemUseDuration(stack) - timeLeft;
        float f = (float)i / 20.0F;
        f = (f * f + f * 2.0F) / 3.0F;

        if ((double)f < 0.1D)
        {
            return;
        }

        if (f > 1.0F)
        {
            f = 1.0F;
        }

        EntityArrow entityarrow = new EntityArrow(worldIn, playerIn, f * 2.0F);

        if (f == 1.0F)
        {
            entityarrow.setIsCritical(true);
        }

        int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, stack);

        if (j > 0)
        {
            entityarrow.setDamage(entityarrow.getDamage() + (double)j * 0.5D + 0.5D);
        }

        int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, stack);

        if (k > 0)
        {
            entityarrow.setKnockbackStrength(k);
        }

        if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, stack) > 0)
        {
            entityarrow.setFire(100);
        }

        stack.damageItem(1, playerIn);
        worldIn.playSoundAtEntity(playerIn, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);

        if (flag)
        {
            entityarrow.canBePickedUp = 2;
        }
        else
        {
            playerIn.inventory.consumeInventoryItem(Items.arrow);
        }

        playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);

        if (!worldIn.isRemote)
        {
            worldIn.spawnEntityInWorld(entityarrow);
        }
    }
}
 
Example 8
Project: DecompiledMinecraft   File: ItemBow.java   Source Code and License Vote up 4 votes
/**
 * Called when the player stops using an Item (stops holding the right mouse button).
 */
public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityPlayer playerIn, int timeLeft)
{
    boolean flag = playerIn.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0;

    if (flag || playerIn.inventory.hasItem(Items.arrow))
    {
        int i = this.getMaxItemUseDuration(stack) - timeLeft;
        float f = (float)i / 20.0F;
        f = (f * f + f * 2.0F) / 3.0F;

        if ((double)f < 0.1D)
        {
            return;
        }

        if (f > 1.0F)
        {
            f = 1.0F;
        }

        EntityArrow entityarrow = new EntityArrow(worldIn, playerIn, f * 2.0F);

        if (f == 1.0F)
        {
            entityarrow.setIsCritical(true);
        }

        int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, stack);

        if (j > 0)
        {
            entityarrow.setDamage(entityarrow.getDamage() + (double)j * 0.5D + 0.5D);
        }

        int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, stack);

        if (k > 0)
        {
            entityarrow.setKnockbackStrength(k);
        }

        if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, stack) > 0)
        {
            entityarrow.setFire(100);
        }

        stack.damageItem(1, playerIn);
        worldIn.playSoundAtEntity(playerIn, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);

        if (flag)
        {
            entityarrow.canBePickedUp = 2;
        }
        else
        {
            playerIn.inventory.consumeInventoryItem(Items.arrow);
        }

        playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);

        if (!worldIn.isRemote)
        {
            worldIn.spawnEntityInWorld(entityarrow);
        }
    }
}
 
Example 9
Project: BaseClient   File: ItemBow.java   Source Code and License Vote up 4 votes
/**
 * Called when the player stops using an Item (stops holding the right mouse button).
 */
public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityPlayer playerIn, int timeLeft)
{
    boolean flag = playerIn.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0;

    if (flag || playerIn.inventory.hasItem(Items.arrow))
    {
        int i = this.getMaxItemUseDuration(stack) - timeLeft;
        float f = (float)i / 20.0F;
        f = (f * f + f * 2.0F) / 3.0F;

        if ((double)f < 0.1D)
        {
            return;
        }

        if (f > 1.0F)
        {
            f = 1.0F;
        }

        EntityArrow entityarrow = new EntityArrow(worldIn, playerIn, f * 2.0F);

        if (f == 1.0F)
        {
            entityarrow.setIsCritical(true);
        }

        int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, stack);

        if (j > 0)
        {
            entityarrow.setDamage(entityarrow.getDamage() + (double)j * 0.5D + 0.5D);
        }

        int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, stack);

        if (k > 0)
        {
            entityarrow.setKnockbackStrength(k);
        }

        if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, stack) > 0)
        {
            entityarrow.setFire(100);
        }

        stack.damageItem(1, playerIn);
        worldIn.playSoundAtEntity(playerIn, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);

        if (flag)
        {
            entityarrow.canBePickedUp = 2;
        }
        else
        {
            playerIn.inventory.consumeInventoryItem(Items.arrow);
        }

        playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);

        if (!worldIn.isRemote)
        {
            worldIn.spawnEntityInWorld(entityarrow);
        }
    }
}
 
Example 10
Project: BaseClient   File: ItemBow.java   Source Code and License Vote up 4 votes
/**
 * Called when the player stops using an Item (stops holding the right mouse button).
 */
public void onPlayerStoppedUsing(ItemStack stack, World worldIn, EntityPlayer playerIn, int timeLeft)
{
    boolean flag = playerIn.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0;

    if (flag || playerIn.inventory.hasItem(Items.arrow))
    {
        int i = this.getMaxItemUseDuration(stack) - timeLeft;
        float f = (float)i / 20.0F;
        f = (f * f + f * 2.0F) / 3.0F;

        if ((double)f < 0.1D)
        {
            return;
        }

        if (f > 1.0F)
        {
            f = 1.0F;
        }

        EntityArrow entityarrow = new EntityArrow(worldIn, playerIn, f * 2.0F);

        if (f == 1.0F)
        {
            entityarrow.setIsCritical(true);
        }

        int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, stack);

        if (j > 0)
        {
            entityarrow.setDamage(entityarrow.getDamage() + (double)j * 0.5D + 0.5D);
        }

        int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, stack);

        if (k > 0)
        {
            entityarrow.setKnockbackStrength(k);
        }

        if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, stack) > 0)
        {
            entityarrow.setFire(100);
        }

        stack.damageItem(1, playerIn);
        worldIn.playSoundAtEntity(playerIn, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);

        if (flag)
        {
            entityarrow.canBePickedUp = 2;
        }
        else
        {
            playerIn.inventory.consumeInventoryItem(Items.arrow);
        }

        playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);

        if (!worldIn.isRemote)
        {
            worldIn.spawnEntityInWorld(entityarrow);
        }
    }
}
 
Example 11
Project: Backmemed   File: EntityWitherSkeleton.java   Source Code and License Vote up 4 votes
protected EntityArrow func_190726_a(float p_190726_1_)
{
    EntityArrow entityarrow = super.func_190726_a(p_190726_1_);
    entityarrow.setFire(100);
    return entityarrow;
}