Search in sources :

Example 6 with EntityArrow

use of net.minecraft.entity.projectile.EntityArrow in project Minestuck by mraof.

the class EntityPawn method attackEntityWithRangedAttack.

@Override
public void attackEntityWithRangedAttack(EntityLivingBase target, float f1) {
    EntityArrow arrow = new EntityTippedArrow(this.world, this);
    double d0 = target.posX - this.posX;
    double d1 = target.getEntityBoundingBox().minY + (double) (target.height / 3.0F) - arrow.posY;
    double d2 = target.posZ - this.posZ;
    double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
    arrow.shoot(d0, d1 + d3 * 0.2D, d2, 1.6F, 12.0F);
    int power = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.POWER, this);
    int punch = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.PUNCH, this);
    if (power > 0) {
        arrow.setDamage(arrow.getDamage() + (double) power * 0.5D + 0.5D);
    }
    if (punch > 0) {
        arrow.setKnockbackStrength(punch);
    }
    if (EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.FLAME, this) > 0) {
        arrow.setFire(100);
    }
    playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
    // EntityPawn pawn = this.getClass() == EntityWhitePawn.class ? new EntityWhitePawn(this.worldObj, 0) : new EntityBlackPawn(this.worldObj, 0);
    // pawn.setLocationAndAngles(this.posX, this.posY, this.posZ, 0, 0);
    // pawn.initCreature();
    // this.worldObj.spawnEntityInWorld(pawn);
    // I was just messing around to see if I could make an EntityLiving spawn more EntityLiving, it can
    this.world.spawnEntity(arrow);
}
Also used : EntityArrow(net.minecraft.entity.projectile.EntityArrow) EntityTippedArrow(net.minecraft.entity.projectile.EntityTippedArrow)

Example 7 with EntityArrow

use of net.minecraft.entity.projectile.EntityArrow in project Tale-of-Kingdoms by Ivasik78.

the class EntityDefendArcher method attackEntity.

@Override
protected void attackEntity(Entity entity, float f) {
    if (f < 10.0F) {
        double d = entity.posX - this.posX, d1 = entity.posZ - this.posZ;
        if (this.attackTime == 0) {
            EntityArrow entityarrow = new EntityArrow(this.worldObj, this, 1.0F);
            double d2 = entity.posY + (double) entity.getEyeHeight() - 0.699999988079071D - entityarrow.posY;
            float f1 = MathHelper.sqrt_double(d * d + d1 * d1) * 0.2F;
            this.worldObj.playSoundAtEntity(this, "random.bow", 1.0F, 1.0F / (this.rand.nextFloat() * 0.4F + 0.8F));
            this.worldObj.spawnEntityInWorld(entityarrow);
            entityarrow.setThrowableHeading(d, d2 + (double) f1, d1, 1.6F, 12.0F);
            this.attackTime = 30;
            ++this.level;
            if (this.level > 12)
                this.upgrade();
        }
        this.rotationYaw = (float) (Math.atan2(d1, d) * 180.0D / 3.1415927410125732D) - 90.0F;
        this.hasAttacked = true;
    }
}
Also used : EntityArrow(net.minecraft.entity.projectile.EntityArrow)

Example 8 with EntityArrow

use of net.minecraft.entity.projectile.EntityArrow in project takumicraft by TNTModders.

the class EntityWitherSkeletonCreeper method getArrow.

@Override
protected EntityArrow getArrow(float p_190726_1_) {
    EntityArrow entityarrow = super.getArrow(p_190726_1_);
    entityarrow.setFire(100);
    return entityarrow;
}
Also used : EntityArrow(net.minecraft.entity.projectile.EntityArrow)

Example 9 with EntityArrow

use of net.minecraft.entity.projectile.EntityArrow in project takumicraft by TNTModders.

the class EntityIllusionerCreeper method attackEntityWithRangedAttack.

/**
 * Attack the specified entity using a ranged attack.
 */
@Override
public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor) {
    EntityArrow entityarrow = this.createArrowEntity(distanceFactor);
    double d0 = target.posX - this.posX;
    double d1 = target.getEntityBoundingBox().minY + (double) (target.height / 3.0F) - entityarrow.posY;
    double d2 = target.posZ - this.posZ;
    double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
    entityarrow.setThrowableHeading(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.world.getDifficulty().getDifficultyId() * 4));
    this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
    this.world.spawnEntity(entityarrow);
}
Also used : EntityArrow(net.minecraft.entity.projectile.EntityArrow)

Example 10 with EntityArrow

use of net.minecraft.entity.projectile.EntityArrow in project takumicraft by TNTModders.

the class TakumiEntityCore method renderRegister.

@SideOnly(Side.CLIENT)
private static void renderRegister() {
    RenderingRegistry.registerEntityRenderingHandler(EntityTakumiArrow.class, manager -> new RenderArrow<EntityArrow>(manager) {

        @Override
        protected ResourceLocation getEntityTexture(EntityArrow entity) {
            return new ResourceLocation(TakumiCraftCore.MODID, "textures/entity/item/carrow.png");
        }
    });
    RenderingRegistry.registerEntityRenderingHandler(EntityTakumiSnowBall.class, manager -> new RenderSnowball<>(manager, Items.SNOWBALL, Minecraft.getMinecraft().getRenderItem()));
    RenderingRegistry.registerEntityRenderingHandler(EntityTakumiExpEgg.class, manager -> new RenderSnowball<>(manager, Items.EGG, Minecraft.getMinecraft().getRenderItem()));
    RenderingRegistry.registerEntityRenderingHandler(EntityTakumiTNTPrimed.class, RenderTakumiTNTPrimed::new);
    RenderingRegistry.registerEntityRenderingHandler(EntityLlamaCreeperSpit.class, RenderLlamaCreeperSpit::new);
    RenderingRegistry.registerEntityRenderingHandler(EntityTakumiChocolateBall.class, manager -> new RenderSnowball<>(manager, TakumiItemCore.TAKUMI_CHOCO_BALL, Minecraft.getMinecraft().getRenderItem()));
    RenderingRegistry.registerEntityRenderingHandler(EntityDarkVillager.class, RenderDarkVillager::new);
    RenderingRegistry.registerEntityRenderingHandler(EntityTransHomingBomb.class, manager -> new RenderShulkerBullet(manager) {

        @Override
        public void doRender(EntityShulkerBullet entity, double x, double y, double z, float entityYaw, float partialTicks) {
        }
    });
    RenderingRegistry.registerEntityRenderingHandler(EntityAttackBlock.class, RenderAttackBlock::new);
}
Also used : EntityShulkerBullet(net.minecraft.entity.projectile.EntityShulkerBullet) EntityArrow(net.minecraft.entity.projectile.EntityArrow) RenderTakumiTNTPrimed(com.tntmodders.takumi.client.render.RenderTakumiTNTPrimed) RenderAttackBlock(com.tntmodders.takumi.client.render.RenderAttackBlock) RenderShulkerBullet(net.minecraft.client.renderer.entity.RenderShulkerBullet) RenderDarkVillager(com.tntmodders.takumi.client.render.RenderDarkVillager) RenderLlamaCreeperSpit(com.tntmodders.takumi.client.render.RenderLlamaCreeperSpit) ResourceLocation(net.minecraft.util.ResourceLocation) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

EntityArrow (net.minecraft.entity.projectile.EntityArrow)43 EntityPlayer (net.minecraft.entity.player.EntityPlayer)21 ItemStack (net.minecraft.item.ItemStack)15 Entity (net.minecraft.entity.Entity)9 ItemArrow (net.minecraft.item.ItemArrow)9 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)5 EntityLivingBase (net.minecraft.entity.EntityLivingBase)4 EntityItem (net.minecraft.entity.item.EntityItem)4 EntityPotion (net.minecraft.entity.projectile.EntityPotion)3 EntityThrowable (net.minecraft.entity.projectile.EntityThrowable)3 EntityTippedArrow (net.minecraft.entity.projectile.EntityTippedArrow)3 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)3 ItemLivingArmour (WayofTime.bloodmagic.item.armour.ItemLivingArmour)2 LivingArmour (WayofTime.bloodmagic.livingArmour.LivingArmour)2 LivingArmourUpgrade (WayofTime.bloodmagic.livingArmour.LivingArmourUpgrade)2 EntityJuicer (micdoodle8.mods.galacticraft.planets.venus.entities.EntityJuicer)2 IProjectile (net.minecraft.entity.IProjectile)2 EntityFireball (net.minecraft.entity.projectile.EntityFireball)2 EntityShulkerBullet (net.minecraft.entity.projectile.EntityShulkerBullet)2 TileEntity (net.minecraft.tileentity.TileEntity)2