Package net.minecraft.entity.projectile

Examples of net.minecraft.entity.projectile.EntityArrow


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

        EntityArrow entityarrow = new EntityArrow(world, player, f * 2.0F);

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

        if(!player.capabilities.isCreativeMode)
        {
          setEnergy(itemstack, getEnergy(itemstack) - (getFireState(itemstack) ? 1200 : 120));
        }

        world.playSoundAtEntity(player, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);

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

        if(!world.isRemote)
        {
          world.spawnEntityInWorld(entityarrow);
          entityarrow.setFire(getFireState(itemstack) ? 60 : 0);
        }
      }
    }
  }
View Full Code Here


  @Override
  public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
  {
    if(entity instanceof EntityArrow && !world.isRemote)
    {
      EntityArrow entityarrow = (EntityArrow)entity;

      if(entityarrow.isBurning())
      {
        explode(world, x, y, z);
        world.setBlockToAir(x, y, z);
      }
    }
View Full Code Here

    public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity)
    {
        int meta = world.getBlockMetadata(x, y, z);
        if (meta == 3 && entity instanceof EntityArrow && !world.isRemote)
        {
            EntityArrow entityarrow = (EntityArrow) entity;

            if (entityarrow.isBurning())
            {
                this.explode(world, x, y, z, 1, entityarrow.shootingEntity instanceof EntityLiving ? (EntityLiving) entityarrow.shootingEntity : null);
                world.setBlockToAir(x, y, z);
                return;
            }
View Full Code Here

        return true;
    }

    public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2)
    {
        EntityArrow entityarrow = new EntityArrow(this.worldObj, this, par1EntityLivingBase, 0.8F, 50 - this.worldObj.difficultySetting.getDifficultyId() * 4);
        int i = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, this.getHeldItem());
        int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, this.getHeldItem());
        entityarrow.setDamage(par2 * 2.0F + this.rand.nextGaussian() * 0.25D + this.worldObj.difficultySetting.getDifficultyId() * 0.11F);

        if (i > 0)
        {
            entityarrow.setDamage(entityarrow.getDamage() + 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);
    }
View Full Code Here

        {
            var1 = new EntityArrowGC(this.worldObj, this, entitylivingbase, 0.3F, 12.0F);
        }
        else
        {
            var1 = new EntityArrow(this.worldObj, this, entitylivingbase, 1.6F, 12.0F);
        }

        this.worldObj.playSoundAtEntity(this, "random.bow", 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
        this.worldObj.spawnEntityInWorld(var1);
    }
View Full Code Here

      if (f > 1.0F) {
        f = 1.0F;
      } else if (f < 0.1F) {
        return;
      }
      EntityArrow arrow = new EntityArrow(world, player, f * arrowSpeedMultiplier);

      double damage = arrow.getDamage() * arrowDamageMultiplier;
      arrow.setDamage(damage);

      if (f == 1.0F) {
        arrow.setIsCritical(true);
      }
      int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, stack);

      if (k > 0) {
        arrow.setDamage(damage + k * 0.5D + 0.5D);
      }
      int l = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, stack);

      if (l > 0) {
        arrow.setKnockbackStrength(l);
      }
      if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, stack) > 0) {
        arrow.setFire(100);
      }
      world.playSoundAtEntity(player, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);

      if (flag) {
        arrow.canBePickedUp = 2;
View Full Code Here

  @Override
  public void onEntityCollidedWithBlock(World w, int x, int y, int z, Entity entity)
  {
    if ( entity instanceof EntityArrow && !w.isRemote )
    {
      EntityArrow entityarrow = (EntityArrow) entity;

      if ( entityarrow.isBurning() )
      {
        this.startFuse( w, x, y, z, entityarrow.shootingEntity instanceof EntityLivingBase ? (EntityLivingBase) entityarrow.shootingEntity : null );
        w.setBlockToAir( x, y, z );
      }
    }
View Full Code Here

    @Override
    public void onEntityCollidedWithBlock (World par1World, int par2, int par3, int par4, Entity par5Entity)
    {
        if (par5Entity instanceof EntityArrow && !par1World.isRemote)
        {
            EntityArrow entityarrow = (EntityArrow) par5Entity;

            if (entityarrow.isBurning())
            {
                this.primeTnt(par1World, par2, par3, par4, 1, entityarrow.shootingEntity instanceof EntityLivingBase ? (EntityLivingBase) entityarrow.shootingEntity : null);
                WorldHelper.setBlockToAir(par1World, par2, par3, par4);
            }
        }
View Full Code Here

            if (speedBase > flightSpeed)
            {
                speedBase = flightSpeed;
            }

            EntityArrow arrowEntity = null;
            // if (tinkerArrow != null)
            if (slotID != -1 && (arrowID == -1 || slotID < arrowID))
            {
                ItemStack arrowStack = tinkerArrow.copy();
                arrowStack.stackSize = 1;
                arrowEntity = new ArrowEntity(world, player, speedBase * 2.0F, arrowStack);
            }
            else
            {
                arrowEntity = new EntityArrow(world, player, speedBase * 2.0F);
            }

            if (speedBase >= 1.0F)
            {
                arrowEntity.setIsCritical(true);
            }

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

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

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

            if (slotID != -1 && (arrowID == -1 || slotID < arrowID))
                ((ArrowEntity) arrowEntity).setKnockbackModStrength(toolTag.getFloat("Knockback"));
            // var10 += toolTag.getFloat("Knockback");

            if (var10 > 0)
            {
                arrowEntity.setKnockbackStrength(var10);
            }

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

            int reinforced = 0;

            if (toolTag.hasKey("Unbreaking"))
View Full Code Here

                            projectile.setDead();
                            event.setCanceled(true);

                            if (projectile.getClass() == EntityArrow.class && !player.worldObj.isRemote)
                            {
                                EntityArrow reflection = null;
                                if (attacker instanceof EntityLivingBase)
                                    reflection = new EntityArrow(player.worldObj, (EntityLivingBase) attacker, 0);
                                else
                                    reflection = new EntityArrow(player.worldObj, player, 0);

                                Vec3 look = player.getLookVec();
                                reflection.posX = projectile.posX;
                                reflection.posY = projectile.posY;
                                reflection.posZ = projectile.posZ;
View Full Code Here

TOP

Related Classes of net.minecraft.entity.projectile.EntityArrow

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.