Search in sources :

Example 21 with EntityArrow

use of net.minecraft.entity.projectile.EntityArrow in project Galacticraft by micdoodle8.

the class EntitySkeletonBoss method onDeath.

@Override
public void onDeath(DamageSource par1DamageSource) {
    super.onDeath(par1DamageSource);
    if (par1DamageSource.getSourceOfDamage() instanceof EntityArrow && par1DamageSource.getEntity() instanceof EntityPlayer) {
        final EntityPlayer var2 = (EntityPlayer) par1DamageSource.getEntity();
        final double var3 = var2.posX - this.posX;
        final double var5 = var2.posZ - this.posZ;
        if (var3 * var3 + var5 * var5 >= 2500.0D) {
            var2.triggerAchievement(AchievementList.snipeSkeleton);
        }
    }
}
Also used : EntityArrow(net.minecraft.entity.projectile.EntityArrow) EntityPlayer(net.minecraft.entity.player.EntityPlayer)

Example 22 with EntityArrow

use of net.minecraft.entity.projectile.EntityArrow in project Galacticraft by micdoodle8.

the class EntityEvolvedSkeleton method attackEntityWithRangedAttack.

@Override
public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2) {
    EntityArrow entityarrow = new EntityArrow(this.worldObj, this, par1EntityLivingBase, 0.4F, 17 - 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(par2 * 2.0F + this.rand.nextGaussian() * 0.25D + this.worldObj.getDifficulty().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);
}
Also used : EntityArrow(net.minecraft.entity.projectile.EntityArrow)

Example 23 with EntityArrow

use of net.minecraft.entity.projectile.EntityArrow in project Galacticraft by micdoodle8.

the class EntitySlimeling method attackEntityFrom.

@Override
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) {
    if (this.isEntityInvulnerable(par1DamageSource)) {
        return false;
    } else {
        Entity entity = par1DamageSource.getEntity();
        this.setSittingAI(false);
        if (entity != null && !(entity instanceof EntityPlayer) && !(entity instanceof EntityArrow)) {
            par2 = (par2 + 1.0F) / 2.0F;
        }
        return super.attackEntityFrom(par1DamageSource, par2);
    }
}
Also used : Entity(net.minecraft.entity.Entity) EntityArrow(net.minecraft.entity.projectile.EntityArrow) EntityPlayer(net.minecraft.entity.player.EntityPlayer)

Example 24 with EntityArrow

use of net.minecraft.entity.projectile.EntityArrow in project BuildCraft by BuildCraft.

the class PipeItemsObsidian method canSuck.

public boolean canSuck(Entity entity, int distance) {
    if (!entity.isEntityAlive()) {
        return false;
    }
    if (entity instanceof EntityItem) {
        EntityItem item = (EntityItem) entity;
        if (item.getEntityItem().stackSize <= 0) {
            return false;
        }
        long wt = entity.worldObj.getTotalWorldTime();
        if (entityDropTime.containsKey(entity) && entityDropTime.get(entity) >= wt) {
            return false;
        }
        return battery.getEnergyStored() >= distance * 10;
    } else if (entity instanceof EntityArrow) {
        EntityArrow arrow = (EntityArrow) entity;
        return arrow.canBePickedUp == 1 && battery.getEnergyStored() >= distance * 10;
    }
    return false;
}
Also used : EntityArrow(net.minecraft.entity.projectile.EntityArrow) EntityItem(net.minecraft.entity.item.EntityItem)

Example 25 with EntityArrow

use of net.minecraft.entity.projectile.EntityArrow in project BuildCraft by BuildCraft.

the class PipeItemsObsidian method pullItemIntoPipe.

public void pullItemIntoPipe(Entity entity, int distance) {
    if (container.getWorld().isRemote) {
        return;
    }
    EnumFacing orientation = getOpenOrientation();
    if (orientation != null) {
        orientation = orientation.getOpposite();
        container.getWorld().playSoundAtEntity(entity, "random.pop", 0.2F, ((container.getWorld().rand.nextFloat() - container.getWorld().rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
        ItemStack stack;
        double speed = 0.01F;
        if (entity instanceof EntityItem) {
            EntityItem item = (EntityItem) entity;
            ItemStack contained = item.getEntityItem();
            if (contained == null) {
                return;
            }
            TransportProxy.proxy.obsidianPipePickup(container.getWorld(), item, this.container);
            int energyUsed = Math.min(10 * contained.stackSize * distance, battery.getEnergyStored());
            if (distance == 0 || energyUsed / distance / 10 == contained.stackSize) {
                stack = contained;
                CoreProxy.proxy.removeEntity(entity);
            } else {
                stack = contained.splitStack(energyUsed / distance / 10);
            }
            battery.useEnergy(energyUsed, energyUsed, false);
            speed = Math.sqrt(item.motionX * item.motionX + item.motionY * item.motionY + item.motionZ * item.motionZ);
            speed = speed / 2F - 0.05;
            if (speed < 0.01) {
                speed = 0.01;
            }
        } else if (entity instanceof EntityArrow && battery.useEnergy(distance * 10, distance * 10, false) > 0) {
            stack = new ItemStack(Items.arrow, 1);
            CoreProxy.proxy.removeEntity(entity);
        } else {
            return;
        }
        if (stack == null) {
            return;
        }
        TravelingItem item = TravelingItem.make(0.5f, stack);
        item.setSpeed((float) speed);
        transport.injectItem(item, orientation, true);
    }
}
Also used : EntityArrow(net.minecraft.entity.projectile.EntityArrow) EnumFacing(net.minecraft.util.EnumFacing) TravelingItem(buildcraft.transport.TravelingItem) ItemStack(net.minecraft.item.ItemStack) EntityItem(net.minecraft.entity.item.EntityItem)

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