Ejemplo n.º 1
0
 protected internal override void AttackEntity(net.minecraft.src.Entity entity, float
                                               f)
 {
     if (f < 10F)
     {
         double d  = entity.posX - posX;
         double d1 = entity.posZ - posZ;
         if (attackTime == 0)
         {
             net.minecraft.src.EntityArrow entityarrow = new net.minecraft.src.EntityArrow(worldObj
                                                                                           , this);
             entityarrow.posY += 1.3999999761581421D;
             double d2 = (entity.posY + (double)entity.GetEyeHeight()) - 0.20000000298023224D
                         - entityarrow.posY;
             float f1 = net.minecraft.src.MathHelper.Sqrt_double(d * d + d1 * d1) * 0.2F;
             worldObj.PlaySoundAtEntity(this, "random.bow", 1.0F, 1.0F / (rand.NextFloat() * 0.4F
                                                                          + 0.8F));
             worldObj.AddEntity(entityarrow);
             entityarrow.SetArrowHeading(d, d2 + (double)f1, d1, 0.6F, 12F);
             attackTime = 30;
         }
         rotationYaw = (float)((System.Math.Atan2(d1, d) * 180D) / 3.1415927410125732D) -
                       90F;
         hasAttacked = true;
     }
 }
Ejemplo n.º 2
0
 public virtual bool CanEntityBeSeen(net.minecraft.src.Entity entity)
 {
     return(worldObj.RayTraceBlocks(net.minecraft.src.Vec3D.CreateVector(posX, posY +
                                                                         (double)GetEyeHeight(), posZ), net.minecraft.src.Vec3D.CreateVector(entity.posX,
                                                                                                                                             entity.posY + (double)entity.GetEyeHeight(), entity.posZ)) == null);
 }