use of net.minecraft.entity.projectile.EntityTippedArrow in project Pearcel-Mod by MiningMark48.
the class ItemPearcelArrow method createArrow.
public EntityArrow createArrow(World worldIn, ItemStack stack, EntityLivingBase shooter) {
EntityTippedArrow entitytippedarrow = new EntityTippedArrow(worldIn, shooter);
entitytippedarrow.setPotionEffect(stack);
return entitytippedarrow;
}
use of net.minecraft.entity.projectile.EntityTippedArrow in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class ItemExplosiveArrow method createArrow.
@Override
public EntityArrow createArrow(World worldIn, ItemStack stack, EntityLivingBase shooter) {
EntityTippedArrow entitytippedarrow = new EntityTippedArrow(worldIn, shooter) {
private boolean doExpl = true;
@Override
public void onUpdate() {
super.onUpdate();
}
@Override
public boolean isImmuneToExplosions() {
return true;
}
@Override
protected void onHit(RayTraceResult raytraceResultIn) {
super.onHit(raytraceResultIn);
worldObj.createExplosion(this, posX, posY, posZ, 20F, true);
kill();
}
};
entitytippedarrow.setPotionEffect(stack);
return entitytippedarrow;
}
use of net.minecraft.entity.projectile.EntityTippedArrow in project SpongeCommon by SpongePowered.
the class EntityHuman method attackEntityWithRangedAttack.
@Override
public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor) {
// Borrowed from Skeleton
// TODO Figure out how to API this out
final EntityTippedArrow entitytippedarrow = new EntityTippedArrow(this.world, this);
double d0 = target.posX - this.posX;
double d1 = target.getEntityBoundingBox().minY + target.height / 3.0F - entitytippedarrow.posY;
double d2 = target.posZ - this.posZ;
double d3 = MathHelper.sqrt(d0 * d0 + d2 * d2);
entitytippedarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, 14 - this.world.getDifficulty().getDifficultyId() * 4);
// These names are wrong
int i = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.PUNCH, this);
int j = EnchantmentHelper.getMaxEnchantmentLevel(Enchantments.FLAME, this);
entitytippedarrow.setDamage(distanceFactor * 2.0F + this.rand.nextGaussian() * 0.25D + this.world.getDifficulty().getDifficultyId() * 0.11F);
if (i > 0) {
entitytippedarrow.setDamage(entitytippedarrow.getDamage() + i * 0.5D + 0.5D);
}
if (j > 0) {
entitytippedarrow.setKnockbackStrength(j);
}
final ItemStack itemstack = this.getHeldItem(EnumHand.OFF_HAND);
if (itemstack.getItem() == Items.TIPPED_ARROW) {
entitytippedarrow.setPotionEffect(itemstack);
}
this.playSound(SoundEvents.ENTITY_ARROW_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
this.world.spawnEntity(entitytippedarrow);
}
use of net.minecraft.entity.projectile.EntityTippedArrow in project Tropicraft by Tropicraft.
the class EntityAshenHunter method attackEntityWithRangedAttack.
/**
* Attack the specified entity using a ranged attack.
*
* @param distanceFactor How far the target is, normalized and clamped between 0.1 and 1.0
*/
@Override
public void attackEntityWithRangedAttack(EntityLivingBase target, float distanceFactor) {
ItemStack headGear = target.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
if (headGear != null && headGear.getItem() != null) {
if (headGear.getItem() instanceof ItemAshenMask)
return;
}
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.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.world.getDifficulty().getDifficultyId() * 4));
entitytippedarrow.setDamage(1);
entitytippedarrow.setKnockbackStrength(0);
ItemStack itemstack = new ItemStack(Items.TIPPED_ARROW);
itemstack = PotionUtils.addPotionToItemStack(itemstack, PotionType.getPotionTypeForName("slowness"));
entitytippedarrow.setPotionEffect(itemstack);
entitytippedarrow.addEffect(new PotionEffect(MobEffects.SLOWNESS, 100, 10));
this.playSound(SoundEvents.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRNG().nextFloat() * 0.4F + 0.8F));
this.world.spawnEntity(entitytippedarrow);
}
use of net.minecraft.entity.projectile.EntityTippedArrow in project Cavern2 by kegare.
the class EntityCavenicSkeleton method getArrow.
@Override
protected EntityArrow getArrow(float dist) {
ItemStack heldOff = getItemStackFromSlot(EntityEquipmentSlot.OFFHAND);
if (heldOff.getItem() == Items.SPECTRAL_ARROW) {
EntitySpectralArrow arrow = new EntitySpectralArrow(this.world, this);
arrow.setEnchantmentEffectsFromEntity(this, dist);
return arrow;
} else {
EntityArrow arrow = new EntityCavenicArrow(world, this);
arrow.setEnchantmentEffectsFromEntity(this, dist);
if (heldOff.getItem() == Items.TIPPED_ARROW && arrow instanceof EntityTippedArrow) {
((EntityTippedArrow) arrow).setPotionEffect(heldOff);
}
return arrow;
}
}
Aggregations