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);
}
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;
}
}
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;
}
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);
}
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);
}
Aggregations